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/StructureID.cpp

    r37300 r37321  
    4545    , m_nameInPrevious(0)
    4646    , m_transitionCount(0)
     47    , m_cachedTransistionOffset(WTF::notFound)
    4748{
    4849    ASSERT(m_prototype);
     
    117118            slotBase->allocatePropertyStorage(structureID->m_propertyMap.size(), existingTransition->m_propertyMap.size());
    118119
    119         size_t offset = existingTransition->propertyMap().getOffset(propertyName);
     120        size_t offset = existingTransition->cachedTransistionOffset();
    120121        ASSERT(offset != WTF::notFound);
    121122        propertyStorage[offset] = value;
     
    139140    transition->m_propertyMap = structureID->m_propertyMap;
    140141
    141     transition->m_propertyMap.put(propertyName, value, attributes, false, slotBase, slot, propertyStorage);
     142    size_t offset = transition->m_propertyMap.put(propertyName, value, attributes, false, slotBase, slot, propertyStorage);
     143    transition->setCachedTransistionOffset(offset);
    142144
    143145    structureID->m_transitionTable.add(make_pair(propertyName.ustring().rep(), attributes), transition.get());
Note: See TracChangeset for help on using the changeset viewer.