Changeset 77269 in webkit


Ignore:
Timestamp:
Feb 1, 2011 12:17:21 PM (13 years ago)
Author:
oliver@apple.com
Message:

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:
Location:
trunk/Source
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r77260 r77269  
     12011-01-31  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        Update JSObject storage for new marking API
     6        https://bugs.webkit.org/show_bug.cgi?id=53467
     7
     8        JSObject no longer uses EncodedJSValue for its property storage.
     9        This produces a stream of mechanical changes to PropertySlot and
     10        anonymous storage APIs.
     11
     12        * JavaScriptCore.exp:
     13        * runtime/ArrayPrototype.cpp:
     14        (JSC::ArrayPrototype::ArrayPrototype):
     15        * runtime/BooleanConstructor.cpp:
     16        (JSC::constructBoolean):
     17        (JSC::constructBooleanFromImmediateBoolean):
     18        * runtime/BooleanObject.cpp:
     19        (JSC::BooleanObject::BooleanObject):
     20        * runtime/BooleanObject.h:
     21        * runtime/BooleanPrototype.cpp:
     22        (JSC::BooleanPrototype::BooleanPrototype):
     23        * runtime/DateInstance.cpp:
     24        (JSC::DateInstance::DateInstance):
     25        * runtime/DatePrototype.cpp:
     26        (JSC::DatePrototype::DatePrototype):
     27        * runtime/JSActivation.cpp:
     28        (JSC::JSActivation::getOwnPropertySlot):
     29        * runtime/JSArray.cpp:
     30        (JSC::JSArray::getOwnPropertySlot):
     31        * runtime/JSFunction.cpp:
     32        (JSC::JSFunction::getOwnPropertySlot):
     33        * runtime/JSGlobalObject.h:
     34        (JSC::JSGlobalObject::JSGlobalObject):
     35        * runtime/JSObject.cpp:
     36        (JSC::JSObject::fillGetterPropertySlot):
     37        * runtime/JSObject.h:
     38        (JSC::JSObject::getDirectLocation):
     39        (JSC::JSObject::offsetForLocation):
     40        (JSC::JSObject::putAnonymousValue):
     41        (JSC::JSObject::clearAnonymousValue):
     42        (JSC::JSObject::getAnonymousValue):
     43        (JSC::JSObject::putThisToAnonymousValue):
     44        (JSC::JSObject::locationForOffset):
     45        (JSC::JSObject::inlineGetOwnPropertySlot):
     46        * runtime/JSObjectWithGlobalObject.cpp:
     47        (JSC::JSObjectWithGlobalObject::JSObjectWithGlobalObject):
     48        * runtime/JSWrapperObject.h:
     49        (JSC::JSWrapperObject::JSWrapperObject):
     50        (JSC::JSWrapperObject::setInternalValue):
     51        * runtime/Lookup.cpp:
     52        (JSC::setUpStaticFunctionSlot):
     53        * runtime/NumberConstructor.cpp:
     54        (JSC::constructWithNumberConstructor):
     55        * runtime/NumberObject.cpp:
     56        (JSC::NumberObject::NumberObject):
     57        (JSC::constructNumber):
     58        * runtime/NumberObject.h:
     59        * runtime/NumberPrototype.cpp:
     60        (JSC::NumberPrototype::NumberPrototype):
     61        * runtime/PropertySlot.h:
     62        (JSC::PropertySlot::getValue):
     63        (JSC::PropertySlot::setValue):
     64        (JSC::PropertySlot::setRegisterSlot):
     65        * runtime/StringObject.cpp:
     66        (JSC::StringObject::StringObject):
     67        * runtime/StringPrototype.cpp:
     68        (JSC::StringPrototype::StringPrototype):
     69        * runtime/WriteBarrier.h:
     70        (JSC::WriteBarrierBase::setWithoutWriteBarrier):
     71
    1722011-02-01  Daniel Bates  <dbates@rim.com>
    273
  • trunk/Source/JavaScriptCore/JavaScriptCore.exp

    r77151 r77269  
    296296__ZN3JSC8JSObject19getOwnPropertyNamesEPNS_9ExecStateERNS_17PropertyNameArrayENS_15EnumerationModeE
    297297__ZN3JSC8JSObject21getPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
    298 __ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPNS_7JSValueE 
     298__ZN3JSC8JSObject22fillGetterPropertySlotERNS_12PropertySlotEPNS_16WriteBarrierBaseINS_7UnknownEEE
    299299__ZN3JSC8JSObject23allocatePropertyStorageEmm
    300300__ZN3JSC8JSObject24getOwnPropertyDescriptorEPNS_9ExecStateERKNS_10IdentifierERNS_18PropertyDescriptorE
  • trunk/Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def

    r77151 r77269  
    157157    ?fastStrDup@WTF@@YAPADPBD@Z
    158158    ?fastZeroedMalloc@WTF@@YAPAXI@Z
    159     ?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAVJSValue@2@@Z
     159    ?fillGetterPropertySlot@JSObject@JSC@@QAEXAAVPropertySlot@2@PAV?$WriteBarrierBase@W4Unknown@JSC@@@2@@Z
    160160    ?focus@Profile@JSC@@QAEXPBVProfileNode@2@@Z
    161161    ?free@WeakGCHandlePool@JSC@@QAEXPAVWeakGCHandle@2@@Z
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp

    r77151 r77269  
    118118    : JSArray(structure)
    119119{
    120     putAnonymousValue(0, globalObject);
     120    putAnonymousValue(globalObject->globalData(), 0, globalObject);
    121121}
    122122
  • trunk/Source/JavaScriptCore/runtime/BooleanConstructor.cpp

    r77151 r77269  
    4141JSObject* constructBoolean(ExecState* exec, const ArgList& args)
    4242{
    43     BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure());
     43    BooleanObject* obj = new (exec) BooleanObject(exec->globalData(), exec->lexicalGlobalObject()->booleanObjectStructure());
    4444    obj->setInternalValue(exec->globalData(), jsBoolean(args.at(0).toBoolean(exec)));
    4545    return obj;
     
    7272JSObject* constructBooleanFromImmediateBoolean(ExecState* exec, JSValue immediateBooleanValue)
    7373{
    74     BooleanObject* obj = new (exec) BooleanObject(exec->lexicalGlobalObject()->booleanObjectStructure());
     74    BooleanObject* obj = new (exec) BooleanObject(exec->globalData(), exec->lexicalGlobalObject()->booleanObjectStructure());
    7575    obj->setInternalValue(exec->globalData(), immediateBooleanValue);
    7676    return obj;
  • trunk/Source/JavaScriptCore/runtime/BooleanObject.cpp

    r48836 r77269  
    2828const ClassInfo BooleanObject::info = { "Boolean", 0, 0, 0 };
    2929
    30 BooleanObject::BooleanObject(NonNullPassRefPtr<Structure> structure)
    31     : JSWrapperObject(structure)
     30BooleanObject::BooleanObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure)
     31    : JSWrapperObject(globalData, structure)
    3232{
    3333}
  • trunk/Source/JavaScriptCore/runtime/BooleanObject.h

    r54022 r77269  
    2828    class BooleanObject : public JSWrapperObject {
    2929    public:
    30         explicit BooleanObject(NonNullPassRefPtr<Structure>);
     30        explicit BooleanObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure>);
    3131
    3232        virtual const ClassInfo* classInfo() const { return &info; }
  • trunk/Source/JavaScriptCore/runtime/BooleanPrototype.cpp

    r77151 r77269  
    4040
    4141BooleanPrototype::BooleanPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
    42     : BooleanObject(structure)
     42    : BooleanObject(exec->globalData(), structure)
    4343{
    4444    setInternalValue(exec->globalData(), jsBoolean(false));
  • trunk/Source/JavaScriptCore/runtime/DateInstance.cpp

    r77151 r77269  
    3636
    3737DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure)
    38     : JSWrapperObject(structure)
     38    : JSWrapperObject(exec->globalData(), structure)
    3939{
    4040    setInternalValue(exec->globalData(), jsNaN());
     
    4242
    4343DateInstance::DateInstance(ExecState* exec, NonNullPassRefPtr<Structure> structure, double time)
    44     : JSWrapperObject(structure)
     44    : JSWrapperObject(exec->globalData(), structure)
    4545{
    4646    setInternalValue(exec->globalData(), jsNumber(timeClip(time)));
     
    4848
    4949DateInstance::DateInstance(ExecState* exec, double time)
    50     : JSWrapperObject(exec->lexicalGlobalObject()->dateStructure())
     50    : JSWrapperObject(exec->globalData(), exec->lexicalGlobalObject()->dateStructure())
    5151{
    5252    setInternalValue(exec->globalData(), jsNumber(timeClip(time)));
  • trunk/Source/JavaScriptCore/runtime/DatePrototype.cpp

    r77151 r77269  
    434434{
    435435    // The constructor will be added later, after DateConstructor has been built.
    436     putAnonymousValue(0, globalObject);
     436    putAnonymousValue(exec->globalData(), 0, globalObject);
    437437}
    438438
  • trunk/Source/JavaScriptCore/runtime/JSActivation.cpp

    r77151 r77269  
    133133        return true;
    134134
    135     if (JSValue* location = getDirectLocation(propertyName)) {
    136         slot.setValueSlot(location);
     135    if (WriteBarrierBase<Unknown>* location = getDirectLocation(propertyName)) {
     136        slot.setValue(location->get());
    137137        return true;
    138138    }
  • trunk/Source/JavaScriptCore/runtime/JSArray.cpp

    r77151 r77269  
    258258
    259259    if (i < m_vectorLength) {
    260         WriteBarrier<Unknown>& valueSlot = storage->m_vector[i];
    261         if (valueSlot) {
    262             slot.setValueSlot(valueSlot.slot());
     260        JSValue value = storage->m_vector[i].get();
     261        if (value) {
     262            slot.setValue(value);
    263263            return true;
    264264        }
     
    267267            SparseArrayValueMap::iterator it = map->find(i);
    268268            if (it != map->end()) {
    269                 slot.setValueSlot(it->second.slot());
     269                slot.setValue(it->second.get());
    270270                return true;
    271271            }
  • trunk/Source/JavaScriptCore/runtime/JSFunction.cpp

    r77151 r77269  
    204204
    205205    if (propertyName == exec->propertyNames().prototype) {
    206         JSValue* location = getDirectLocation(propertyName);
     206        WriteBarrierBase<Unknown>* location = getDirectLocation(propertyName);
    207207
    208208        if (!location) {
     
    213213        }
    214214
    215         slot.setValueSlot(this, location, offsetForLocation(location));
     215        slot.setValue(this, location->get(), offsetForLocation(location));
    216216    }
    217217
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h

    r77151 r77269  
    148148        {
    149149            COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
    150             putAnonymousValue(0, this);
     150            putThisToAnonymousValue(0);
    151151            init(this);
    152152        }
     
    156156        {
    157157            COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
    158             putAnonymousValue(0, this);
     158            putThisToAnonymousValue(0);
    159159            init(this);
    160160        }
     
    165165        {
    166166            COMPILE_ASSERT(JSGlobalObject::AnonymousSlotCount == 1, JSGlobalObject_has_only_a_single_slot);
    167             putAnonymousValue(0, this);
     167            putThisToAnonymousValue(0);
    168168            init(thisValue);
    169169        }
  • trunk/Source/JavaScriptCore/runtime/JSObject.cpp

    r77151 r77269  
    543543}
    544544
    545 NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, JSValue* location)
    546 {
    547     if (JSObject* getterFunction = asGetterSetter(*location)->getter()) {
     545NEVER_INLINE void JSObject::fillGetterPropertySlot(PropertySlot& slot, WriteBarrierBase<Unknown>* location)
     546{
     547    if (JSObject* getterFunction = asGetterSetter(location->get())->getter()) {
    548548        if (!structure()->isDictionary())
    549549            slot.setCacheableGetterSlot(this, getterFunction, offsetForLocation(location));
  • trunk/Source/JavaScriptCore/runtime/JSObject.h

    r77151 r77269  
    156156        }
    157157
    158         JSValue* getDirectLocation(const Identifier& propertyName)
     158        WriteBarrierBase<Unknown>* getDirectLocation(const Identifier& propertyName)
    159159        {
    160160            size_t offset = m_structure->get(propertyName);
     
    162162        }
    163163
    164         JSValue* getDirectLocation(const Identifier& propertyName, unsigned& attributes)
     164        WriteBarrierBase<Unknown>* getDirectLocation(const Identifier& propertyName, unsigned& attributes)
    165165        {
    166166            JSCell* specificFunction;
     
    169169        }
    170170
    171         size_t offsetForLocation(JSValue* location) const
    172         {
    173             return location - reinterpret_cast<const JSValue*>(propertyStorage());
     171        size_t offsetForLocation(WriteBarrierBase<Unknown>* location) const
     172        {
     173            return location - propertyStorage();
    174174        }
    175175
     
    199199        void putUndefinedAtDirectOffset(size_t offset) { propertyStorage()[offset].setUndefined(); }
    200200
    201         void fillGetterPropertySlot(PropertySlot&, JSValue* location);
     201        void fillGetterPropertySlot(PropertySlot&, WriteBarrierBase<Unknown>* location);
    202202
    203203        virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction, unsigned attributes = 0);
     
    232232        }
    233233
    234         void putAnonymousValue(unsigned index, JSValue value)
     234        void putAnonymousValue(JSGlobalData& globalData, unsigned index, JSValue value)
    235235        {
    236236            ASSERT(index < m_structure->anonymousSlotCount());
    237             *locationForOffset(index) = value;
     237            locationForOffset(index)->set(globalData, this, value);
     238        }
     239        void clearAnonymousValue(unsigned index)
     240        {
     241            ASSERT(index < m_structure->anonymousSlotCount());
     242            locationForOffset(index)->clear();
    238243        }
    239244        JSValue getAnonymousValue(unsigned index) const
    240245        {
    241246            ASSERT(index < m_structure->anonymousSlotCount());
    242             return *locationForOffset(index);
     247            return locationForOffset(index)->get();
    243248        }
    244249       
    245250    protected:
    246251        static const unsigned StructureFlags = 0;
     252       
     253        void putThisToAnonymousValue(unsigned index)
     254        {
     255            locationForOffset(index)->setWithoutWriteBarrier(this);
     256        }
    247257       
    248258    private:
     
    255265        void isObject();
    256266        void isString();
    257 
     267       
    258268        ConstPropertyStorage propertyStorage() const { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
    259269        PropertyStorage propertyStorage() { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
    260270
    261         const JSValue* locationForOffset(size_t offset) const
    262         {
    263             return reinterpret_cast<const JSValue*>(&propertyStorage()[offset]);
    264         }
    265 
    266         JSValue* locationForOffset(size_t offset)
    267         {
    268             return reinterpret_cast<JSValue*>(&propertyStorage()[offset]);
     271        const WriteBarrierBase<Unknown>* locationForOffset(size_t offset) const
     272        {
     273            return &propertyStorage()[offset];
     274        }
     275
     276        WriteBarrierBase<Unknown>* locationForOffset(size_t offset)
     277        {
     278            return &propertyStorage()[offset];
    269279        }
    270280
     
    374384ALWAYS_INLINE bool JSObject::inlineGetOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
    375385{
    376     if (JSValue* location = getDirectLocation(propertyName)) {
    377         if (m_structure->hasGetterSetterProperties() && location[0].isGetterSetter())
     386    if (WriteBarrierBase<Unknown>* location = getDirectLocation(propertyName)) {
     387        if (m_structure->hasGetterSetterProperties() && location->isGetterSetter())
    378388            fillGetterPropertySlot(slot, location);
    379389        else
    380             slot.setValueSlot(this, location, offsetForLocation(location));
     390            slot.setValue(this, location->get(), offsetForLocation(location));
    381391        return true;
    382392    }
  • trunk/Source/JavaScriptCore/runtime/JSObjectWithGlobalObject.cpp

    r60057 r77269  
    3636    COMPILE_ASSERT(AnonymousSlotCount == 1, AnonymousSlotCount_must_be_one);
    3737    ASSERT(!globalObject || globalObject->isGlobalObject());
    38     putAnonymousValue(GlobalObjectSlot, globalObject);
     38    if (!globalObject)
     39        clearAnonymousValue(GlobalObjectSlot);
     40    else
     41        putAnonymousValue(globalObject->globalData(), GlobalObjectSlot, globalObject);
    3942}
    4043
  • trunk/Source/JavaScriptCore/runtime/JSWrapperObject.h

    r77151 r77269  
    3131    class JSWrapperObject : public JSObject {
    3232    protected:
    33         explicit JSWrapperObject(NonNullPassRefPtr<Structure>);
     33        explicit JSWrapperObject(JSGlobalData&, NonNullPassRefPtr<Structure>);
    3434
    3535    public:
     
    5151    };
    5252
    53     inline JSWrapperObject::JSWrapperObject(NonNullPassRefPtr<Structure> structure)
     53    inline JSWrapperObject::JSWrapperObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure)
    5454        : JSObject(structure)
    5555    {
    56         putAnonymousValue(0, jsNull());
     56        putAnonymousValue(globalData, 0, jsNull());
    5757    }
    5858
     
    6262        ASSERT(!value.isObject());
    6363        m_internalValue.set(globalData, this, value);
    64         putAnonymousValue(0, value);
     64        putAnonymousValue(globalData, 0, value);
    6565    }
    6666
  • trunk/Source/JavaScriptCore/runtime/Lookup.cpp

    r77151 r77269  
    7575    ASSERT(thisObj->getAnonymousValue(0).isCell() && asObject(thisObj->getAnonymousValue(0).asCell())->isGlobalObject());
    7676    ASSERT(entry->attributes() & Function);
    77     JSValue* location = thisObj->getDirectLocation(propertyName);
     77    WriteBarrierBase<Unknown>* location = thisObj->getDirectLocation(propertyName);
    7878
    7979    if (!location) {
     
    9191    }
    9292
    93     slot.setValueSlot(thisObj, location, thisObj->offsetForLocation(location));
     93    slot.setValue(thisObj, location->get(), thisObj->offsetForLocation(location));
    9494}
    9595
  • trunk/Source/JavaScriptCore/runtime/NumberConstructor.cpp

    r77151 r77269  
    103103static EncodedJSValue JSC_HOST_CALL constructWithNumberConstructor(ExecState* exec)
    104104{
    105     NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
     105    NumberObject* object = new (exec) NumberObject(exec->globalData(), exec->lexicalGlobalObject()->numberObjectStructure());
    106106    double n = exec->argumentCount() ? exec->argument(0).toNumber(exec) : 0;
    107107    object->setInternalValue(exec->globalData(), jsNumber(n));
  • trunk/Source/JavaScriptCore/runtime/NumberObject.cpp

    r77151 r77269  
    3232const ClassInfo NumberObject::info = { "Number", 0, 0, 0 };
    3333
    34 NumberObject::NumberObject(NonNullPassRefPtr<Structure> structure)
    35     : JSWrapperObject(structure)
     34NumberObject::NumberObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure)
     35    : JSWrapperObject(globalData, structure)
    3636{
    3737}
     
    4444NumberObject* constructNumber(ExecState* exec, JSValue number)
    4545{
    46     NumberObject* object = new (exec) NumberObject(exec->lexicalGlobalObject()->numberObjectStructure());
     46    NumberObject* object = new (exec) NumberObject(exec->globalData(), exec->lexicalGlobalObject()->numberObjectStructure());
    4747    object->setInternalValue(exec->globalData(), number);
    4848    return object;
  • trunk/Source/JavaScriptCore/runtime/NumberObject.h

    r70111 r77269  
    2828    class NumberObject : public JSWrapperObject {
    2929    public:
    30         explicit NumberObject(NonNullPassRefPtr<Structure>);
     30        explicit NumberObject(JSGlobalData&, NonNullPassRefPtr<Structure>);
    3131
    3232        static const ClassInfo info;
  • trunk/Source/JavaScriptCore/runtime/NumberPrototype.cpp

    r77151 r77269  
    4848
    4949NumberPrototype::NumberPrototype(ExecState* exec, JSGlobalObject* globalObject, NonNullPassRefPtr<Structure> structure, Structure* prototypeFunctionStructure)
    50     : NumberObject(structure)
     50    : NumberObject(exec->globalData(), structure)
    5151{
    5252    setInternalValue(exec->globalData(), jsNumber(0));
  • trunk/Source/JavaScriptCore/runtime/PropertySlot.h

    r55564 r77269  
    3333    class JSObject;
    3434
    35 #define JSC_VALUE_SLOT_MARKER 0
    36 #define JSC_REGISTER_SLOT_MARKER reinterpret_cast<GetValueFunc>(1)
     35#define JSC_VALUE_MARKER 0
    3736#define INDEX_GETTER_MARKER reinterpret_cast<GetValueFunc>(2)
    3837#define GETTER_FUNCTION_MARKER reinterpret_cast<GetValueFunc>(3)
     
    6867        JSValue getValue(ExecState* exec, const Identifier& propertyName) const
    6968        {
    70             if (m_getValue == JSC_VALUE_SLOT_MARKER)
    71                 return *m_data.valueSlot;
    72             if (m_getValue == JSC_REGISTER_SLOT_MARKER)
    73                 return (*m_data.registerSlot).jsValue();
     69            if (m_getValue == JSC_VALUE_MARKER)
     70                return m_value;
    7471            if (m_getValue == INDEX_GETTER_MARKER)
    7572                return m_getIndexValue(exec, slotBase(), index());
     
    8178        JSValue getValue(ExecState* exec, unsigned propertyName) const
    8279        {
    83             if (m_getValue == JSC_VALUE_SLOT_MARKER)
    84                 return *m_data.valueSlot;
    85             if (m_getValue == JSC_REGISTER_SLOT_MARKER)
    86                 return (*m_data.registerSlot).jsValue();
     80            if (m_getValue == JSC_VALUE_MARKER)
     81                return m_value;
    8782            if (m_getValue == INDEX_GETTER_MARKER)
    8883                return m_getIndexValue(exec, m_slotBase, m_data.index);
     
    10196        }
    10297
    103         void setValueSlot(JSValue* valueSlot)
    104         {
    105             ASSERT(valueSlot);
    106             clearBase();
    107             clearOffset();
    108             m_getValue = JSC_VALUE_SLOT_MARKER;
    109             m_data.valueSlot = valueSlot;
     98        void setValue(JSValue slotBase, JSValue value)
     99        {
     100            ASSERT(value);
     101            clearOffset();
     102            m_getValue = JSC_VALUE_MARKER;
     103            m_slotBase = slotBase;
     104            m_value = value;
    110105        }
    111106       
    112         void setValueSlot(JSValue slotBase, JSValue* valueSlot)
    113         {
    114             ASSERT(valueSlot);
    115             m_getValue = JSC_VALUE_SLOT_MARKER;
    116             m_slotBase = slotBase;
    117             m_data.valueSlot = valueSlot;
    118         }
    119        
    120         void setValueSlot(JSValue slotBase, JSValue* valueSlot, size_t offset)
    121         {
    122             ASSERT(valueSlot);
    123             m_getValue = JSC_VALUE_SLOT_MARKER;
    124             m_slotBase = slotBase;
    125             m_data.valueSlot = valueSlot;
     107        void setValue(JSValue slotBase, JSValue value, size_t offset)
     108        {
     109            ASSERT(value);
     110            m_getValue = JSC_VALUE_MARKER;
     111            m_slotBase = slotBase;
     112            m_value = value;
    126113            m_offset = offset;
    127114            m_cachedPropertyType = Value;
    128115        }
    129        
     116
    130117        void setValue(JSValue value)
    131118        {
     
    133120            clearBase();
    134121            clearOffset();
    135             m_getValue = JSC_VALUE_SLOT_MARKER;
     122            m_getValue = JSC_VALUE_MARKER;
    136123            m_value = value;
    137             m_data.valueSlot = &m_value;
    138124        }
    139125
     
    143129            clearBase();
    144130            clearOffset();
    145             m_getValue = JSC_REGISTER_SLOT_MARKER;
    146             m_data.registerSlot = registerSlot;
     131            m_getValue = JSC_VALUE_MARKER;
     132            m_value = registerSlot->jsValue();
    147133        }
    148134
     
    252238        union {
    253239            JSObject* getterFunc;
    254             JSValue* valueSlot;
    255             Register* registerSlot;
    256240            unsigned index;
    257241        } m_data;
  • trunk/Source/JavaScriptCore/runtime/StringObject.cpp

    r77151 r77269  
    3131
    3232StringObject::StringObject(ExecState* exec, NonNullPassRefPtr<Structure> structure)
    33     : JSWrapperObject(structure)
     33    : JSWrapperObject(exec->globalData(), structure)
    3434{
    3535    setInternalValue(exec->globalData(), jsEmptyString(exec));
     
    3737
    3838StringObject::StringObject(JSGlobalData& globalData, NonNullPassRefPtr<Structure> structure, JSString* string)
    39     : JSWrapperObject(structure)
     39    : JSWrapperObject(globalData, structure)
    4040{
    4141    setInternalValue(globalData, string);
     
    4343
    4444StringObject::StringObject(ExecState* exec, NonNullPassRefPtr<Structure> structure, const UString& string)
    45     : JSWrapperObject(structure)
     45    : JSWrapperObject(exec->globalData(), structure)
    4646{
    4747    setInternalValue(exec->globalData(), jsString(exec, string));
  • trunk/Source/JavaScriptCore/runtime/StringPrototype.cpp

    r77151 r77269  
    135135    : StringObject(exec, structure)
    136136{
    137     putAnonymousValue(0, globalObject);
     137    putAnonymousValue(exec->globalData(), 0, globalObject);
    138138    // The constructor will be added later, after StringConstructor has been built
    139139    putDirectWithoutTransition(exec->globalData(), exec->propertyNames().length, jsNumber(0), DontDelete | ReadOnly | DontEnum);
  • trunk/Source/JavaScriptCore/runtime/WriteBarrier.h

    r77151 r77269  
    9898    bool operator!() const { return !m_cell; }
    9999
     100    void setWithoutWriteBarrier(T* value) { this->m_cell = reinterpret_cast<JSCell*>(value); }
     101
    100102protected:
    101103    JSCell* m_cell;
     
    120122    void setUndefined() { m_value = JSValue::encode(jsUndefined()); }
    121123    bool isNumber() const { return get().isNumber(); }
     124    bool isGetterSetter() const { return get().isGetterSetter(); }
     125   
    122126    JSValue* slot()
    123127    {
  • trunk/Source/WebCore/ChangeLog

    r77267 r77269  
     12011-01-31  Oliver Hunt  <oliver@apple.com>
     2
     3        Reviewed by Geoffrey Garen.
     4
     5        Update JSObject storage for new marking API
     6        https://bugs.webkit.org/show_bug.cgi?id=53467
     7
     8        Update WebCore to handle new anonymous slot behaviour.
     9
     10        * bindings/js/JSDOMWindowShell.cpp:
     11        (WebCore::JSDOMWindowShell::setWindow):
     12        * bindings/js/WorkerScriptController.cpp:
     13        (WebCore::WorkerScriptController::initScript):
     14        * bindings/scripts/CodeGeneratorJS.pm:
     15
    1162011-02-01  Xiaomei Ji  <xji@chromium.org>
    217
  • trunk/Source/WebCore/bindings/js/JSDOMWindowShell.cpp

    r77151 r77269  
    6565    RefPtr<Structure> structure = JSDOMWindow::createStructure(prototype);
    6666    JSDOMWindow* jsDOMWindow = new (JSDOMWindow::commonJSGlobalData()) JSDOMWindow(structure.release(), domWindow, this);
    67     prototype->putAnonymousValue(0, jsDOMWindow);
     67    prototype->putAnonymousValue(*JSDOMWindow::commonJSGlobalData(), 0, jsDOMWindow);
    6868    setWindow(*JSDOMWindow::commonJSGlobalData(), jsDOMWindow);
    6969}
  • trunk/Source/WebCore/bindings/js/WorkerScriptController.cpp

    r70406 r77269  
    8181
    8282        m_workerContextWrapper = new (m_globalData.get()) JSDedicatedWorkerContext(structure.release(), m_workerContext->toDedicatedWorkerContext());
    83         workerContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
    84         dedicatedContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
     83        workerContextPrototype->putAnonymousValue(*m_globalData, 0, m_workerContextWrapper);
     84        dedicatedContextPrototype->putAnonymousValue(*m_globalData, 0, m_workerContextWrapper);
    8585#if ENABLE(SHARED_WORKERS)
    8686    } else {
     
    9191
    9292        m_workerContextWrapper = new (m_globalData.get()) JSSharedWorkerContext(structure.release(), m_workerContext->toSharedWorkerContext());
    93         workerContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
    94         sharedContextPrototype->putAnonymousValue(0, m_workerContextWrapper);
     93        workerContextPrototype->putAnonymousValue(*m_globalData, 0, m_workerContextWrapper);
     94        sharedContextPrototype->putAnonymousValue(*m_globalData, 0, m_workerContextWrapper);
    9595#endif
    9696    }
  • trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r77151 r77269  
    14351435    if ($numCachedAttributes > 0) {
    14361436        push(@implContent, "    for (unsigned i = Base::AnonymousSlotCount; i < AnonymousSlotCount; i++)\n");
    1437         push(@implContent, "        putAnonymousValue(i, JSValue());\n");
     1437        push(@implContent, "        putAnonymousValue(globalObject->globalData(), i, JSValue());\n");
    14381438    }
    14391439    push(@implContent, "}\n\n");
     
    16031603                    }
    16041604                   
    1605                     push(@implContent, "    castedThis->putAnonymousValue(" . $className . "::" . $attribute->signature->name . "Slot, result);\n") if ($attribute->signature->extendedAttributes->{"CachedAttribute"});
     1605                    push(@implContent, "    castedThis->putAnonymousValue(exec->globalData(), " . $className . "::" . $attribute->signature->name . "Slot, result);\n") if ($attribute->signature->extendedAttributes->{"CachedAttribute"});
    16061606                    push(@implContent, "    return result;\n");
    16071607
Note: See TracChangeset for help on using the changeset viewer.