EncodedJSValue doCallToJavaScript(void* executableAddress, ProtoCallFrame* protoCallFrame) { CodeBlock* codeBlock = protoCallFrame->codeBlock(); JSScope* scope = protoCallFrame->scope(); JSObject* callee = protoCallFrame->callee(); int argCountIncludingThis = protoCallFrame->argumentCountIncludingThis(); int argCount = protoCallFrame->argumentCount(); JSValue thisValue = protoCallFrame->thisValue(); JSStack& stack = scope->vm()->interpreter->stack(); CallFrame* newCallFrame = stack.pushFrame(codeBlock, scope, argCountIncludingThis, callee); if (UNLIKELY(!newCallFrame)) { JSGlobalObject* globalObject = scope->globalObject(); ExecState* exec = globalObject->globalExec(); return JSValue::encode(throwStackOverflowError(exec)); } // Set the arguments for the callee: newCallFrame->setThisValue(thisValue); for (int i = 0; i < argCount; ++i) newCallFrame->setArgument(i, protoCallFrame->argument(i)); JSValue result = execute(newCallFrame, executableAddress); stack.popFrame(newCallFrame); return JSValue::encode(result); }