/*
- * 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
const ClassInfo JSActivation::info = { "JSActivation", 0, 0, 0 };
-JSActivation::JSActivation(CallFrame* callFrame, PassRefPtr<FunctionBodyNode> functionBody)
- : Base(callFrame->globalData().activationStructure, new JSActivationData(functionBody, callFrame))
+JSActivation::JSActivation(CallFrame* callFrame, NonNullPassRefPtr<FunctionExecutable> functionExecutable)
+ : Base(callFrame->globalData().activationStructure, new JSActivationData(functionExecutable, callFrame->registers()))
{
}
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)
if (symbolTableGet(propertyName, slot))
return true;
- if (JSValuePtr* location = getDirectLocation(propertyName)) {
+ if (JSValue* location = getDirectLocation(propertyName)) {
slot.setValueSlot(location);
return true;
}
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));
}
// 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));
// 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)
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);
arguments->copyRegisters();
callFrame->setCalleeArguments(arguments);
}
- ASSERT(arguments->isObject(&Arguments::info));
+ ASSERT(arguments->inherits(&Arguments::info));
return arguments;
}