Jacek Caban : jscript: Store function description in call_frame_t.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Mar 25 10:00:39 CDT 2016


Module: wine
Branch: master
Commit: 132ff14d3739b03549244af07d442209b4a3fc31
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=132ff14d3739b03549244af07d442209b4a3fc31

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Mar 25 12:03:11 2016 +0100

jscript: Store function description 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 |  3 +--
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 8b0477f..333df27 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -825,12 +825,13 @@ static HRESULT interp_end_finally(exec_ctx_t *ctx)
 static HRESULT interp_func(exec_ctx_t *ctx)
 {
     unsigned func_idx = get_op_uint(ctx, 0);
+    call_frame_t *frame = ctx->script->call_ctx;
     jsdisp_t *dispex;
     HRESULT hres;
 
     TRACE("%d\n", func_idx);
 
-    hres = create_source_function(ctx->script, ctx->script->call_ctx->bytecode, ctx->func_code->funcs+func_idx,
+    hres = create_source_function(ctx->script, frame->bytecode, frame->function->funcs+func_idx,
             ctx->scope_chain, &dispex);
     if(FAILED(hres))
         return hres;
@@ -2453,7 +2454,6 @@ static HRESULT enter_bytecode(script_ctx_t *ctx, function_code_t *func, jsval_t
 {
     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;
     call_frame_t *frame;
@@ -2467,10 +2467,8 @@ static HRESULT enter_bytecode(script_ctx_t *ctx, function_code_t *func, jsval_t
     prev_scope = exec_ctx->scope_chain;
     prev_except_frame = exec_ctx->except_frame;
     prev_ip = exec_ctx->ip;
-    prev_func = exec_ctx->func_code;
     exec_ctx->ip = func->instr_off;
     exec_ctx->except_frame = NULL;
-    exec_ctx->func_code = func;
 
     while(exec_ctx->ip != -1) {
         op = frame->bytecode->instrs[exec_ctx->ip].op;
@@ -2491,7 +2489,6 @@ static HRESULT enter_bytecode(script_ctx_t *ctx, function_code_t *func, jsval_t
 
     exec_ctx->ip = prev_ip;
     exec_ctx->except_frame = prev_except_frame;
-    exec_ctx->func_code = prev_func;
 
     assert(ctx->call_ctx == frame);
     ctx->call_ctx = frame->prev_frame;
@@ -2550,7 +2547,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)
+static HRESULT setup_call_frame(exec_ctx_t *ctx, bytecode_t *bytecode, function_code_t *function)
 {
     call_frame_t *frame;
 
@@ -2559,6 +2556,7 @@ static HRESULT setup_call_frame(exec_ctx_t *ctx, bytecode_t *bytecode)
         return E_OUTOFMEMORY;
 
     frame->bytecode = bytecode;
+    frame->function = function;
     frame->exec_ctx = ctx;
 
     frame->prev_frame = ctx->script->call_ctx;
@@ -2601,7 +2599,7 @@ HRESULT exec_source(exec_ctx_t *ctx, bytecode_t *code, function_code_t *func, js
         }
     }
 
-    hres = setup_call_frame(ctx, code);
+    hres = setup_call_frame(ctx, code, func);
     if(FAILED(hres))
         return hres;
 
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index fc99c68..31b904c 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -192,6 +192,7 @@ struct _parser_ctx_t;
 
 typedef struct _call_frame_t {
     bytecode_t *bytecode;
+    function_code_t *function;
 
     struct _call_frame_t *prev_frame;
     exec_ctx_t *exec_ctx;
@@ -200,12 +201,10 @@ typedef struct _call_frame_t {
 struct _exec_ctx_t {
     LONG ref;
 
-    struct _parser_ctx_t *parser;
     script_ctx_t *script;
     scope_chain_t *scope_chain;
     jsdisp_t *var_disp;
     IDispatch *this_obj;
-    function_code_t *func_code;
     BOOL is_global;
 
     jsval_t *stack;




More information about the wine-cvs mailing list