]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - interpreter/CallFrameClosure.h
JavaScriptCore-1218.tar.gz
[apple/javascriptcore.git] / interpreter / CallFrameClosure.h
index 2a841511a9d40f7a7d422f2f22685efbf1003606..7ae1e6fdf6f9cb6a16706beeb3c5b88482acadf2 100644 (file)
@@ -33,9 +33,8 @@ struct CallFrameClosure {
     CallFrame* newCallFrame;
     JSFunction* function;
     FunctionExecutable* functionExecutable;
-    JSGlobalData* globalData;
-    Register* oldEnd;
-    ScopeChainNode* scopeChain;
+    VM* vm;
+    JSScope* scope;
     int parameterCountIncludingThis;
     int argumentCountIncludingThis;
     
@@ -51,8 +50,12 @@ struct CallFrameClosure {
 
     void resetCallFrame()
     {
-        newCallFrame->setScopeChain(scopeChain);
-        for (int i = argumentCountIncludingThis; i < parameterCountIncludingThis; ++i)
+        newCallFrame->setScope(scope);
+        // setArgument() takes an arg index that starts from 0 for the first
+        // argument after the 'this' value. Since both argumentCountIncludingThis
+        // and parameterCountIncludingThis includes the 'this' value, we need to
+        // subtract 1 from them to make i a valid argument index for setArgument().
+        for (int i = argumentCountIncludingThis-1; i < parameterCountIncludingThis-1; ++i)
             newCallFrame->setArgument(i, jsUndefined());
     }
 };