Ignore:
Timestamp:
Oct 5, 2008, 5:58:42 PM (17 years ago)
Author:
[email protected]
Message:

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

Reviewed by Maciej Stachowiak.

Avoid an extra lookup when transitioning to an existing StructureID
by caching the offset of property that caused the transition.

1% win on V8 suite. Wash on SunSpider.

  • kjs/PropertyMap.cpp: (JSC::PropertyMap::put):
  • kjs/PropertyMap.h:
  • kjs/StructureID.cpp: (JSC::StructureID::StructureID): (JSC::StructureID::addPropertyTransition):
  • kjs/StructureID.h: (JSC::StructureID::setCachedTransistionOffset): (JSC::StructureID::cachedTransistionOffset):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/PropertyMap.cpp

    r36847 r37321  
    115115}
    116116
    117 void PropertyMap::put(const Identifier& propertyName, JSValue* value, unsigned attributes, bool checkReadOnly, JSObject* slotBase, PutPropertySlot& slot, PropertyStorage& propertyStorage)
     117size_t PropertyMap::put(const Identifier& propertyName, JSValue* value, unsigned attributes, bool checkReadOnly, JSObject* slotBase, PutPropertySlot& slot, PropertyStorage& propertyStorage)
    118118{
    119119    ASSERT(!propertyName.isNull());
     
    145145        if (m_table->entries()[entryIndex - 1].key == rep) {
    146146            if (checkReadOnly && (m_table->entries()[entryIndex - 1].attributes & ReadOnly))
    147                 return;
     147                return WTF::notFound;
    148148            // Put a new value in an existing hash table entry.
    149149            propertyStorage[entryIndex - 2] = value;
    150150            // Attributes are intentionally not updated.
    151151            slot.setExistingProperty(slotBase, entryIndex - 2);
    152             return;
     152            return entryIndex - 2;
    153153        } else if (entryIndex == deletedSentinelIndex) {
    154154            // If we find a deleted-element sentinel, remember it for use later.
     
    203203    checkConsistency(propertyStorage);
    204204    slot.setNewProperty(slotBase, entryIndex - 2);
     205    return entryIndex - 2;
    205206}
    206207
Note: See TracChangeset for help on using the changeset viewer.