Changeset 37381 in webkit for trunk/JavaScriptCore/kjs/JSObject.h


Ignore:
Timestamp:
Oct 7, 2008, 11:17:37 AM (17 years ago)
Author:
[email protected]
Message:

2008-10-07 Cameron Zwarich <[email protected]>

Rubber-stamped by Mark Rowe.

Roll out r37370.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/JSObject.h

    r37370 r37381  
    123123        JSValue* getDirect(const Identifier& propertyName) const
    124124        {
    125             size_t offset = m_structureID->propertyMap().get(propertyName);
     125            size_t offset = m_structureID->propertyMap().getOffset(propertyName);
    126126            return offset != WTF::notFound ? m_propertyStorage[offset] : 0;
    127127        }
     
    129129        JSValue** getDirectLocation(const Identifier& propertyName)
    130130        {
    131             size_t offset = m_structureID->propertyMap().get(propertyName);
     131            size_t offset = m_structureID->propertyMap().getOffset(propertyName);
    132132            return offset != WTF::notFound ? locationForOffset(offset) : 0;
    133133        }
     
    135135        JSValue** getDirectLocation(const Identifier& propertyName, unsigned& attributes)
    136136        {
    137             size_t offset = m_structureID->propertyMap().get(propertyName, attributes);
     137            size_t offset = m_structureID->propertyMap().getOffset(propertyName, attributes);
    138138            return offset != WTF::notFound ? locationForOffset(offset) : 0;
    139139        }
     
    179179
    180180        static const size_t inlineStorageCapacity = 2;
    181         static const size_t nonInlineBaseStorageCapacity = 16;
    182181
    183182        static PassRefPtr<StructureID> createStructureID(JSValue* proto) { return StructureID::create(proto, TypeInfo(ObjectType)); }
     
    366365    ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this));
    367366
    368     if (m_structureID->isDictionary()) {
    369         unsigned currentAttributes;
    370         size_t offset = m_structureID->propertyMap().get(propertyName, currentAttributes);
    371         if (offset != WTF::notFound) {
    372             if (checkReadOnly && currentAttributes & ReadOnly)
    373                 return;
    374             m_propertyStorage[offset] = value;
    375             slot.setExistingProperty(this, offset);
    376             return;
    377         }
    378 
    379         size_t currentCapacity = m_structureID->propertyStorageCapacity();
    380         offset = m_structureID->propertyMap().put(propertyName, attributes);
    381         if (m_structureID->propertyMap().storageSize() > m_structureID->propertyStorageCapacity()) {
    382             m_structureID->growPropertyStorageCapacity();
    383             allocatePropertyStorage(currentCapacity, m_structureID->propertyStorageCapacity());
    384         }
    385 
    386         m_propertyStorage[offset] = value;
    387         slot.setNewProperty(this, offset);
    388         m_structureID->clearEnumerationCache();
    389         return;
    390     }
     367     if (m_structureID->isDictionary()) {
     368         unsigned currentAttributes;
     369         size_t offset = m_structureID->propertyMap().getOffset(propertyName, currentAttributes);
     370         if (offset != WTF::notFound) {
     371             if (checkReadOnly && currentAttributes & ReadOnly)
     372                 return;
     373             m_propertyStorage[offset] = value;
     374             slot.setExistingProperty(this, offset);
     375             return;
     376         }
     377
     378         if (m_structureID->propertyMap().storageSize() == inlineStorageCapacity)
     379             allocatePropertyStorage(m_structureID->propertyMap().storageSize(), m_structureID->propertyMap().size());
     380         m_structureID->propertyMap().put(propertyName, value, attributes, checkReadOnly, this, slot, m_propertyStorage);
     381         m_structureID->clearEnumerationCache();
     382         return;
     383     }
    391384
    392385    unsigned currentAttributes;
    393     size_t offset = m_structureID->propertyMap().get(propertyName, currentAttributes);
     386    size_t offset = m_structureID->propertyMap().getOffset(propertyName, currentAttributes);
    394387    if (offset != WTF::notFound) {
    395388        if (checkReadOnly && currentAttributes & ReadOnly)
     
    400393    }
    401394
    402     size_t currentCapacity = m_structureID->propertyStorageCapacity();
    403     RefPtr<StructureID> structureID = StructureID::addPropertyTransition(m_structureID, propertyName, attributes, offset);
    404     if (currentCapacity != structureID->propertyStorageCapacity())
    405         allocatePropertyStorage(currentCapacity, structureID->propertyStorageCapacity());
    406 
    407     ASSERT(offset < structureID->propertyStorageCapacity());
    408     m_propertyStorage[offset] = value;
    409     slot.setNewProperty(this, offset);
    410     slot.setWasTransition(true);
    411     setStructureID(structureID.release());
     395     if (m_structureID->propertyMap().storageSize() == inlineStorageCapacity)
     396         allocatePropertyStorage(m_structureID->propertyMap().storageSize(), m_structureID->propertyMap().size());
     397
     398     RefPtr<StructureID> structureID = StructureID::addPropertyTransition(m_structureID, propertyName, value, attributes, this, slot, m_propertyStorage);
     399     slot.setWasTransition(true);
     400     setStructureID(structureID.release());
    412401}
    413402
    414403inline void JSObject::transitionTo(StructureID* newStructureID)
    415404{
    416     if (m_structureID->propertyStorageCapacity() != newStructureID->propertyStorageCapacity())
    417         allocatePropertyStorage(m_structureID->propertyStorageCapacity(), newStructureID->propertyStorageCapacity());
     405    StructureID::transitionTo(m_structureID, newStructureID, this);
    418406    setStructureID(newStructureID);
    419407}
Note: See TracChangeset for help on using the changeset viewer.