From 9fa78177eb5f31e6941b165949957f2b92b8dd0a Mon Sep 17 00:00:00 2001 From: Kent Hansen Date: Wed, 8 Jul 2009 17:49:17 +0200 Subject: try to get arguments object to work for host call frames --- .../webkit/JavaScriptCore/runtime/Arguments.h | 31 ++++++++++++++-------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h b/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h index fffdd78..41adba5 100644 --- a/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h +++ b/src/3rdparty/webkit/JavaScriptCore/runtime/Arguments.h @@ -45,7 +45,7 @@ namespace JSC { OwnArrayPtr deletedArguments; Register extraArgumentsFixedBuffer[4]; - JSFunction* callee; + InternalFunction* callee; bool overrodeLength : 1; bool overrodeCallee : 1; }; @@ -87,7 +87,7 @@ namespace JSC { } private: - void getArgumentsData(CallFrame*, JSFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc); + void getArgumentsData(CallFrame*, InternalFunction*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc); virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); @@ -110,12 +110,17 @@ namespace JSC { return static_cast(asObject(value)); } - ALWAYS_INLINE void Arguments::getArgumentsData(CallFrame* callFrame, JSFunction*& function, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc) + ALWAYS_INLINE void Arguments::getArgumentsData(CallFrame* callFrame, InternalFunction*& function, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc) { - function = asFunction(callFrame->callee()); - - CodeBlock* codeBlock = &function->body()->generatedBytecode(); - int numParameters = codeBlock->m_numParameters; + function = callFrame->callee(); + + int numParameters; + if (function->isObject(&JSFunction::info)) { + CodeBlock* codeBlock = &JSC::asFunction(function)->body()->generatedBytecode(); + numParameters = codeBlock->m_numParameters; + } else { + numParameters = 0; + } argc = callFrame->argumentCount(); if (argc <= numParameters) @@ -131,13 +136,16 @@ namespace JSC { : JSObject(callFrame->lexicalGlobalObject()->argumentsStructure()) , d(new ArgumentsData) { - JSFunction* callee; + InternalFunction* callee; ptrdiff_t firstParameterIndex; Register* argv; int numArguments; getArgumentsData(callFrame, callee, firstParameterIndex, argv, numArguments); - d->numParameters = callee->body()->parameterCount(); + if (callee->isObject(&JSFunction::info)) + d->numParameters = JSC::asFunction(callee)->body()->parameterCount(); + else + d->numParameters = 0; d->firstParameterIndex = firstParameterIndex; d->numArguments = numArguments; @@ -168,7 +176,8 @@ namespace JSC { : JSObject(callFrame->lexicalGlobalObject()->argumentsStructure()) , d(new ArgumentsData) { - ASSERT(!asFunction(callFrame->callee())->body()->parameterCount()); + if (callFrame->callee() && callFrame->callee()->isObject(&JSC::JSFunction::info)) + ASSERT(!asFunction(callFrame->callee())->body()->parameterCount()); unsigned numArguments = callFrame->argumentCount() - 1; @@ -188,7 +197,7 @@ namespace JSC { d->extraArguments = extraArguments; - d->callee = asFunction(callFrame->callee()); + d->callee = callFrame->callee(); d->overrodeLength = false; d->overrodeCallee = false; } -- cgit v0.12