Jacek Caban : jscript: Don' t create arguments object in pop_call_frame if it wasn't already created.

Alexandre Julliard julliard at winehq.org
Fri Aug 5 16:20:08 CDT 2016


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Aug  5 17:15:13 2016 +0200

jscript: Don't create arguments object in pop_call_frame if it wasn't already created.

Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/jscript/engine.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/dlls/jscript/engine.c b/dlls/jscript/engine.c
index 871017c..f958204 100644
--- a/dlls/jscript/engine.c
+++ b/dlls/jscript/engine.c
@@ -562,7 +562,7 @@ static HRESULT equal2_values(jsval_t lval, jsval_t rval, BOOL *ret)
  * Transfers local variables from stack to variable object.
  * It's slow, so we want to avoid it as much as possible.
  */
-static HRESULT detach_variable_object(script_ctx_t *ctx, call_frame_t *frame)
+static HRESULT detach_variable_object(script_ctx_t *ctx, call_frame_t *frame, BOOL from_release)
 {
     unsigned i;
     HRESULT hres;
@@ -575,7 +575,7 @@ static HRESULT detach_variable_object(script_ctx_t *ctx, call_frame_t *frame)
     assert(frame == frame->base_scope->frame);
     assert(frame->variable_obj == frame->base_scope->jsobj);
 
-    if(!frame->arguments_obj) {
+    if(!from_release && !frame->arguments_obj) {
         hres = setup_arguments_object(ctx, frame);
         if(FAILED(hres))
             return hres;
@@ -648,7 +648,7 @@ static HRESULT identifier_eval(script_ctx_t *ctx, BSTR identifier, exprval_t *re
                 }
 
                 if(!strcmpW(identifier, argumentsW)) {
-                    hres = detach_variable_object(ctx, scope->frame);
+                    hres = detach_variable_object(ctx, scope->frame, FALSE);
                     if(FAILED(hres))
                         return hres;
                 }
@@ -2605,7 +2605,7 @@ static void pop_call_frame(script_ctx_t *ctx)
 
     /* If current scope will be kept alive, we need to transfer local variables to its variable object. */
     if(frame->scope && frame->scope->ref > 1) {
-        HRESULT hres = detach_variable_object(ctx, frame);
+        HRESULT hres = detach_variable_object(ctx, frame, TRUE);
         if(FAILED(hres))
             ERR("Failed to detach variable object: %08x\n", hres);
     }
@@ -2910,7 +2910,7 @@ HRESULT exec_source(script_ctx_t *ctx, DWORD flags, bytecode_t *bytecode, functi
     }
 
     if(ctx->call_ctx && (flags & EXEC_EVAL)) {
-        hres = detach_variable_object(ctx, ctx->call_ctx);
+        hres = detach_variable_object(ctx, ctx->call_ctx, FALSE);
         if(FAILED(hres))
             return hres;
     }




More information about the wine-cvs mailing list