Changeset 37989 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Oct 29, 2008, 7:44:46 PM (17 years ago)
Author:
[email protected]
Message:

2008-10-29 Sam Weinig <[email protected]>

Reviewed by Oliver Hunt.

Remove direct use of PropertyMap.

  • JavaScriptCore.exp:
  • runtime/JSObject.cpp: (JSC::JSObject::mark): (JSC::JSObject::put): (JSC::JSObject::deleteProperty): (JSC::JSObject::getPropertyAttributes): (JSC::JSObject::removeDirect):
  • runtime/JSObject.h: (JSC::JSObject::getDirect): (JSC::JSObject::getDirectLocation): (JSC::JSObject::hasCustomProperties): (JSC::JSObject::JSObject): (JSC::JSObject::putDirect):
  • runtime/PropertyMap.cpp: (JSC::PropertyMap::get):
  • runtime/PropertyMap.h: (JSC::PropertyMap::isEmpty): (JSC::PropertyMap::get):
  • runtime/StructureID.cpp: (JSC::StructureID::dumpStatistics):
  • runtime/StructureID.h: (JSC::StructureID::propertyStorageSize): (JSC::StructureID::get): (JSC::StructureID::put): (JSC::StructureID::remove): (JSC::StructureID::isEmpty):
Location:
trunk/JavaScriptCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r37985 r37989  
     12008-10-29  Sam Weinig  <[email protected]>
     2
     3        Reviewed by Oliver Hunt.
     4
     5        Remove direct use of PropertyMap.
     6
     7        * JavaScriptCore.exp:
     8        * runtime/JSObject.cpp:
     9        (JSC::JSObject::mark):
     10        (JSC::JSObject::put):
     11        (JSC::JSObject::deleteProperty):
     12        (JSC::JSObject::getPropertyAttributes):
     13        (JSC::JSObject::removeDirect):
     14        * runtime/JSObject.h:
     15        (JSC::JSObject::getDirect):
     16        (JSC::JSObject::getDirectLocation):
     17        (JSC::JSObject::hasCustomProperties):
     18        (JSC::JSObject::JSObject):
     19        (JSC::JSObject::putDirect):
     20        * runtime/PropertyMap.cpp:
     21        (JSC::PropertyMap::get):
     22        * runtime/PropertyMap.h:
     23        (JSC::PropertyMap::isEmpty):
     24        (JSC::PropertyMap::get):
     25        * runtime/StructureID.cpp:
     26        (JSC::StructureID::dumpStatistics):
     27        * runtime/StructureID.h:
     28        (JSC::StructureID::propertyStorageSize):
     29        (JSC::StructureID::get):
     30        (JSC::StructureID::put):
     31        (JSC::StructureID::remove):
     32        (JSC::StructureID::isEmpty):
     33
    1342008-10-29  Sam Weinig  <[email protected]>
    235
  • trunk/JavaScriptCore/JavaScriptCore.exp

    r37970 r37989  
    110110__ZN3JSC11ProfileNode4sortEPFbRKN3WTF6RefPtrIS0_EES5_E
    111111__ZN3JSC11ProgramNode6createEPNS_12JSGlobalDataEPNS_14SourceElementsEPN3WTF6VectorISt4pairINS_10IdentifierEjELm16EEEPNS6_INS5_6RefPtrINS_12FuncDeclNodeEEELm16EEERKNS_10SourceCodeEji
    112 __ZN3JSC11PropertyMap3getERKNS_10IdentifierERj
    113112__ZN3JSC11PropertyMap3putERKNS_10IdentifierEj
    114113__ZN3JSC11PropertyMapD1Ev
     
    305304__ZN3WTF8CollatorD1Ev
    306305__ZN3WTF8fastFreeEPv
     306__ZNK3JSC11PropertyMap3getERKNS_10IdentifierERj
    307307__ZNK3JSC12DateInstance7getTimeERdRi
    308308__ZNK3JSC12StringObject12toThisStringEPNS_9ExecStateE
  • trunk/JavaScriptCore/runtime/JSObject.cpp

    r37938 r37989  
    7070    m_structureID->mark();
    7171
    72     unsigned storageSize = m_structureID->propertyMap().storageSize();
    73     for (unsigned i = 0; i < storageSize; ++i) {
     72    size_t storageSize = m_structureID->propertyStorageSize();
     73    for (size_t i = 0; i < storageSize; ++i) {
    7474        JSValue* v = m_propertyStorage[i];
    7575        if (!v->marked())
     
    134134   
    135135    unsigned attributes;
    136     if ((m_structureID->propertyMap().get(propertyName, attributes) != WTF::notFound) && attributes & ReadOnly)
     136    if ((m_structureID->get(propertyName, attributes) != WTF::notFound) && attributes & ReadOnly)
    137137        return;
    138138
     
    200200{
    201201    unsigned attributes;
    202     if (m_structureID->propertyMap().get(propertyName, attributes) != WTF::notFound) {
     202    if (m_structureID->get(propertyName, attributes) != WTF::notFound) {
    203203        if ((attributes & DontDelete))
    204204            return false;
     
    410410bool JSObject::getPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const
    411411{
    412     if (m_structureID->propertyMap().get(propertyName, attributes) != WTF::notFound)
     412    if (m_structureID->get(propertyName, attributes) != WTF::notFound)
    413413        return true;
    414414   
     
    468468    size_t offset;
    469469    if (m_structureID->isDictionary()) {
    470         offset = m_structureID->propertyMap().remove(propertyName);
     470        offset = m_structureID->remove(propertyName);
    471471        if (offset != WTF::notFound) {
    472472            m_propertyStorage[offset] = jsUndefined();
     
    477477
    478478    RefPtr<StructureID> structureID = StructureID::toDictionaryTransition(m_structureID);
    479     offset = structureID->propertyMap().remove(propertyName);
     479    offset = structureID->remove(propertyName);
    480480    if (offset != WTF::notFound)
    481481        m_propertyStorage[offset] = jsUndefined();
  • trunk/JavaScriptCore/runtime/JSObject.h

    r37938 r37989  
    2929#include "ExecState.h"
    3030#include "JSNumberCell.h"
    31 #include "PropertyMap.h"
    3231#include "PropertySlot.h"
    3332#include "PutPropertySlot.h"
     
    5352    };
    5453
     54    typedef JSValue** PropertyStorage;
     55
    5556    class JSObject : public JSCell {
    5657        friend class BatchedTransitionOptimizer;
     
    124125        JSValue* getDirect(const Identifier& propertyName) const
    125126        {
    126             size_t offset = m_structureID->propertyMap().get(propertyName);
     127            size_t offset = m_structureID->get(propertyName);
    127128            return offset != WTF::notFound ? m_propertyStorage[offset] : noValue();
    128129        }
     
    130131        JSValue** getDirectLocation(const Identifier& propertyName)
    131132        {
    132             size_t offset = m_structureID->propertyMap().get(propertyName);
     133            size_t offset = m_structureID->get(propertyName);
    133134            return offset != WTF::notFound ? locationForOffset(offset) : 0;
    134135        }
     
    136137        JSValue** getDirectLocation(const Identifier& propertyName, unsigned& attributes)
    137138        {
    138             size_t offset = m_structureID->propertyMap().get(propertyName, attributes);
     139            size_t offset = m_structureID->get(propertyName, attributes);
    139140            return offset != WTF::notFound ? locationForOffset(offset) : 0;
    140141        }
     
    153154
    154155        void removeDirect(const Identifier& propertyName);
    155         bool hasCustomProperties() { return !m_structureID->propertyMap().isEmpty(); }
     156        bool hasCustomProperties() { return !m_structureID->isEmpty(); }
    156157        bool hasGetterSetterProperties() { return m_structureID->hasGetterSetterProperties(); }
    157158
     
    221222    ASSERT(m_structureID);
    222223    ASSERT(m_structureID->propertyStorageCapacity() == inlineStorageCapacity);
    223     ASSERT(m_structureID->propertyMap().isEmpty());
     224    ASSERT(m_structureID->isEmpty());
    224225    ASSERT(prototype()->isNull() || Heap::heap(this) == Heap::heap(prototype()));
    225226}
     
    389390    if (m_structureID->isDictionary()) {
    390391        unsigned currentAttributes;
    391         size_t offset = m_structureID->propertyMap().get(propertyName, currentAttributes);
     392        size_t offset = m_structureID->get(propertyName, currentAttributes);
    392393        if (offset != WTF::notFound) {
    393394            if (checkReadOnly && currentAttributes & ReadOnly)
     
    399400
    400401        size_t currentCapacity = m_structureID->propertyStorageCapacity();
    401         offset = m_structureID->propertyMap().put(propertyName, attributes);
    402         if (m_structureID->propertyMap().storageSize() > m_structureID->propertyStorageCapacity()) {
     402        offset = m_structureID->put(propertyName, attributes);
     403        if (m_structureID->propertyStorageSize() > m_structureID->propertyStorageCapacity()) {
    403404            m_structureID->growPropertyStorageCapacity();
    404405            allocatePropertyStorage(currentCapacity, m_structureID->propertyStorageCapacity());
     
    412413
    413414    unsigned currentAttributes;
    414     size_t offset = m_structureID->propertyMap().get(propertyName, currentAttributes);
     415    size_t offset = m_structureID->get(propertyName, currentAttributes);
    415416    if (offset != WTF::notFound) {
    416417        if (checkReadOnly && currentAttributes & ReadOnly)
  • trunk/JavaScriptCore/runtime/JSVariableObject.cpp

    r37938 r37989  
    3131
    3232#include "PropertyNameArray.h"
    33 #include "PropertyMap.h"
    3433
    3534namespace JSC {
  • trunk/JavaScriptCore/runtime/PropertyMap.cpp

    r37938 r37989  
    271271}
    272272
    273 size_t PropertyMap::get(const Identifier& propertyName, unsigned& attributes)
     273size_t PropertyMap::get(const Identifier& propertyName, unsigned& attributes) const
    274274{
    275275    ASSERT(!propertyName.isNull());
  • trunk/JavaScriptCore/runtime/PropertyMap.h

    r37981 r37989  
    9494        PropertyMap& operator=(const PropertyMap&);
    9595
    96         size_t get(const Identifier& propertyName);
    97         size_t get(const Identifier& propertyName, unsigned& attributes);
     96        size_t get(const Identifier& propertyName) const;
     97        size_t get(const Identifier& propertyName, unsigned& attributes) const;
    9898        size_t put(const Identifier& propertyName, unsigned attributes);
    9999        size_t remove(const Identifier& propertyName);
     
    101101        void getEnumerablePropertyNames(PropertyNameArray&) const;
    102102
    103         bool isEmpty() { return !m_table; }
     103        bool isEmpty() const { return !m_table; }
    104104        unsigned storageSize() const { return m_table ? m_table->keyCount + m_deletedOffsets.size() : 0; }
    105105
     
    133133    }
    134134
    135     inline size_t PropertyMap::get(const Identifier& propertyName)
     135    inline size_t PropertyMap::get(const Identifier& propertyName) const
    136136    {
    137137        ASSERT(!propertyName.isNull());
  • trunk/JavaScriptCore/runtime/StructureID.cpp

    r37985 r37989  
    7676        }
    7777
    78         totalPropertyMapsSize += structureID->propertyMap().propertyMapSize();
     78        totalPropertyMapsSize += structureID->m_propertyMap.propertyMapSize();
    7979    }
    8080
  • trunk/JavaScriptCore/runtime/StructureID.h

    r37985 r37989  
    9797        StructureIDChain* cachedPrototypeChain() const { return m_cachedPrototypeChain.get(); }
    9898
    99         const PropertyMap& propertyMap() const { return m_propertyMap; }
    100         PropertyMap& propertyMap() { return m_propertyMap; }
    101 
    10299        void setCachedTransistionOffset(size_t offset) { m_cachedTransistionOffset = offset; }
    103100        size_t cachedTransistionOffset() const { return m_cachedTransistionOffset; }
     
    105102        void growPropertyStorageCapacity();
    106103        size_t propertyStorageCapacity() const { return m_propertyStorageCapacity; }
     104        size_t propertyStorageSize() const { return m_propertyMap.storageSize(); }
     105
     106        size_t get(const Identifier& propertyName) const { return m_propertyMap.get(propertyName); }
     107        size_t get(const Identifier& propertyName, unsigned& attributes) const { return m_propertyMap.get(propertyName, attributes); }
     108        size_t put(const Identifier& propertyName, unsigned attributes) { return m_propertyMap.put(propertyName, attributes); }
     109        size_t remove(const Identifier& propertyName) { return m_propertyMap.remove(propertyName); }
    107110
    108111        void getEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*);
     
    112115        void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; }
    113116
     117        bool isEmpty() const { return m_propertyMap.isEmpty(); }
     118
    114119    private:
    115120        StructureID(JSValue* prototype, const TypeInfo&);
    116        
     121
    117122        static const size_t s_maxTransitionLength = 64;
    118123
Note: See TracChangeset for help on using the changeset viewer.