diff options
Diffstat (limited to 'JavaScriptCore/runtime/JSActivation.cpp')
-rw-r--r-- | JavaScriptCore/runtime/JSActivation.cpp | 34 |
1 files changed, 13 insertions, 21 deletions
diff --git a/JavaScriptCore/runtime/JSActivation.cpp b/JavaScriptCore/runtime/JSActivation.cpp index f468ff1..fd415ce 100644 --- a/JavaScriptCore/runtime/JSActivation.cpp +++ b/JavaScriptCore/runtime/JSActivation.cpp @@ -70,6 +70,11 @@ void JSActivation::markChildren(MarkStack& markStack) bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) { + if (propertyName == exec->propertyNames().arguments) { + slot.setCustom(this, getArgumentsGetter()); + return true; + } + if (symbolTableGet(propertyName, slot)) return true; @@ -78,12 +83,6 @@ bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propert return true; } - // Only return the built-in arguments object if it wasn't overridden above. - if (propertyName == exec->propertyNames().arguments) { - slot.setCustom(this, getArgumentsGetter()); - return true; - } - // We don't call through to JSObject because there's no way to give an // activation object getter properties or a prototype. ASSERT(!hasGetterSetterProperties()); @@ -140,26 +139,19 @@ bool JSActivation::isDynamicScope(bool& requiresDynamicChecks) const return false; } -JSValue JSActivation::argumentsGetter(ExecState* exec, JSValue slotBase, const Identifier&) +JSValue JSActivation::argumentsGetter(ExecState*, JSValue slotBase, const Identifier&) { JSActivation* activation = asActivation(slotBase); - - if (activation->d()->functionExecutable->usesArguments()) { - PropertySlot slot; - activation->symbolTableGet(exec->propertyNames().arguments, slot); - return slot.getValue(exec, exec->propertyNames().arguments); - } - CallFrame* callFrame = CallFrame::create(activation->d()->registers); - Arguments* arguments = callFrame->optionalCalleeArguments(); - if (!arguments) { - arguments = new (callFrame) Arguments(callFrame); - arguments->copyRegisters(); - callFrame->setCalleeArguments(arguments); + int argumentsRegister = activation->d()->functionExecutable->generatedByteCode().argumentsRegister(); + if (!callFrame->r(argumentsRegister).jsValue()) { + JSValue arguments = JSValue(new (callFrame) Arguments(callFrame)); + callFrame->r(argumentsRegister) = arguments; + callFrame->r(unmodifiedArgumentsRegister(argumentsRegister)) = arguments; } - ASSERT(arguments->inherits(&Arguments::info)); - return arguments; + ASSERT(callFrame->r(argumentsRegister).jsValue().inherits(&Arguments::info)); + return callFrame->r(argumentsRegister).jsValue(); } // These two functions serve the purpose of isolating the common case from a |