Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
0224f182
Commit
0224f182
authored
Mar 25, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Moved stack from execution context to script context.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
9e03bb2e
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
27 deletions
+24
-27
engine.c
dlls/jscript/engine.c
+18
-24
engine.h
dlls/jscript/engine.h
+0
-3
jscript.c
dlls/jscript/jscript.c
+2
-0
jscript.h
dlls/jscript/jscript.h
+4
-0
No files found.
dlls/jscript/engine.c
View file @
0224f182
...
...
@@ -61,15 +61,14 @@ typedef struct {
}
u
;
}
exprval_t
;
static
HRESULT
stack_push
(
script_ctx_t
*
script_
ctx
,
jsval_t
v
)
static
HRESULT
stack_push
(
script_ctx_t
*
ctx
,
jsval_t
v
)
{
exec_ctx_t
*
ctx
=
script_ctx
->
call_ctx
->
exec_ctx
;
if
(
!
ctx
->
stack_size
)
{
ctx
->
stack
=
heap_alloc
(
16
*
sizeof
(
*
ctx
->
stack
));
if
(
!
ctx
->
stack
)
return
E_OUTOFMEMORY
;
ctx
->
stack_size
=
16
;
}
else
if
(
ctx
->
stack_size
==
ctx
->
top
)
{
}
else
if
(
ctx
->
stack_size
==
ctx
->
stack_
top
)
{
jsval_t
*
new_stack
;
new_stack
=
heap_realloc
(
ctx
->
stack
,
ctx
->
stack_size
*
2
*
sizeof
(
*
new_stack
));
...
...
@@ -82,7 +81,7 @@ static HRESULT stack_push(script_ctx_t *script_ctx, jsval_t v)
ctx
->
stack_size
*=
2
;
}
ctx
->
stack
[
ctx
->
top
++
]
=
v
;
ctx
->
stack
[
ctx
->
stack_
top
++
]
=
v
;
return
S_OK
;
}
...
...
@@ -110,32 +109,28 @@ static HRESULT stack_push_objid(script_ctx_t *ctx, IDispatch *disp, DISPID id)
static
inline
jsval_t
stack_top
(
script_ctx_t
*
ctx
)
{
exec_ctx_t
*
exec_ctx
=
ctx
->
call_ctx
->
exec_ctx
;
assert
(
exec_ctx
->
top
>
ctx
->
call_ctx
->
stack_base
);
return
exec_ctx
->
stack
[
exec_ctx
->
top
-
1
];
assert
(
ctx
->
stack_top
>
ctx
->
call_ctx
->
stack_base
);
return
ctx
->
stack
[
ctx
->
stack_top
-
1
];
}
static
inline
jsval_t
stack_topn
(
script_ctx_t
*
ctx
,
unsigned
n
)
{
exec_ctx_t
*
exec_ctx
=
ctx
->
call_ctx
->
exec_ctx
;
assert
(
exec_ctx
->
top
>
ctx
->
call_ctx
->
stack_base
+
n
);
return
exec_ctx
->
stack
[
exec_ctx
->
top
-
1
-
n
];
assert
(
ctx
->
stack_top
>
ctx
->
call_ctx
->
stack_base
+
n
);
return
ctx
->
stack
[
ctx
->
stack_top
-
1
-
n
];
}
static
inline
jsval_t
*
stack_args
(
script_ctx_t
*
script_
ctx
,
unsigned
n
)
static
inline
jsval_t
*
stack_args
(
script_ctx_t
*
ctx
,
unsigned
n
)
{
exec_ctx_t
*
ctx
=
script_ctx
->
call_ctx
->
exec_ctx
;
if
(
!
n
)
return
NULL
;
assert
(
ctx
->
top
>
script_
ctx
->
call_ctx
->
stack_base
+
n
-
1
);
return
ctx
->
stack
+
ctx
->
top
-
n
;
assert
(
ctx
->
stack_top
>
ctx
->
call_ctx
->
stack_base
+
n
-
1
);
return
ctx
->
stack
+
ctx
->
stack_
top
-
n
;
}
static
inline
jsval_t
stack_pop
(
script_ctx_t
*
ctx
)
{
exec_ctx_t
*
exec_ctx
=
ctx
->
call_ctx
->
exec_ctx
;
assert
(
exec_ctx
->
top
>
ctx
->
call_ctx
->
stack_base
);
return
exec_ctx
->
stack
[
--
exec_ctx
->
top
];
assert
(
ctx
->
stack_top
>
ctx
->
call_ctx
->
stack_base
);
return
ctx
->
stack
[
--
ctx
->
stack_top
];
}
static
void
stack_popn
(
script_ctx_t
*
ctx
,
unsigned
n
)
...
...
@@ -355,7 +350,6 @@ void exec_release(exec_ctx_t *ctx)
if
(
ctx
->
script
)
script_release
(
ctx
->
script
);
jsval_release
(
ctx
->
ret
);
heap_free
(
ctx
->
stack
);
heap_free
(
ctx
);
}
...
...
@@ -778,7 +772,7 @@ static HRESULT interp_push_except(script_ctx_t *ctx)
TRACE
(
"
\n
"
);
stack_top
=
ctx
->
call_ctx
->
exec_ctx
->
top
;
stack_top
=
ctx
->
stack_
top
;
if
(
!
arg2
)
{
HRESULT
hres
;
...
...
@@ -2435,8 +2429,8 @@ static HRESULT unwind_exception(script_ctx_t *ctx)
except_frame
=
frame
->
except_frame
;
frame
->
except_frame
=
except_frame
->
next
;
assert
(
except_frame
->
stack_top
<=
frame
->
exec_ctx
->
top
);
stack_popn
(
ctx
,
frame
->
exec_ctx
->
top
-
except_frame
->
stack_top
);
assert
(
except_frame
->
stack_top
<=
ctx
->
stack_
top
);
stack_popn
(
ctx
,
ctx
->
stack_
top
-
except_frame
->
stack_top
);
while
(
except_frame
->
scope
!=
frame
->
scope
)
scope_pop
(
&
frame
->
scope
);
...
...
@@ -2509,10 +2503,10 @@ static HRESULT enter_bytecode(script_ctx_t *ctx, function_code_t *func, jsval_t
if
(
FAILED
(
hres
))
{
while
(
frame
->
scope
!=
frame
->
base_scope
)
scope_pop
(
&
frame
->
scope
);
stack_popn
(
ctx
,
exec_ctx
->
top
-
frame
->
stack_base
);
stack_popn
(
ctx
,
ctx
->
stack_
top
-
frame
->
stack_base
);
}
assert
(
exec_ctx
->
top
==
frame
->
stack_base
);
assert
(
ctx
->
stack_
top
==
frame
->
stack_base
);
assert
(
frame
->
scope
==
frame
->
base_scope
);
ctx
->
call_ctx
=
frame
->
prev_frame
;
release_call_frame
(
frame
);
...
...
@@ -2573,7 +2567,7 @@ static HRESULT setup_call_frame(exec_ctx_t *ctx, bytecode_t *bytecode, function_
frame
->
bytecode
=
bytecode
;
frame
->
function
=
function
;
frame
->
ip
=
function
->
instr_off
;
frame
->
stack_base
=
ctx
->
top
;
frame
->
stack_base
=
ctx
->
script
->
stack_
top
;
if
(
scope
)
frame
->
base_scope
=
frame
->
scope
=
scope_addref
(
scope
);
...
...
dlls/jscript/engine.h
View file @
0224f182
...
...
@@ -213,9 +213,6 @@ struct _exec_ctx_t {
IDispatch
*
this_obj
;
BOOL
is_global
;
jsval_t
*
stack
;
unsigned
stack_size
;
unsigned
top
;
jsval_t
ret
;
};
...
...
dlls/jscript/jscript.c
View file @
0224f182
...
...
@@ -74,6 +74,8 @@ void script_release(script_ctx_t *ctx)
heap_pool_free
(
&
ctx
->
tmp_heap
);
if
(
ctx
->
last_match
)
jsstr_release
(
ctx
->
last_match
);
assert
(
!
ctx
->
stack_top
);
heap_free
(
ctx
->
stack
);
ctx
->
jscaller
->
ctx
=
NULL
;
IServiceProvider_Release
(
&
ctx
->
jscaller
->
IServiceProvider_iface
);
...
...
dlls/jscript/jscript.h
View file @
0224f182
...
...
@@ -400,6 +400,10 @@ struct _script_ctx_t {
IDispatch
*
host_global
;
jsval_t
*
stack
;
unsigned
stack_size
;
unsigned
stack_top
;
jsstr_t
*
last_match
;
match_result_t
match_parens
[
9
];
DWORD
last_match_index
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment