Commit b7c4474a authored by oliver@apple.com's avatar oliver@apple.com

2011-01-31 Oliver Hunt <oliver@apple.com>

        Reviewed by Geoffrey Garen.

        Update JSObject storage for new marking API
        https://bugs.webkit.org/show_bug.cgi?id=53467

        JSObject no longer uses EncodedJSValue for its property storage.
        This produces a stream of mechanical changes to PropertySlot and
        anonymous storage APIs.

        * JavaScriptCore.exp:
        * runtime/ArrayPrototype.cpp:
        (JSC::ArrayPrototype::ArrayPrototype):
        * runtime/BooleanConstructor.cpp:
        (JSC::constructBoolean):
        (JSC::constructBooleanFromImmediateBoolean):
        * runtime/BooleanObject.cpp:
        (JSC::BooleanObject::BooleanObject):
        * runtime/BooleanObject.h:
        * runtime/BooleanPrototype.cpp:
        (JSC::BooleanPrototype::BooleanPrototype):
        * runtime/DateInstance.cpp:
        (JSC::DateInstance::DateInstance):
        * runtime/DatePrototype.cpp:
        (JSC::DatePrototype::DatePrototype):
        * runtime/JSActivation.cpp:
        (JSC::JSActivation::getOwnPropertySlot):
        * runtime/JSArray.cpp:
        (JSC::JSArray::getOwnPropertySlot):
        * runtime/JSFunction.cpp:
        (JSC::JSFunction::getOwnPropertySlot):
        * runtime/JSGlobalObject.h:
        (JSC::JSGlobalObject::JSGlobalObject):
        * runtime/JSObject.cpp:
        (JSC::JSObject::fillGetterPropertySlot):
        * runtime/JSObject.h:
        (JSC::JSObject::getDirectLocation):
        (JSC::JSObject::offsetForLocation):
        (JSC::JSObject::putAnonymousValue):
        (JSC::JSObject::clearAnonymousValue):
        (JSC::JSObject::getAnonymousValue):
        (JSC::JSObject::putThisToAnonymousValue):
        (JSC::JSObject::locationForOffset):
        (JSC::JSObject::inlineGetOwnPropertySlot):
        * runtime/JSObjectWithGlobalObject.cpp:
        (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
        * runtime/JSWrapperObject.h:
        (JSC::JSWrapperObject::JSWrapperObject):
        (JSC::JSWrapperObject::setInternalValue):
        * runtime/Lookup.cpp:
        (JSC::setUpStaticFunctionSlot):
        * runtime/NumberConstructor.cpp:
        (JSC::constructWithNumberConstructor):
        * runtime/NumberObject.cpp:
        (JSC::NumberObject::NumberObject):
        (JSC::constructNumber):
        * runtime/NumberObject.h:
        * runtime/NumberPrototype.cpp:
        (JSC::NumberPrototype::NumberPrototype):
        * runtime/PropertySlot.h:
        (JSC::PropertySlot::getValue):
        (JSC::PropertySlot::setValue):
        (JSC::PropertySlot::setRegisterSlot):
        * runtime/StringObject.cpp:
        (JSC::StringObject::StringObject):
        * runtime/StringPrototype.cpp:
        (JSC::StringPrototype::StringPrototype):
        * runtime/WriteBarrier.h:
        (JSC::WriteBarrierBase::setWithoutWriteBarrier):
2011-01-31  Oliver Hunt  <oliver@apple.com>

        Reviewed by Geoffrey Garen.

        Update JSObject storage for new marking API
        https://bugs.webkit.org/show_bug.cgi?id=53467

        Update WebCore to handle new anonymous slot behaviour.

        * bindings/js/JSDOMWindowShell.cpp:
        (WebCore::JSDOMWindowShell::setWindow):
        * bindings/js/WorkerScriptController.cpp:
        (WebCore::WorkerScriptController::initScript):
        * bindings/scripts/CodeGeneratorJS.pm:

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77269 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 655d60b8
2011-01-31 Oliver Hunt <oliver@apple.com>
Reviewed by Geoffrey Garen.
Update JSObject storage for new marking API
https://bugs.webkit.org/show_bug.cgi?id=53467
JSObject no longer uses EncodedJSValue for its property storage.
This produces a stream of mechanical changes to PropertySlot and
anonymous storage APIs.
* JavaScriptCore.exp:
* runtime/ArrayPrototype.cpp:
(JSC::ArrayPrototype::ArrayPrototype):
* runtime/BooleanConstructor.cpp:
(JSC::constructBoolean):
(JSC::constructBooleanFromImmediateBoolean):
* runtime/BooleanObject.cpp:
(JSC::BooleanObject::BooleanObject):
* runtime/BooleanObject.h:
* runtime/BooleanPrototype.cpp:
(JSC::BooleanPrototype::BooleanPrototype):
* runtime/DateInstance.cpp:
(JSC::DateInstance::DateInstance):
* runtime/DatePrototype.cpp:
(JSC::DatePrototype::DatePrototype):
* runtime/JSActivation.cpp:
(JSC::JSActivation::getOwnPropertySlot):
* runtime/JSArray.cpp:
(JSC::JSArray::getOwnPropertySlot):
* runtime/JSFunction.cpp:
(JSC::JSFunction::getOwnPropertySlot):
* runtime/JSGlobalObject.h:
(JSC::JSGlobalObject::JSGlobalObject):
* runtime/JSObject.cpp:
(JSC::JSObject::fillGetterPropertySlot):
* runtime/JSObject.h:
(JSC::JSObject::getDirectLocation):
(JSC::JSObject::offsetForLocation):
(JSC::JSObject::putAnonymousValue):
(JSC::JSObject::clearAnonymousValue):
(JSC::JSObject::getAnonymousValue):
(JSC::JSObject::putThisToAnonymousValue):
(JSC::JSObject::locationForOffset):
(JSC::JSObject::inlineGetOwnPropertySlot):
* runtime/JSObjectWithGlobalObject.cpp:
(JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
* runtime/JSWrapperObject.h:
(JSC::JSWrapperObject::JSWrapperObject):
(JSC::JSWrapperObject::setInternalValue):
* runtime/Lookup.cpp:
(JSC::setUpStaticFunctionSlot):
* runtime/NumberConstructor.cpp:
(JSC::constructWithNumberConstructor):
* runtime/NumberObject.cpp:
(JSC::NumberObject::NumberObject):
(JSC::constructNumber):
* runtime/NumberObject.h:
* runtime/NumberPrototype.cpp:
(JSC::NumberPrototype::NumberPrototype):
* runtime/PropertySlot.h:
(JSC::PropertySlot::getValue):
(JSC::PropertySlot::setValue):
(JSC::PropertySlot::setRegisterSlot):
* runtime/StringObject.cpp:
(JSC::StringObject::StringObject):
* runtime/StringPrototype.cpp:
(JSC::StringPrototype::StringPrototype):
* runtime/WriteBarrier.h:
(JSC::WriteBarrierBase::setWithoutWriteBarrier):
2011-02-01 Daniel Bates <dbates@rim.com>
Reviewed by Antonio Gomes.
......
......@@ -295,7 +295,7 @@ __ZN3JSC8JSObject18getOwnPropertySlotEPNS_9ExecStateEjRNS_12PropertySlotE
__ZN3JSC8JSObject18getPrimitiveNumberEPNS_9ExecStateERdRNS_7JSValueE
__ZN3JSC8JSObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
__ZN3JSC8JSObject21getPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
__ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPNS_7JSValueE
__ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPNS_16WriteBarrierBaseINS_7UnknownEEE
__ZN3JSC8JSObject23allocatePropertyStorageEmm
__ZN3JSC8JSObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
__ZN3JSC8JSObject3putEPNS_9ExecStateERKNS_10IdentifierENS_7JSValueERNS_15PutPropertySlotE
......
......@@ -156,7 +156,7 @@ EXPORTS
?fastRealloc@WTF@@YAPAXPAXI@Z
?fastStrDup@WTF@@YAPADPBD@Z
?fastZeroedMalloc@WTF@@YAPAXI@Z
?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAVJSValue@2@@Z
?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAV?$WriteBarrierBase@W4Unknown@JSC@@@2@@Z
?focus@Profile@JSC@@QAEXPBVProfileNode@2@@Z
?free@WeakGCHandlePool@JSC@@QAEXPAVWeakGCHandle@2@@Z
?from@Identifier@JSC@@SA?AV12@PAVExecState@2@H@Z
......
......@@ -117,7 +117,7 @@ const ClassInfo ArrayPrototype::info = {"Array", &JSArray::info, 0, ExecState::a
ArrayPrototype::ArrayPrototype(JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure)
: JSArray(structure)
{
putAnonymousValue(0, globalObject);
putAnonymousValue(globalObject->globalData(), 0, globalObject);
}
bool ArrayPrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
......
......@@ -40,7 +40,7 @@ BooleanConstructor::BooleanConstructor(ExecState* exec, JSGlobalObject* globalOb
// ECMA 15.6.2
JSObject* constructBoolean(ExecState* exec, const ArgList& args)
{
BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure());
BooleanObject* obj = new (exec) BooleanObject(exec->globalData(), exec->lexicalGlobalObject()->booleanObjectStructure());
obj->setInternalValue(exec->globalData(), jsBoolean(args.at(0).toBoolean(exec)));
return obj;
}
......@@ -71,7 +71,7 @@ CallType BooleanConstructor::getCallData(CallData& callData)
JSObject* constructBooleanFromImmediateBoolean(ExecState* exec, JSValue immediateBooleanValue)
{
BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure());
BooleanObject* obj = new (exec) BooleanObject(exec->globalData(), exec->lexicalGlobalObject()->booleanObjectStructure());
obj->setInternalValue(exec->globalData(), immediateBooleanValue);
return obj;
}
......
......@@ -27,8 +27,8 @@ ASSERT_CLASS_FITS_IN_CELL(BooleanObject);
const ClassInfo BooleanObject::info = { "Boolean", 0, 0, 0 };
BooleanObject::BooleanObject(NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(structure)
BooleanObject::BooleanObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(globalData, structure)
{
}
......
......@@ -27,7 +27,7 @@ namespace JSC {
class BooleanObject : public JSWrapperObject {
public:
explicit BooleanObject(NonNullPassRefPtr<Structure>);
explicit BooleanObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure>);
virtual const ClassInfo* classInfo() const { return &info; }
static const ClassInfo info;
......
......@@ -39,7 +39,7 @@ static EncodedJSValue JSC_HOST_CALL booleanProtoFuncValueOf(ExecState*);
// ECMA 15.6.4
BooleanPrototype::BooleanPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
: BooleanObject(structure)
: BooleanObject(exec->globalData(), structure)
{
setInternalValue(exec->globalData(), jsBoolean(false));
......
......@@ -35,19 +35,19 @@ namespace JSC {
const ClassInfo DateInstance::info = {"Date", 0, 0, 0};
DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(structure)
: JSWrapperObject(exec->globalData(), structure)
{
setInternalValue(exec->globalData(), jsNaN());
}
DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure, double time)
: JSWrapperObject(structure)
: JSWrapperObject(exec->globalData(), structure)
{
setInternalValue(exec->globalData(), jsNumber(timeClip(time)));
}
DateInstance::DateInstance(ExecState* exec, double time)
: JSWrapperObject(exec->lexicalGlobalObject()->dateStructure())
: JSWrapperObject(exec->globalData(), exec->lexicalGlobalObject()->dateStructure())
{
setInternalValue(exec->globalData(), jsNumber(timeClip(time)));
}
......
......@@ -433,7 +433,7 @@ DatePrototype::DatePrototype(ExecState* exec, JSGlobalObject* globalObject, NonN
: DateInstance(exec, structure)
{
// The constructor will be added later, after DateConstructor has been built.
putAnonymousValue(0, globalObject);
putAnonymousValue(exec->globalData(), 0, globalObject);
}
bool DatePrototype::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
......
......@@ -132,8 +132,8 @@ bool JSActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propert
if (symbolTableGet(propertyName, slot))
return true;
if (JSValue* location = getDirectLocation(propertyName)) {
slot.setValueSlot(location);
if (WriteBarrierBase<Unknown>* location = getDirectLocation(propertyName)) {
slot.setValue(location->get());
return true;
}
......
......@@ -257,16 +257,16 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& slot
}
if (i < m_vectorLength) {
WriteBarrier<Unknown>& valueSlot = storage->m_vector[i];
if (valueSlot) {
slot.setValueSlot(valueSlot.slot());
JSValue value = storage->m_vector[i].get();
if (value) {
slot.setValue(value);
return true;
}
} else if (SparseArrayValueMap* map = storage->m_sparseValueMap) {
if (i >= MIN_SPARSE_ARRAY_INDEX) {
SparseArrayValueMap::iterator it = map->find(i);
if (it != map->end()) {
slot.setValueSlot(it->second.slot());
slot.setValue(it->second.get());
return true;
}
}
......
......@@ -203,7 +203,7 @@ bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyN
return Base::getOwnPropertySlot(exec, propertyName, slot);
if (propertyName == exec->propertyNames().prototype) {
JSValue* location = getDirectLocation(propertyName);
WriteBarrierBase<Unknown>* location = getDirectLocation(propertyName);
if (!location) {
JSObject* prototype = new (exec) JSObject(scope().globalObject()->emptyObjectStructure());
......@@ -212,7 +212,7 @@ bool JSFunction::getOwnPropertySlot(ExecState* exec, const Identifier& propertyN
location = getDirectLocation(propertyName);
}
slot.setValueSlot(this, location, offsetForLocation(location));
slot.setValue(this, location->get(), offsetForLocation(location));
}
if (propertyName == exec->propertyNames().arguments) {
......
......@@ -147,7 +147,7 @@ namespace JSC {
: JSVariableObject(JSGlobalObject::createStructure(jsNull()), new JSGlobalObjectData(destroyJSGlobalObjectData))
{
COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
putAnonymousValue(0, this);
putThisToAnonymousValue(0);
init(this);
}
......@@ -155,7 +155,7 @@ namespace JSC {
: JSVariableObject(structure, new JSGlobalObjectData(destroyJSGlobalObjectData))
{
COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
putAnonymousValue(0, this);
putThisToAnonymousValue(0);
init(this);
}
......@@ -164,7 +164,7 @@ namespace JSC {
: JSVariableObject(structure, data)
{
COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
putAnonymousValue(0, this);
putThisToAnonymousValue(0);
init(thisValue);
}
......
......@@ -542,9 +542,9 @@ void JSObject::putDirectFunctionWithoutTransition(ExecState* exec, JSFunction* f
putDirectFunctionWithoutTransition(exec->globalData(), Identifier(exec, function->name(exec)), function, attr);
}
NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, JSValue* location)
NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, WriteBarrierBase<Unknown>* location)
{
if (JSObject* getterFunction = asGetterSetter(*location)->getter()) {
if (JSObject* getterFunction = asGetterSetter(location->get())->getter()) {
if (!structure()->isDictionary())
slot.setCacheableGetterSlot(this, getterFunction, offsetForLocation(location));
else
......
......@@ -155,22 +155,22 @@ namespace JSC {
return offset != WTF::notFound ? getDirectOffset(offset) : JSValue();
}
JSValue* getDirectLocation(const Identifier& propertyName)
WriteBarrierBase<Unknown>* getDirectLocation(const Identifier& propertyName)
{
size_t offset = m_structure->get(propertyName);
return offset != WTF::notFound ? locationForOffset(offset) : 0;
}
JSValue* getDirectLocation(const Identifier& propertyName, unsigned& attributes)
WriteBarrierBase<Unknown>* getDirectLocation(const Identifier& propertyName, unsigned& attributes)
{
JSCell* specificFunction;
size_t offset = m_structure->get(propertyName, attributes, specificFunction);
return offset != WTF::notFound ? locationForOffset(offset) : 0;
}
size_t offsetForLocation(JSValue* location) const
size_t offsetForLocation(WriteBarrierBase<Unknown>* location) const
{
return location - reinterpret_cast<const JSValue*>(propertyStorage());
return location - propertyStorage();
}
void transitionTo(Structure*);
......@@ -198,7 +198,7 @@ namespace JSC {
void putDirectOffset(JSGlobalData& globalData, size_t offset, JSValue value) { propertyStorage()[offset].set(globalData, this, value); }
void putUndefinedAtDirectOffset(size_t offset) { propertyStorage()[offset].setUndefined(); }
void fillGetterPropertySlot(PropertySlot&, JSValue* location);
void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* location);
virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes = 0);
virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction, unsigned attributes = 0);
......@@ -231,20 +231,30 @@ namespace JSC {
m_structure->flattenDictionaryStructure(globalData, this);
}
void putAnonymousValue(unsigned index, JSValue value)
void putAnonymousValue(JSGlobalData& globalData, unsigned index, JSValue value)
{
ASSERT(index < m_structure->anonymousSlotCount());
*locationForOffset(index) = value;
locationForOffset(index)->set(globalData, this, value);
}
void clearAnonymousValue(unsigned index)
{
ASSERT(index < m_structure->anonymousSlotCount());
locationForOffset(index)->clear();
}
JSValue getAnonymousValue(unsigned index) const
{
ASSERT(index < m_structure->anonymousSlotCount());
return *locationForOffset(index);
return locationForOffset(index)->get();
}
protected:
static const unsigned StructureFlags = 0;
void putThisToAnonymousValue(unsigned index)
{
locationForOffset(index)->setWithoutWriteBarrier(this);
}
private:
// Nobody should ever ask any of these questions on something already known to be a JSObject.
using JSCell::isAPIValueWrapper;
......@@ -254,18 +264,18 @@ namespace JSC {
void getString(ExecState* exec);
void isObject();
void isString();
ConstPropertyStorage propertyStorage() const { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
PropertyStorage propertyStorage() { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
const JSValue* locationForOffset(size_t offset) const
const WriteBarrierBase<Unknown>* locationForOffset(size_t offset) const
{
return reinterpret_cast<const JSValue*>(&propertyStorage()[offset]);
return &propertyStorage()[offset];
}
JSValue* locationForOffset(size_t offset)
WriteBarrierBase<Unknown>* locationForOffset(size_t offset)
{
return reinterpret_cast<JSValue*>(&propertyStorage()[offset]);
return &propertyStorage()[offset];
}
bool putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue, unsigned attr, bool checkReadOnly, PutPropertySlot&, JSCell*);
......@@ -373,11 +383,11 @@ inline bool JSValue::inherits(const ClassInfo* classInfo) const
ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
if (JSValue* location = getDirectLocation(propertyName)) {
if (m_structure->hasGetterSetterProperties() && location[0].isGetterSetter())
if (WriteBarrierBase<Unknown>* location = getDirectLocation(propertyName)) {
if (m_structure->hasGetterSetterProperties() && location->isGetterSetter())
fillGetterPropertySlot(slot, location);
else
slot.setValueSlot(this, location, offsetForLocation(location));
slot.setValue(this, location->get(), offsetForLocation(location));
return true;
}
......
......@@ -35,7 +35,10 @@ JSObjectWithGlobalObject::JSObjectWithGlobalObject(JSGlobalObject* globalObject,
{
COMPILE_ASSERT(AnonymousSlotCount == 1, AnonymousSlotCount_must_be_one);
ASSERT(!globalObject || globalObject->isGlobalObject());
putAnonymousValue(GlobalObjectSlot, globalObject);
if (!globalObject)
clearAnonymousValue(GlobalObjectSlot);
else
putAnonymousValue(globalObject->globalData(), GlobalObjectSlot, globalObject);
}
JSGlobalObject* JSObjectWithGlobalObject::globalObject() const
......
......@@ -30,7 +30,7 @@ namespace JSC {
// Number, Boolean and Date which are wrappers for primitive types.
class JSWrapperObject : public JSObject {
protected:
explicit JSWrapperObject(NonNullPassRefPtr<Structure>);
explicit JSWrapperObject(JSGlobalData&, NonNullPassRefPtr<Structure>);
public:
JSValue internalValue() const { return m_internalValue.get(); }
......@@ -50,10 +50,10 @@ namespace JSC {
WriteBarrier<Unknown> m_internalValue;
};
inline JSWrapperObject::JSWrapperObject(NonNullPassRefPtr<Structure> structure)
inline JSWrapperObject::JSWrapperObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure)
: JSObject(structure)
{
putAnonymousValue(0, jsNull());
putAnonymousValue(globalData, 0, jsNull());
}
inline void JSWrapperObject::setInternalValue(JSGlobalData& globalData, JSValue value)
......@@ -61,7 +61,7 @@ namespace JSC {
ASSERT(value);
ASSERT(!value.isObject());
m_internalValue.set(globalData, this, value);
putAnonymousValue(0, value);
putAnonymousValue(globalData, 0, value);
}
} // namespace JSC
......
......@@ -74,7 +74,7 @@ void setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject*
ASSERT(thisObj->structure()->anonymousSlotCount() > 0);
ASSERT(thisObj->getAnonymousValue(0).isCell() && asObject(thisObj->getAnonymousValue(0).asCell())->isGlobalObject());
ASSERT(entry->attributes() & Function);
JSValue* location = thisObj->getDirectLocation(propertyName);
WriteBarrierBase<Unknown>* location = thisObj->getDirectLocation(propertyName);
if (!location) {
NativeFunctionWrapper* function;
......@@ -90,7 +90,7 @@ void setUpStaticFunctionSlot(ExecState* exec, const HashEntry* entry, JSObject*
location = thisObj->getDirectLocation(propertyName);
}
slot.setValueSlot(thisObj, location, thisObj->offsetForLocation(location));
slot.setValue(thisObj, location->get(), thisObj->offsetForLocation(location));
}
} // namespace JSC
......@@ -102,7 +102,7 @@ static JSValue numberConstructorMinValue(ExecState*, JSValue, const Identifier&)
// ECMA 15.7.1
static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* exec)
{
NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
NumberObject* object = new (exec) NumberObject(exec->globalData(), exec->lexicalGlobalObject()->numberObjectStructure());
double n = exec->argumentCount() ? exec->argument(0).toNumber(exec) : 0;
object->setInternalValue(exec->globalData(), jsNumber(n));
return JSValue::encode(object);
......
......@@ -31,8 +31,8 @@ ASSERT_CLASS_FITS_IN_CELL(NumberObject);
const ClassInfo NumberObject::info = { "Number", 0, 0, 0 };
NumberObject::NumberObject(NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(structure)
NumberObject::NumberObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure)
: JSWrapperObject(globalData, structure)
{
}
......@@ -43,7 +43,7 @@ JSValue NumberObject::getJSNumber()
NumberObject* constructNumber(ExecState* exec, JSValue number)
{
NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
NumberObject* object = new (exec) NumberObject(exec->globalData(), exec->lexicalGlobalObject()->numberObjectStructure());
object->setInternalValue(exec->globalData(), number);
return object;
}
......
......@@ -27,7 +27,7 @@ namespace JSC {
class NumberObject : public JSWrapperObject {
public:
explicit NumberObject(NonNullPassRefPtr<Structure>);
explicit NumberObject(JSGlobalData&, NonNullPassRefPtr<Structure>);
static const ClassInfo info;
......
......@@ -47,7 +47,7 @@ static EncodedJSValue JSC_HOST_CALL numberProtoFuncToPrecision(ExecState*);
// ECMA 15.7.4
NumberPrototype::NumberPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
: NumberObject(structure)
: NumberObject(exec->globalData(), structure)
{
setInternalValue(exec->globalData(), jsNumber(0));
......
......@@ -32,8 +32,7 @@ namespace JSC {
class ExecState;
class JSObject;
#define JSC_VALUE_SLOT_MARKER 0
#define JSC_REGISTER_SLOT_MARKER reinterpret_cast<GetValueFunc>(1)
#define JSC_VALUE_MARKER 0
#define INDEX_GETTER_MARKER reinterpret_cast<GetValueFunc>(2)
#define GETTER_FUNCTION_MARKER reinterpret_cast<GetValueFunc>(3)
......@@ -67,10 +66,8 @@ namespace JSC {
JSValue getValue(ExecState* exec, const Identifier& propertyName) const
{
if (m_getValue == JSC_VALUE_SLOT_MARKER)
return *m_data.valueSlot;
if (m_getValue == JSC_REGISTER_SLOT_MARKER)
return (*m_data.registerSlot).jsValue();
if (m_getValue == JSC_VALUE_MARKER)
return m_value;
if (m_getValue == INDEX_GETTER_MARKER)
return m_getIndexValue(exec, slotBase(), index());
if (m_getValue == GETTER_FUNCTION_MARKER)
......@@ -80,10 +77,8 @@ namespace JSC {
JSValue getValue(ExecState* exec, unsigned propertyName) const
{
if (m_getValue == JSC_VALUE_SLOT_MARKER)
return *m_data.valueSlot;
if (m_getValue == JSC_REGISTER_SLOT_MARKER)
return (*m_data.registerSlot).jsValue();
if (m_getValue == JSC_VALUE_MARKER)
return m_value;
if (m_getValue == INDEX_GETTER_MARKER)
return m_getIndexValue(exec, m_slotBase, m_data.index);
if (m_getValue == GETTER_FUNCTION_MARKER)
......@@ -100,41 +95,32 @@ namespace JSC {
return m_offset;
}
void setValueSlot(JSValue* valueSlot)
void setValue(JSValue slotBase, JSValue value)
{
ASSERT(valueSlot);
clearBase();
ASSERT(value);
clearOffset();
m_getValue = JSC_VALUE_SLOT_MARKER;
m_data.valueSlot = valueSlot;
}
void setValueSlot(JSValue slotBase, JSValue* valueSlot)
{
ASSERT(valueSlot);
m_getValue = JSC_VALUE_SLOT_MARKER;
m_getValue = JSC_VALUE_MARKER;
m_slotBase = slotBase;
m_data.valueSlot = valueSlot;
m_value = value;
}
void setValueSlot(JSValue slotBase, JSValue* valueSlot, size_t offset)
void setValue(JSValue slotBase, JSValue value, size_t offset)
{
ASSERT(valueSlot);
m_getValue = JSC_VALUE_SLOT_MARKER;
ASSERT(value);
m_getValue = JSC_VALUE_MARKER;
m_slotBase = slotBase;
m_data.valueSlot = valueSlot;
m_value = value;
m_offset = offset;
m_cachedPropertyType = Value;
}
void setValue(JSValue value)
{
ASSERT(value);
clearBase();
clearOffset();
m_getValue = JSC_VALUE_SLOT_MARKER;
m_getValue = JSC_VALUE_MARKER;
m_value = value;
m_data.valueSlot = &m_value;
}
void setRegisterSlot(Register* registerSlot)
......@@ -142,8 +128,8 @@ namespace JSC {
ASSERT(registerSlot);
clearBase();
clearOffset();
m_getValue = JSC_REGISTER_SLOT_MARKER;
m_data.registerSlot = registerSlot;
m_getValue = JSC_VALUE_MARKER;
m_value = registerSlot->jsValue();
}
void setCustom(JSValue slotBase, GetValueFunc getValue)
......@@ -251,8 +237,6 @@ namespace JSC {
JSValue m_slotBase;
union {
JSObject* getterFunc;
JSValue* valueSlot;
Register* registerSlot;
unsigned index;
} m_data;
......
......@@ -30,19 +30,19 @@ ASSERT_CLASS_FITS_IN_CELL(StringObject);
const ClassInfo StringObject::info = { "String", 0, 0, 0 };