CallFrame* newCallFrame;
JSFunction* function;
FunctionExecutable* functionExecutable;
- JSGlobalData* globalData;
- Register* oldEnd;
- ScopeChainNode* scopeChain;
- int expectedParams;
- int providedParams;
+ VM* vm;
+ JSScope* scope;
+ int parameterCountIncludingThis;
+ int argumentCountIncludingThis;
- void setArgument(int arg, JSValue value)
+ void setThis(JSValue value)
{
- if (arg < expectedParams)
- newCallFrame[arg - RegisterFile::CallFrameHeaderSize - expectedParams] = value;
- else
- newCallFrame[arg - RegisterFile::CallFrameHeaderSize - expectedParams - providedParams] = value;
+ newCallFrame->setThisValue(value);
+ }
+
+ void setArgument(int argument, JSValue value)
+ {
+ newCallFrame->setArgument(argument, value);
}
void resetCallFrame()
{
- newCallFrame->setScopeChain(scopeChain);
- for (int i = providedParams; i < expectedParams; ++i)
- newCallFrame[i - RegisterFile::CallFrameHeaderSize - expectedParams] = jsUndefined();
+ 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());
}
};