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
32d9c598
Commit
32d9c598
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: Get rid of no longer needed exec_ctx_t.
Signed-off-by:
Jacek Caban
<
jacek@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
00ce4419
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
29 additions
and
92 deletions
+29
-92
engine.c
dlls/jscript/engine.c
+12
-41
engine.h
dlls/jscript/engine.h
+1
-15
function.c
dlls/jscript/function.c
+5
-11
global.c
dlls/jscript/global.c
+1
-1
jscript.c
dlls/jscript/jscript.c
+10
-23
jscript.h
dlls/jscript/jscript.h
+0
-1
No files found.
dlls/jscript/engine.c
View file @
32d9c598
...
...
@@ -295,33 +295,6 @@ void scope_release(scope_chain_t *scope)
heap_free
(
scope
);
}
HRESULT
create_exec_ctx
(
script_ctx_t
*
script_ctx
,
exec_ctx_t
**
ret
)
{
exec_ctx_t
*
ctx
;
ctx
=
heap_alloc_zero
(
sizeof
(
exec_ctx_t
));
if
(
!
ctx
)
return
E_OUTOFMEMORY
;
ctx
->
ref
=
1
;
script_addref
(
script_ctx
);
ctx
->
script
=
script_ctx
;
*
ret
=
ctx
;
return
S_OK
;
}
void
exec_release
(
exec_ctx_t
*
ctx
)
{
if
(
--
ctx
->
ref
)
return
;
if
(
ctx
->
script
)
script_release
(
ctx
->
script
);
heap_free
(
ctx
);
}
static
HRESULT
disp_get_id
(
script_ctx_t
*
ctx
,
IDispatch
*
disp
,
const
WCHAR
*
name
,
BSTR
name_bstr
,
DWORD
flags
,
DISPID
*
id
)
{
IDispatchEx
*
dispex
;
...
...
@@ -2530,7 +2503,7 @@ 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
,
bytecode_t
*
bytecode
,
function_code_t
*
function
,
scope_chain_t
*
scope
,
static
HRESULT
setup_call_frame
(
script
_ctx_t
*
ctx
,
bytecode_t
*
bytecode
,
function_code_t
*
function
,
scope_chain_t
*
scope
,
IDispatch
*
this_obj
,
BOOL
is_global
,
jsdisp_t
*
variable_obj
)
{
call_frame_t
*
frame
;
...
...
@@ -2554,7 +2527,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
->
s
cript
->
s
tack_top
;
frame
->
stack_base
=
ctx
->
stack_top
;
frame
->
ret
=
jsval_undefined
();
if
(
scope
)
...
...
@@ -2562,23 +2535,21 @@ static HRESULT setup_call_frame(exec_ctx_t *ctx, bytecode_t *bytecode, function_
if
(
this_obj
)
frame
->
this_obj
=
this_obj
;
else
if
(
ctx
->
script
->
host_global
)
frame
->
this_obj
=
ctx
->
script
->
host_global
;
else
if
(
ctx
->
host_global
)
frame
->
this_obj
=
ctx
->
host_global
;
else
frame
->
this_obj
=
to_disp
(
ctx
->
script
->
global
);
frame
->
this_obj
=
to_disp
(
ctx
->
global
);
IDispatch_AddRef
(
frame
->
this_obj
);
frame
->
is_global
=
is_global
;
frame
->
variable_obj
=
jsdisp_addref
(
variable_obj
);
frame
->
exec_ctx
=
ctx
;
frame
->
prev_frame
=
ctx
->
script
->
call_ctx
;
ctx
->
script
->
call_ctx
=
frame
;
frame
->
prev_frame
=
ctx
->
call_ctx
;
ctx
->
call_ctx
=
frame
;
return
S_OK
;
}
HRESULT
exec_source
(
exec
_ctx_t
*
ctx
,
bytecode_t
*
code
,
function_code_t
*
func
,
scope_chain_t
*
scope
,
HRESULT
exec_source
(
script
_ctx_t
*
ctx
,
bytecode_t
*
code
,
function_code_t
*
func
,
scope_chain_t
*
scope
,
IDispatch
*
this_obj
,
BOOL
is_global
,
jsdisp_t
*
variable_obj
,
jsval_t
*
ret
)
{
jsval_t
val
;
...
...
@@ -2591,12 +2562,12 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, sc
if
(
!
func
->
funcs
[
i
].
name
)
continue
;
hres
=
create_source_function
(
ctx
->
script
,
code
,
func
->
funcs
+
i
,
scope
,
&
func_obj
);
hres
=
create_source_function
(
ctx
,
code
,
func
->
funcs
+
i
,
scope
,
&
func_obj
);
if
(
FAILED
(
hres
))
return
hres
;
if
(
func
->
funcs
[
i
].
event_target
)
hres
=
bind_event_target
(
ctx
->
script
,
func
->
funcs
+
i
,
func_obj
);
hres
=
bind_event_target
(
ctx
,
func
->
funcs
+
i
,
func_obj
);
else
hres
=
jsdisp_propput_name
(
variable_obj
,
func
->
funcs
[
i
].
name
,
jsval_obj
(
func_obj
));
jsdisp_release
(
func_obj
);
...
...
@@ -2605,7 +2576,7 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, sc
}
for
(
i
=
0
;
i
<
func
->
var_cnt
;
i
++
)
{
if
(
!
is_global
||
!
lookup_global_members
(
ctx
->
script
,
func
->
variables
[
i
],
NULL
))
{
if
(
!
is_global
||
!
lookup_global_members
(
ctx
,
func
->
variables
[
i
],
NULL
))
{
DISPID
id
=
0
;
hres
=
jsdisp_get_id
(
variable_obj
,
func
->
variables
[
i
],
fdexNameEnsure
,
&
id
);
...
...
@@ -2618,7 +2589,7 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, sc
if
(
FAILED
(
hres
))
return
hres
;
hres
=
enter_bytecode
(
ctx
->
script
,
func
,
&
val
);
hres
=
enter_bytecode
(
ctx
,
func
,
&
val
);
if
(
FAILED
(
hres
))
return
hres
;
...
...
dlls/jscript/engine.h
View file @
32d9c598
...
...
@@ -208,21 +208,7 @@ typedef struct _call_frame_t {
function_code_t
*
function
;
struct
_call_frame_t
*
prev_frame
;
exec_ctx_t
*
exec_ctx
;
}
call_frame_t
;
struct
_exec_ctx_t
{
LONG
ref
;
script_ctx_t
*
script
;
};
static
inline
void
exec_addref
(
exec_ctx_t
*
ctx
)
{
ctx
->
ref
++
;
}
void
exec_release
(
exec_ctx_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
create_exec_ctx
(
script_ctx_t
*
,
exec_ctx_t
**
)
DECLSPEC_HIDDEN
;
HRESULT
exec_source
(
exec_ctx_t
*
,
bytecode_t
*
,
function_code_t
*
,
scope_chain_t
*
,
IDispatch
*
,
BOOL
,
jsdisp_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
exec_source
(
script_ctx_t
*
,
bytecode_t
*
,
function_code_t
*
,
scope_chain_t
*
,
IDispatch
*
,
BOOL
,
jsdisp_t
*
,
jsval_t
*
)
DECLSPEC_HIDDEN
;
HRESULT
create_source_function
(
script_ctx_t
*
,
bytecode_t
*
,
function_code_t
*
,
scope_chain_t
*
,
jsdisp_t
**
)
DECLSPEC_HIDDEN
;
dlls/jscript/function.c
View file @
32d9c598
...
...
@@ -206,7 +206,6 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis
jsval_t
*
r
)
{
jsdisp_t
*
var_disp
,
*
arg_disp
;
exec_ctx_t
*
exec_ctx
;
scope_chain_t
*
scope
;
HRESULT
hres
;
...
...
@@ -239,17 +238,12 @@ static HRESULT invoke_source(script_ctx_t *ctx, FunctionInstance *function, IDis
hres
=
scope_push
(
function
->
scope_chain
,
var_disp
,
to_disp
(
var_disp
),
&
scope
);
if
(
SUCCEEDED
(
hres
))
{
hres
=
create_exec_ctx
(
ctx
,
&
exec_ctx
);
if
(
SUCCEEDED
(
hres
))
{
jsdisp_t
*
prev_args
;
jsdisp_t
*
prev_args
;
prev_args
=
function
->
arguments
;
function
->
arguments
=
arg_disp
;
hres
=
exec_source
(
exec_ctx
,
function
->
code
,
function
->
func_code
,
scope
,
this_obj
,
FALSE
,
var_disp
,
r
);
function
->
arguments
=
prev_args
;
exec_release
(
exec_ctx
);
}
prev_args
=
function
->
arguments
;
function
->
arguments
=
arg_disp
;
hres
=
exec_source
(
ctx
,
function
->
code
,
function
->
func_code
,
scope
,
this_obj
,
FALSE
,
var_disp
,
r
);
function
->
arguments
=
prev_args
;
scope_release
(
scope
);
}
...
...
dlls/jscript/global.c
View file @
32d9c598
...
...
@@ -223,7 +223,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
->
call_ctx
->
exec_ctx
,
code
,
&
code
->
global_code
,
frame
->
scope
,
hres
=
exec_source
(
ctx
,
code
,
&
code
->
global_code
,
frame
->
scope
,
frame
->
this_obj
,
frame
->
is_global
,
frame
->
variable_obj
,
r
);
release_bytecode
(
code
);
return
hres
;
...
...
dlls/jscript/jscript.c
View file @
32d9c598
...
...
@@ -102,18 +102,12 @@ static inline BOOL is_started(script_ctx_t *ctx)
static
HRESULT
exec_global_code
(
JScript
*
This
,
bytecode_t
*
code
)
{
exec_ctx_t
*
exec_ctx
;
HRESULT
hres
;
hres
=
create_exec_ctx
(
This
->
ctx
,
&
exec_ctx
);
if
(
FAILED
(
hres
))
return
hres
;
IActiveScriptSite_OnEnterScript
(
This
->
site
);
clear_ei
(
This
->
ctx
);
hres
=
exec_source
(
exec_ctx
,
code
,
&
code
->
global_code
,
NULL
,
NULL
,
TRUE
,
This
->
ctx
->
global
,
NULL
);
exec_release
(
exec_ctx
);
hres
=
exec_source
(
This
->
ctx
,
code
,
&
code
->
global_code
,
NULL
,
NULL
,
TRUE
,
This
->
ctx
->
global
,
NULL
);
IActiveScriptSite_OnLeaveScript
(
This
->
site
);
return
hres
;
...
...
@@ -774,26 +768,19 @@ static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
return
hres
;
if
(
dwFlags
&
SCRIPTTEXT_ISEXPRESSION
)
{
exec_ctx_t
*
exec_ctx
;
hres
=
create_exec_ctx
(
This
->
ctx
,
&
exec_ctx
);
if
(
SUCCEEDED
(
hres
))
{
jsval_t
r
;
IActiveScriptSite_OnEnterScript
(
This
->
site
);
jsval_t
r
;
clear_ei
(
This
->
ctx
);
hres
=
exec_source
(
exec_ctx
,
code
,
&
code
->
global_code
,
NULL
,
NULL
,
TRUE
,
This
->
ctx
->
global
,
&
r
);
if
(
SUCCEEDED
(
hres
))
{
if
(
pvarResult
)
hres
=
jsval_to_variant
(
r
,
pvarResult
);
jsval_release
(
r
);
}
exec_release
(
exec_ctx
);
IActiveScriptSite_OnEnterScript
(
This
->
site
);
IActiveScriptSite_OnLeaveScript
(
This
->
site
);
clear_ei
(
This
->
ctx
);
hres
=
exec_source
(
This
->
ctx
,
code
,
&
code
->
global_code
,
NULL
,
NULL
,
TRUE
,
This
->
ctx
->
global
,
&
r
);
if
(
SUCCEEDED
(
hres
))
{
if
(
pvarResult
)
hres
=
jsval_to_variant
(
r
,
pvarResult
);
jsval_release
(
r
);
}
IActiveScriptSite_OnLeaveScript
(
This
->
site
);
return
hres
;
}
...
...
dlls/jscript/jscript.h
View file @
32d9c598
...
...
@@ -36,7 +36,6 @@
typedef
struct
_jsval_t
jsval_t
;
typedef
struct
_jsstr_t
jsstr_t
;
typedef
struct
_script_ctx_t
script_ctx_t
;
typedef
struct
_exec_ctx_t
exec_ctx_t
;
typedef
struct
_dispex_prop_t
dispex_prop_t
;
typedef
struct
{
...
...
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