Changeset 37400 in webkit


Ignore:
Timestamp:
Oct 7, 2008 4:49:59 PM (16 years ago)
Author:
weinig@apple.com
Message:

2008-10-07 Sam Weinig <sam@webkit.org>

Reviewed by Cameron Zwarich.

Move hasGetterSetterProperties flag from PropertyMap to StructureID.

  • kjs/JSObject.cpp: (JSC::JSObject::put): (JSC::JSObject::defineGetter): (JSC::JSObject::defineSetter):
  • kjs/JSObject.h: (JSC::JSObject::hasGetterSetterProperties): (JSC::JSObject::getOwnPropertySlotForWrite): (JSC::JSObject::getOwnPropertySlot):
  • kjs/PropertyMap.h:
  • kjs/StructureID.cpp: (JSC::StructureID::StructureID): (JSC::StructureID::addPropertyTransition): (JSC::StructureID::toDictionaryTransition): (JSC::StructureID::changePrototypeTransition): (JSC::StructureID::getterSetterTransition):
  • kjs/StructureID.h: (JSC::StructureID::hasGetterSetterProperties): (JSC::StructureID::setHasGetterSetterProperties):
Location:
trunk/JavaScriptCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r37388 r37400  
     12008-10-07  Sam Weinig  <sam@webkit.org>
     2
     3        Reviewed by Cameron Zwarich.
     4
     5        Move hasGetterSetterProperties flag from PropertyMap to StructureID.
     6
     7        * kjs/JSObject.cpp:
     8        (JSC::JSObject::put):
     9        (JSC::JSObject::defineGetter):
     10        (JSC::JSObject::defineSetter):
     11        * kjs/JSObject.h:
     12        (JSC::JSObject::hasGetterSetterProperties):
     13        (JSC::JSObject::getOwnPropertySlotForWrite):
     14        (JSC::JSObject::getOwnPropertySlot):
     15        * kjs/PropertyMap.h:
     16        * kjs/StructureID.cpp:
     17        (JSC::StructureID::StructureID):
     18        (JSC::StructureID::addPropertyTransition):
     19        (JSC::StructureID::toDictionaryTransition):
     20        (JSC::StructureID::changePrototypeTransition):
     21        (JSC::StructureID::getterSetterTransition):
     22        * kjs/StructureID.h:
     23        (JSC::StructureID::hasGetterSetterProperties):
     24        (JSC::StructureID::setHasGetterSetterProperties):
     25
    1262008-10-07  Sam Weinig  <sam@webkit.org>
    227
  • trunk/JavaScriptCore/kjs/JSObject.cpp

    r37388 r37400  
    126126    // Check if there are any setters or getters in the prototype chain
    127127    JSValue* prototype;
    128     for (JSObject* obj = this; !obj->structureID()->propertyMap().hasGetterSetterProperties(); obj = static_cast<JSObject*>(prototype)) {
     128    for (JSObject* obj = this; !obj->structureID()->hasGetterSetterProperties(); obj = static_cast<JSObject*>(prototype)) {
    129129        prototype = obj->prototype();
    130130        if (prototype->isNull()) {
     
    293293    JSValue* object = getDirect(propertyName);
    294294    if (object && object->isGetterSetter()) {
    295         ASSERT(m_structureID->propertyMap().hasGetterSetterProperties());
     295        ASSERT(m_structureID->hasGetterSetterProperties());
    296296        GetterSetter* getterSetter = static_cast<GetterSetter*>(object);
    297297        getterSetter->setGetter(getterFunction);
     
    313313    }
    314314
    315     m_structureID->propertyMap().setHasGetterSetterProperties(true);
     315    m_structureID->setHasGetterSetterProperties(true);
    316316    getterSetter->setGetter(getterFunction);
    317317}
     
    321321    JSValue* object = getDirect(propertyName);
    322322    if (object && object->isGetterSetter()) {
    323         ASSERT(m_structureID->propertyMap().hasGetterSetterProperties());
     323        ASSERT(m_structureID->hasGetterSetterProperties());
    324324        GetterSetter* getterSetter = static_cast<GetterSetter*>(object);
    325325        getterSetter->setSetter(setterFunction);
     
    341341    }
    342342
    343     m_structureID->propertyMap().setHasGetterSetterProperties(true);
     343    m_structureID->setHasGetterSetterProperties(true);
    344344    getterSetter->setSetter(setterFunction);
    345345}
  • trunk/JavaScriptCore/kjs/JSObject.h

    r37388 r37400  
    153153        void removeDirect(const Identifier& propertyName);
    154154        bool hasCustomProperties() { return !m_structureID->propertyMap().isEmpty(); }
    155         bool hasGetterSetterProperties() { return m_structureID->propertyMap().hasGetterSetterProperties(); }
     155        bool hasGetterSetterProperties() { return m_structureID->hasGetterSetterProperties(); }
    156156
    157157        void putDirect(const Identifier& propertyName, JSValue* value, unsigned attr = 0);
     
    314314    unsigned attributes;
    315315    if (JSValue** location = getDirectLocation(propertyName, attributes)) {
    316         if (m_structureID->propertyMap().hasGetterSetterProperties() && location[0]->isGetterSetter()) {
     316        if (m_structureID->hasGetterSetterProperties() && location[0]->isGetterSetter()) {
    317317            slotIsWriteable = false;
    318318            fillGetterPropertySlot(slot, location);
     
    340340{
    341341    if (JSValue** location = getDirectLocation(propertyName)) {
    342         if (m_structureID->propertyMap().hasGetterSetterProperties() && location[0]->isGetterSetter())
     342        if (m_structureID->hasGetterSetterProperties() && location[0]->isGetterSetter())
    343343            fillGetterPropertySlot(slot, location);
    344344        else
  • trunk/JavaScriptCore/kjs/PropertyMap.h

    r37388 r37400  
    9595        PropertyMap& operator=(const PropertyMap&);
    9696
    97 
    9897        size_t get(const Identifier& propertyName);
    9998        size_t get(const Identifier& propertyName, unsigned& attributes);
     
    102101
    103102        void getEnumerablePropertyNames(PropertyNameArray&) const;
    104 
    105         bool hasGetterSetterProperties() const { return m_getterSetterFlag; }
    106         void setHasGetterSetterProperties(bool f) { m_getterSetterFlag = f; }
    107103
    108104        bool isEmpty() { return !m_table; }
  • trunk/JavaScriptCore/kjs/StructureID.cpp

    r37388 r37400  
    4040    : m_typeInfo(typeInfo)
    4141    , m_isDictionary(false)
     42    , m_hasGetterSetterProperties(false)
    4243    , m_prototype(prototype)
    4344    , m_cachedPrototypeChain(0)
     
    139140    transition->m_propertyMap = structureID->m_propertyMap;
    140141    transition->m_propertyStorageCapacity = structureID->m_propertyStorageCapacity;
     142    transition->m_hasGetterSetterProperties = structureID->m_hasGetterSetterProperties;
    141143
    142144    offset = transition->m_propertyMap.put(propertyName, attributes);
     
    158160    transition->m_propertyMap = structureID->m_propertyMap;
    159161    transition->m_propertyStorageCapacity = structureID->m_propertyStorageCapacity;
     162    transition->m_hasGetterSetterProperties = structureID->m_hasGetterSetterProperties;
    160163    return transition.release();
    161164}
     
    178181    transition->m_propertyMap = structureID->m_propertyMap;
    179182    transition->m_propertyStorageCapacity = structureID->m_propertyStorageCapacity;
     183    transition->m_hasGetterSetterProperties = structureID->m_hasGetterSetterProperties;
    180184    return transition.release();
    181185}
     
    187191    transition->m_propertyMap = structureID->m_propertyMap;
    188192    transition->m_propertyStorageCapacity = structureID->m_propertyStorageCapacity;
     193    transition->m_hasGetterSetterProperties = transition->m_hasGetterSetterProperties;
    189194    return transition.release();
    190195}
  • trunk/JavaScriptCore/kjs/StructureID.h

    r37388 r37400  
    125125        void clearEnumerationCache();
    126126
     127        bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; }
     128        void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; }
     129
    127130    private:
    128131        typedef std::pair<RefPtr<UString::Rep>, unsigned> TransitionTableKey;
     
    136139
    137140        bool m_isDictionary;
     141
     142        bool m_hasGetterSetterProperties;
    138143
    139144        JSValue* m_prototype;
Note: See TracChangeset for help on using the changeset viewer.