diff options
Diffstat (limited to 'src/3rdparty/javascriptcore/JavaScriptCore/runtime/Arguments.h')
-rw-r--r-- | src/3rdparty/javascriptcore/JavaScriptCore/runtime/Arguments.h | 44 |
1 files changed, 27 insertions, 17 deletions
diff --git a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Arguments.h b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Arguments.h index dc54dacd43..2aa09213b3 100644 --- a/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Arguments.h +++ b/src/3rdparty/javascriptcore/JavaScriptCore/runtime/Arguments.h @@ -1,6 +1,6 @@ /* * Copyright (C) 1999-2000 Harri Porten (porten@kde.org) - * Copyright (C) 2003, 2006, 2007, 2008 Apple Inc. All rights reserved. + * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved. * Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca) * Copyright (C) 2007 Maks Orlovich * @@ -28,6 +28,8 @@ #include "JSFunction.h" #include "JSGlobalObject.h" #include "Interpreter.h" +#include "ObjectConstructor.h" +#include "PrototypeFunction.h" namespace JSC { @@ -61,7 +63,7 @@ namespace JSC { static const ClassInfo info; - virtual void mark(); + virtual void markChildren(MarkStack&); void fillArgList(ExecState*, MarkedArgumentBuffer&); @@ -90,6 +92,7 @@ namespace JSC { void getArgumentsData(CallFrame*, JSObject*&, ptrdiff_t& firstParameterIndex, Register*& argv, int& argc); virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&); + virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&); virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); virtual void put(ExecState*, unsigned propertyName, JSValue, PutPropertySlot&); virtual bool deleteProperty(ExecState*, const Identifier& propertyName, bool checkDontDelete = true); @@ -116,21 +119,20 @@ namespace JSC { callee = callFrame->callee(); int numParameters; - if (callee->isObject(&JSFunction::info)) { - CodeBlock* codeBlock = &JSC::asFunction(callee)->body()->generatedBytecode(); - numParameters = codeBlock->m_numParameters; - } else { + if (callee->inherits(&JSFunction::info)) + numParameters = JSC::asFunction(callee)->jsExecutable()->parameterCount(); + else numParameters = 0; - } + argc = callFrame->argumentCount(); if (argc <= numParameters) - argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters + 1; // + 1 to skip "this" + argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters; else - argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters - argc + 1; // + 1 to skip "this" + argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numParameters - argc; argc -= 1; // - 1 to skip "this" - firstParameterIndex = -RegisterFile::CallFrameHeaderSize - numParameters + 1; // + 1 to skip "this" + firstParameterIndex = -RegisterFile::CallFrameHeaderSize - numParameters; } inline Arguments::Arguments(CallFrame* callFrame) @@ -143,8 +145,8 @@ namespace JSC { int numArguments; getArgumentsData(callFrame, callee, firstParameterIndex, argv, numArguments); - if (callee->isObject(&JSFunction::info)) - d->numParameters = JSC::asFunction(callee)->body()->parameterCount(); + if (callee->inherits(&JSFunction::info)) + d->numParameters = JSC::asFunction(callee)->jsExecutable()->parameterCount(); else d->numParameters = 0; d->firstParameterIndex = firstParameterIndex; @@ -177,8 +179,8 @@ namespace JSC { : JSObject(callFrame->lexicalGlobalObject()->argumentsStructure()) , d(new ArgumentsData) { - if (callFrame->callee() && callFrame->callee()->isObject(&JSC::JSFunction::info)) - ASSERT(!asFunction(callFrame->callee())->body()->parameterCount()); + if (callFrame->callee() && callFrame->callee()->inherits(&JSC::JSFunction::info)) + ASSERT(!asFunction(callFrame->callee())->jsExecutable()->parameterCount()); unsigned numArguments = callFrame->argumentCount() - 1; @@ -193,7 +195,7 @@ namespace JSC { extraArguments = d->extraArgumentsFixedBuffer; Register* argv = callFrame->registers() - RegisterFile::CallFrameHeaderSize - numArguments - 1; - if (callFrame->callee() && !callFrame->callee()->isObject(&JSC::JSFunction::info)) + if (callFrame->callee() && !callFrame->callee()->inherits(&JSC::JSFunction::info)) ++argv; // ### off-by-one issue with native functions for (unsigned i = 0; i < numArguments; ++i) extraArguments[i] = argv[i]; @@ -226,8 +228,8 @@ namespace JSC { { ASSERT(!d()->registerArray); - size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1; - size_t numVars = d()->functionBody->generatedBytecode().m_numVars; + size_t numParametersMinusThis = d()->functionExecutable->generatedBytecode().m_numParameters - 1; + size_t numVars = d()->functionExecutable->generatedBytecode().m_numVars; size_t numLocals = numVars + numParametersMinusThis; if (!numLocals) @@ -242,6 +244,14 @@ namespace JSC { static_cast<Arguments*>(arguments)->setActivation(this); } + ALWAYS_INLINE Arguments* Register::arguments() const + { + if (jsValue() == JSValue()) + return 0; + return asArguments(jsValue()); + } + + } // namespace JSC #endif // Arguments_h |