X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/9dae56ea45a0f5f8136a5c93d6f3a7f99399ca73..4e4e5a6f2694187498445a6ac6f1634ce8141119:/runtime/JSActivation.cpp diff --git a/runtime/JSActivation.cpp b/runtime/JSActivation.cpp index a2d2634..f468ff1 100644 --- a/runtime/JSActivation.cpp +++ b/runtime/JSActivation.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2008 Apple Inc. All rights reserved. + * Copyright (C) 2008, 2009 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -39,8 +39,8 @@ ASSERT_CLASS_FITS_IN_CELL(JSActivation); const ClassInfo JSActivation::info = { "JSActivation", 0, 0, 0 }; -JSActivation::JSActivation(CallFrame* callFrame, PassRefPtr functionBody) - : Base(callFrame->globalData().activationStructure, new JSActivationData(functionBody, callFrame)) +JSActivation::JSActivation(CallFrame* callFrame, NonNullPassRefPtr functionExecutable) + : Base(callFrame->globalData().activationStructure, new JSActivationData(functionExecutable, callFrame->registers())) { } @@ -49,35 +49,23 @@ JSActivation::~JSActivation() delete d(); } -void JSActivation::mark() +void JSActivation::markChildren(MarkStack& markStack) { - Base::mark(); + Base::markChildren(markStack); Register* registerArray = d()->registerArray.get(); if (!registerArray) return; - size_t numParametersMinusThis = d()->functionBody->generatedBytecode().m_numParameters - 1; + size_t numParametersMinusThis = d()->functionExecutable->parameterCount(); - size_t i = 0; - size_t count = numParametersMinusThis; - for ( ; i < count; ++i) { - Register& r = registerArray[i]; - if (!r.marked()) - r.mark(); - } + size_t count = numParametersMinusThis; + markStack.appendValues(registerArray, count); - size_t numVars = d()->functionBody->generatedBytecode().m_numVars; + size_t numVars = d()->functionExecutable->variableCount(); // Skip the call frame, which sits between the parameters and vars. - i += RegisterFile::CallFrameHeaderSize; - count += RegisterFile::CallFrameHeaderSize + numVars; - - for ( ; i < count; ++i) { - Register& r = registerArray[i]; - if (!r.marked()) - r.mark(); - } + markStack.appendValues(registerArray + count + RegisterFile::CallFrameHeaderSize, numVars, MayContainNullValues); } bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) @@ -85,7 +73,7 @@ bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propert if (symbolTableGet(propertyName, slot)) return true; - if (JSValuePtr* location = getDirectLocation(propertyName)) { + if (JSValue* location = getDirectLocation(propertyName)) { slot.setValueSlot(location); return true; } @@ -103,7 +91,7 @@ bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propert return false; } -void JSActivation::put(ExecState*, const Identifier& propertyName, JSValuePtr value, PutPropertySlot& slot) +void JSActivation::put(ExecState*, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) { ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); @@ -118,7 +106,7 @@ void JSActivation::put(ExecState*, const Identifier& propertyName, JSValuePtr va } // FIXME: Make this function honor ReadOnly (const) and DontEnum -void JSActivation::putWithAttributes(ExecState*, const Identifier& propertyName, JSValuePtr value, unsigned attributes) +void JSActivation::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) { ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); @@ -130,7 +118,7 @@ void JSActivation::putWithAttributes(ExecState*, const Identifier& propertyName, // expose in the activation object. ASSERT(!hasGetterSetterProperties()); PutPropertySlot slot; - putDirect(propertyName, value, attributes, true, slot); + JSObject::putWithAttributes(exec, propertyName, value, attributes, true, slot); } bool JSActivation::deleteProperty(ExecState* exec, const Identifier& propertyName) @@ -146,16 +134,17 @@ JSObject* JSActivation::toThisObject(ExecState* exec) const return exec->globalThisValue(); } -bool JSActivation::isDynamicScope() const +bool JSActivation::isDynamicScope(bool& requiresDynamicChecks) const { - return d()->functionBody->usesEval(); + requiresDynamicChecks = d()->functionExecutable->usesEval(); + return false; } -JSValuePtr JSActivation::argumentsGetter(ExecState* exec, const Identifier&, const PropertySlot& slot) +JSValue JSActivation::argumentsGetter(ExecState* exec, JSValue slotBase, const Identifier&) { - JSActivation* activation = asActivation(slot.slotBase()); + JSActivation* activation = asActivation(slotBase); - if (activation->d()->functionBody->usesArguments()) { + if (activation->d()->functionExecutable->usesArguments()) { PropertySlot slot; activation->symbolTableGet(exec->propertyNames().arguments, slot); return slot.getValue(exec, exec->propertyNames().arguments); @@ -168,7 +157,7 @@ JSValuePtr JSActivation::argumentsGetter(ExecState* exec, const Identifier&, con arguments->copyRegisters(); callFrame->setCalleeArguments(arguments); } - ASSERT(arguments->isObject(&Arguments::info)); + ASSERT(arguments->inherits(&Arguments::info)); return arguments; }