Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
8a17cf89
Commit
8a17cf89
authored
Mar 25, 2016
by
Jacek Caban
Committed by
Alexandre Julliard
Mar 25, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jscript: Keep track of active call in a separated structure.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
27528e54
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
11 deletions
+40
-11
engine.c
dlls/jscript/engine.c
+32
-8
engine.h
dlls/jscript/engine.h
+5
-0
global.c
dlls/jscript/global.c
+2
-2
jscript.h
dlls/jscript/jscript.h
+1
-1
No files found.
dlls/jscript/engine.c
View file @
8a17cf89
...
...
@@ -511,8 +511,8 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re
TRACE
(
"%s
\n
"
,
debugstr_w
(
identifier
));
if
(
ctx
->
exec
_ctx
)
{
for
(
scope
=
ctx
->
exec_ctx
->
scope_chain
;
scope
;
scope
=
scope
->
next
)
{
if
(
ctx
->
call
_ctx
)
{
for
(
scope
=
ctx
->
call_ctx
->
exec_ctx
->
scope_chain
;
scope
;
scope
=
scope
->
next
)
{
if
(
scope
->
jsobj
)
hres
=
jsdisp_get_id
(
scope
->
jsobj
,
identifier
,
fdexNameImplicit
,
&
id
);
else
...
...
@@ -2393,6 +2393,11 @@ OP_LIST
#undef X
};
static
void
release_call_frame
(
call_frame_t
*
frame
)
{
heap_free
(
frame
);
}
static
HRESULT
unwind_exception
(
exec_ctx_t
*
ctx
)
{
except_frame_t
*
except_frame
;
...
...
@@ -2446,17 +2451,19 @@ static HRESULT unwind_exception(exec_ctx_t *ctx)
static
HRESULT
enter_bytecode
(
script_ctx_t
*
ctx
,
bytecode_t
*
code
,
function_code_t
*
func
,
jsval_t
*
ret
)
{
exec_ctx_t
*
exec_ctx
=
ctx
->
exec_ctx
;
exec_ctx_t
*
exec_ctx
=
ctx
->
call_ctx
->
exec_ctx
;
except_frame_t
*
prev_except_frame
;
function_code_t
*
prev_func
;
unsigned
prev_ip
,
prev_top
;
scope_chain_t
*
prev_scope
;
bytecode_t
*
prev_code
;
call_frame_t
*
frame
;
jsop_t
op
;
HRESULT
hres
=
S_OK
;
TRACE
(
"
\n
"
);
frame
=
ctx
->
call_ctx
;
prev_top
=
exec_ctx
->
top
;
prev_scope
=
exec_ctx
->
scope_chain
;
prev_except_frame
=
exec_ctx
->
except_frame
;
...
...
@@ -2490,6 +2497,10 @@ static HRESULT enter_bytecode(script_ctx_t *ctx, bytecode_t *code, function_code
exec_ctx
->
code
=
prev_code
;
exec_ctx
->
func_code
=
prev_func
;
assert
(
ctx
->
call_ctx
==
frame
);
ctx
->
call_ctx
=
frame
->
prev_frame
;
release_call_frame
(
frame
);
if
(
FAILED
(
hres
))
{
while
(
exec_ctx
->
scope_chain
!=
prev_scope
)
scope_pop
(
&
exec_ctx
->
scope_chain
);
...
...
@@ -2543,9 +2554,23 @@ static HRESULT bind_event_target(script_ctx_t *ctx, function_code_t *func, jsdis
return
hres
;
}
static
HRESULT
setup_call_frame
(
exec_ctx_t
*
ctx
)
{
call_frame_t
*
frame
;
frame
=
heap_alloc_zero
(
sizeof
(
*
frame
));
if
(
!
frame
)
return
E_OUTOFMEMORY
;
frame
->
exec_ctx
=
ctx
;
frame
->
prev_frame
=
ctx
->
script
->
call_ctx
;
ctx
->
script
->
call_ctx
=
frame
;
return
S_OK
;
}
HRESULT
exec_source
(
exec_ctx_t
*
ctx
,
bytecode_t
*
code
,
function_code_t
*
func
,
jsval_t
*
ret
)
{
exec_ctx_t
*
prev_ctx
;
jsval_t
val
;
unsigned
i
;
HRESULT
hres
=
S_OK
;
...
...
@@ -2579,12 +2604,11 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, js
}
}
prev_ctx
=
ctx
->
script
->
exec_ctx
;
ctx
->
script
->
exec_ctx
=
ctx
;
hres
=
setup_call_frame
(
ctx
);
if
(
FAILED
(
hres
))
return
hres
;
hres
=
enter_bytecode
(
ctx
->
script
,
code
,
func
,
&
val
);
assert
(
ctx
->
script
->
exec_ctx
==
ctx
);
ctx
->
script
->
exec_ctx
=
prev_ctx
;
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/engine.h
View file @
8a17cf89
...
...
@@ -190,6 +190,11 @@ static inline void scope_addref(scope_chain_t *scope)
typedef
struct
_except_frame_t
except_frame_t
;
struct
_parser_ctx_t
;
typedef
struct
_call_frame_t
{
struct
_call_frame_t
*
prev_frame
;
exec_ctx_t
*
exec_ctx
;
}
call_frame_t
;
struct
_exec_ctx_t
{
LONG
ref
;
...
...
dlls/jscript/global.c
View file @
8a17cf89
...
...
@@ -206,7 +206,7 @@ static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
return
S_OK
;
}
if
(
!
ctx
->
exec
_ctx
)
{
if
(
!
ctx
->
call
_ctx
)
{
FIXME
(
"No active exec_ctx
\n
"
);
return
E_UNEXPECTED
;
}
...
...
@@ -222,7 +222,7 @@ static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
return
throw_syntax_error
(
ctx
,
hres
,
NULL
);
}
hres
=
exec_source
(
ctx
->
exec_ctx
,
code
,
&
code
->
global_code
,
r
);
hres
=
exec_source
(
ctx
->
call_ctx
->
exec_ctx
,
code
,
&
code
->
global_code
,
r
);
release_bytecode
(
code
);
return
hres
;
}
...
...
dlls/jscript/jscript.h
View file @
8a17cf89
...
...
@@ -385,7 +385,7 @@ struct _script_ctx_t {
SCRIPTSTATE
state
;
IActiveScript
*
active_script
;
exec_ctx_t
*
exec
_ctx
;
struct
_call_frame_t
*
call
_ctx
;
named_item_t
*
named_items
;
IActiveScriptSite
*
site
;
IInternetHostSecurityManager
*
secmgr
;
...
...
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