Jacek Caban : jscript: Merge setup_call_frame into exec_source.
Alexandre Julliard
julliard at wine.codeweavers.com
Tue Mar 29 08:53:21 CDT 2016
Module: wine
Branch: master
Commit: db0fee5e9d3f8e1c3a9dbd7c98f3c952281ece39
URL: http://source.winehq.org/git/wine.git/?a=commit;h=db0fee5e9d3f8e1c3a9dbd7c98f3c952281ece39
Author: Jacek Caban <jacek at codeweavers.com>
Date: Mon Mar 28 17:50:08 2016 +0200
jscript: Merge setup_call_frame into exec_source.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/jscript/engine.c | 82 ++++++++++++++++++++++-----------------------------
1 file changed, 36 insertions(+), 46 deletions(-)
diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 4d7c175..802e408 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -2443,7 +2443,7 @@ static HRESULT unwind_exception(script_ctx_t *ctx)
return hres;
}
-static HRESULT enter_bytecode(script_ctx_t *ctx, function_code_t *func, jsval_t *ret)
+static HRESULT enter_bytecode(script_ctx_t *ctx, jsval_t *ret)
{
call_frame_t *frame;
jsop_t op;
@@ -2526,10 +2526,42 @@ static HRESULT bind_event_target(script_ctx_t *ctx, function_code_t *func, jsdis
return hres;
}
-static HRESULT setup_call_frame(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, function_code_t *function, scope_chain_t *scope,
- IDispatch *this_obj, jsdisp_t *variable_obj)
+HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, function_code_t *function, scope_chain_t *scope,
+ IDispatch *this_obj, jsdisp_t *variable_obj, jsval_t *ret)
{
call_frame_t *frame;
+ jsval_t val;
+ unsigned i;
+ HRESULT hres;
+
+ for(i = 0; i < function->func_cnt; i++) {
+ jsdisp_t *func_obj;
+
+ if(!function->funcs[i].name)
+ continue;
+
+ hres = create_source_function(ctx, bytecode, function->funcs+i, scope, &func_obj);
+ if(FAILED(hres))
+ return hres;
+
+ if(function->funcs[i].event_target)
+ hres = bind_event_target(ctx, function->funcs+i, func_obj);
+ else
+ hres = jsdisp_propput_name(variable_obj, function->funcs[i].name, jsval_obj(func_obj));
+ jsdisp_release(func_obj);
+ if(FAILED(hres))
+ return hres;
+ }
+
+ for(i=0; i < function->var_cnt; i++) {
+ if(!(flags & EXEC_GLOBAL) || !lookup_global_members(ctx, function->variables[i], NULL)) {
+ DISPID id = 0;
+
+ hres = jsdisp_get_id(variable_obj, function->variables[i], fdexNameEnsure, &id);
+ if(FAILED(hres))
+ return hres;
+ }
+ }
/* ECMA-262 3rd Edition 11.2.3.7 */
if(this_obj) {
@@ -2569,50 +2601,8 @@ static HRESULT setup_call_frame(script_ctx_t *ctx, DWORD flags, bytecode_t *byte
frame->prev_frame = ctx->call_ctx;
ctx->call_ctx = frame;
- return S_OK;
-}
-
-HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *code, function_code_t *func, scope_chain_t *scope,
- IDispatch *this_obj, jsdisp_t *variable_obj, jsval_t *ret)
-{
- jsval_t val;
- unsigned i;
- HRESULT hres = S_OK;
-
- for(i = 0; i < func->func_cnt; i++) {
- jsdisp_t *func_obj;
-
- if(!func->funcs[i].name)
- continue;
-
- 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, func->funcs+i, func_obj);
- else
- hres = jsdisp_propput_name(variable_obj, func->funcs[i].name, jsval_obj(func_obj));
- jsdisp_release(func_obj);
- if(FAILED(hres))
- return hres;
- }
-
- for(i=0; i < func->var_cnt; i++) {
- if(!(flags & EXEC_GLOBAL) || !lookup_global_members(ctx, func->variables[i], NULL)) {
- DISPID id = 0;
-
- hres = jsdisp_get_id(variable_obj, func->variables[i], fdexNameEnsure, &id);
- if(FAILED(hres))
- return hres;
- }
- }
-
- hres = setup_call_frame(ctx, flags, code, func, scope, this_obj, variable_obj);
- if(FAILED(hres))
- return hres;
- hres = enter_bytecode(ctx, func, &val);
+ hres = enter_bytecode(ctx, &val);
if(FAILED(hres))
return hres;
More information about the wine-cvs
mailing list