Jacek Caban : jscript: Store stack base in call_frame_t.

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


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

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

jscript: Store stack base 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 | 17 +++++++++--------
 dlls/jscript/engine.h |  1 +
 2 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index f622233..db6c2ae 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -2471,7 +2471,6 @@ static HRESULT unwind_exception(exec_ctx_t *ctx)
 static HRESULT enter_bytecode(script_ctx_t *ctx, function_code_t *func, jsval_t *ret)
 {
     exec_ctx_t *exec_ctx = ctx->call_ctx->exec_ctx;
-    unsigned prev_top;
     scope_chain_t *prev_scope;
     call_frame_t *frame;
     jsop_t op;
@@ -2480,7 +2479,6 @@ static HRESULT enter_bytecode(script_ctx_t *ctx, function_code_t *func, jsval_t
     TRACE("\n");
 
     frame = ctx->call_ctx;
-    prev_top = exec_ctx->top;
     prev_scope = exec_ctx->scope_chain;
 
     while(frame->ip != -1) {
@@ -2501,19 +2499,21 @@ static HRESULT enter_bytecode(script_ctx_t *ctx, function_code_t *func, jsval_t
     }
 
     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);
-        stack_popn(exec_ctx, exec_ctx->top-prev_top);
-        return hres;
+        stack_popn(exec_ctx, exec_ctx->top-frame->stack_base);
     }
 
-    assert(exec_ctx->top == prev_top+1 || exec_ctx->top == prev_top);
+    assert(exec_ctx->top == frame->stack_base);
+    ctx->call_ctx = frame->prev_frame;
+    release_call_frame(frame);
+
+    if(FAILED(hres))
+        return hres;
+
     assert(exec_ctx->scope_chain == prev_scope);
-    assert(exec_ctx->top == prev_top);
 
     *ret = exec_ctx->ret;
     exec_ctx->ret = jsval_undefined();
@@ -2568,6 +2568,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->top;
 
     frame->exec_ctx = ctx;
 
diff --git a/dlls/jscript/engine.h b/dlls/jscript/engine.h
index ddbea50..e803047 100644
--- a/dlls/jscript/engine.h
+++ b/dlls/jscript/engine.h
@@ -193,6 +193,7 @@ struct _parser_ctx_t;
 typedef struct _call_frame_t {
     unsigned ip;
     except_frame_t *except_frame;
+    unsigned stack_base;
 
     bytecode_t *bytecode;
     function_code_t *function;




More information about the wine-cvs mailing list