Jacek Caban : jscript: Store is_global flag in call_frame_t.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Mar 28 09:12:35 CDT 2016
Module: wine
Branch: master
Commit: 00ce4419b4151297559720911d3095bac1757487
URL: http://source.winehq.org/git/wine.git/?a=commit;h=00ce4419b4151297559720911d3095bac1757487
Author: Jacek Caban <jacek at codeweavers.com>
Date: Fri Mar 25 17:50:06 2016 +0100
jscript: Store is_global flag in call_frame_t.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/jscript/engine.c | 12 ++++++------
dlls/jscript/engine.h | 6 +++---
dlls/jscript/function.c | 4 ++--
dlls/jscript/global.c | 2 +-
dlls/jscript/jscript.c | 8 ++++----
5 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 0a46b58..27c8ad7 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -295,7 +295,7 @@ void scope_release(scope_chain_t *scope)
heap_free(scope);
}
-HRESULT create_exec_ctx(script_ctx_t *script_ctx, BOOL is_global, exec_ctx_t **ret)
+HRESULT create_exec_ctx(script_ctx_t *script_ctx, exec_ctx_t **ret)
{
exec_ctx_t *ctx;
@@ -304,7 +304,6 @@ HRESULT create_exec_ctx(script_ctx_t *script_ctx, BOOL is_global, exec_ctx_t **r
return E_OUTOFMEMORY;
ctx->ref = 1;
- ctx->is_global = is_global;
script_addref(script_ctx);
ctx->script = script_ctx;
@@ -2532,7 +2531,7 @@ static HRESULT bind_event_target(script_ctx_t *ctx, function_code_t *func, jsdis
}
static HRESULT setup_call_frame(exec_ctx_t *ctx, bytecode_t *bytecode, function_code_t *function, scope_chain_t *scope,
- IDispatch *this_obj, jsdisp_t *variable_obj)
+ IDispatch *this_obj, BOOL is_global, jsdisp_t *variable_obj)
{
call_frame_t *frame;
@@ -2569,6 +2568,7 @@ static HRESULT setup_call_frame(exec_ctx_t *ctx, bytecode_t *bytecode, function_
frame->this_obj = to_disp(ctx->script->global);
IDispatch_AddRef(frame->this_obj);
+ frame->is_global = is_global;
frame->variable_obj = jsdisp_addref(variable_obj);
frame->exec_ctx = ctx;
@@ -2579,7 +2579,7 @@ static HRESULT setup_call_frame(exec_ctx_t *ctx, bytecode_t *bytecode, function_
}
HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, scope_chain_t *scope,
- IDispatch *this_obj, jsdisp_t *variable_obj, jsval_t *ret)
+ IDispatch *this_obj, BOOL is_global, jsdisp_t *variable_obj, jsval_t *ret)
{
jsval_t val;
unsigned i;
@@ -2605,7 +2605,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(!ctx->is_global || !lookup_global_members(ctx->script, func->variables[i], NULL)) {
+ if(!is_global || !lookup_global_members(ctx->script, func->variables[i], NULL)) {
DISPID id = 0;
hres = jsdisp_get_id(variable_obj, func->variables[i], fdexNameEnsure, &id);
@@ -2614,7 +2614,7 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, sc
}
}
- hres = setup_call_frame(ctx, code, func, scope, this_obj, variable_obj);
+ hres = setup_call_frame(ctx, code, func, scope, this_obj, is_global, variable_obj);
if(FAILED(hres))
return hres;
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index 8b54bd2..b7bb1d2 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -202,6 +202,7 @@ typedef struct _call_frame_t {
IDispatch *this_obj;
jsdisp_t *variable_obj;
+ BOOL is_global;
bytecode_t *bytecode;
function_code_t *function;
@@ -214,7 +215,6 @@ struct _exec_ctx_t {
LONG ref;
script_ctx_t *script;
- BOOL is_global;
};
static inline void exec_addref(exec_ctx_t *ctx)
@@ -223,6 +223,6 @@ static inline void exec_addref(exec_ctx_t *ctx)
}
void exec_release(exec_ctx_t*) DECLSPEC_HIDDEN;
-HRESULT create_exec_ctx(script_ctx_t*,BOOL,exec_ctx_t**) DECLSPEC_HIDDEN;
-HRESULT exec_source(exec_ctx_t*,bytecode_t*,function_code_t*,scope_chain_t*,IDispatch*,jsdisp_t*,jsval_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 create_source_function(script_ctx_t*,bytecode_t*,function_code_t*,scope_chain_t*,jsdisp_t**) DECLSPEC_HIDDEN;
diff --git a/dlls/jscript/function.c b/dlls/jscript/function.c
index 8cd363d..84ef469 100644
--- a/dlls/jscript/function.c
+++ b/dlls/jscript/function.c
@@ -239,13 +239,13 @@ 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, FALSE, &exec_ctx);
+ hres = create_exec_ctx(ctx, &exec_ctx);
if(SUCCEEDED(hres)) {
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, var_disp, r);
+ 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);
diff --git a/dlls/jscript/global.c b/dlls/jscript/global.c
index 73bee82..3249a02 100644
--- a/dlls/jscript/global.c
+++ b/dlls/jscript/global.c
@@ -224,7 +224,7 @@ static HRESULT JSGlobal_eval(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, uns
}
hres = exec_source(ctx->call_ctx->exec_ctx, code, &code->global_code, frame->scope,
- frame->this_obj, frame->variable_obj, r);
+ frame->this_obj, frame->is_global, frame->variable_obj, r);
release_bytecode(code);
return hres;
}
diff --git a/dlls/jscript/jscript.c b/dlls/jscript/jscript.c
index 88c1616..2a85dd4 100644
--- a/dlls/jscript/jscript.c
+++ b/dlls/jscript/jscript.c
@@ -105,14 +105,14 @@ static HRESULT exec_global_code(JScript *This, bytecode_t *code)
exec_ctx_t *exec_ctx;
HRESULT hres;
- hres = create_exec_ctx(This->ctx, TRUE, &exec_ctx);
+ 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, This->ctx->global, NULL);
+ hres = exec_source(exec_ctx, code, &code->global_code, NULL, NULL, TRUE, This->ctx->global, NULL);
exec_release(exec_ctx);
IActiveScriptSite_OnLeaveScript(This->site);
@@ -776,14 +776,14 @@ static HRESULT WINAPI JScriptParse_ParseScriptText(IActiveScriptParse *iface,
if(dwFlags & SCRIPTTEXT_ISEXPRESSION) {
exec_ctx_t *exec_ctx;
- hres = create_exec_ctx(This->ctx, TRUE, &exec_ctx);
+ hres = create_exec_ctx(This->ctx, &exec_ctx);
if(SUCCEEDED(hres)) {
jsval_t r;
IActiveScriptSite_OnEnterScript(This->site);
clear_ei(This->ctx);
- hres = exec_source(exec_ctx, code, &code->global_code, NULL, NULL, This->ctx->global, &r);
+ 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);
More information about the wine-cvs
mailing list