Ignore:
Timestamp:
Sep 14, 2008, 1:18:49 AM (17 years ago)
Author:
[email protected]
Message:

Bug 20821: Cache property transitions to speed up object initialization
https://bugs.webkit.org/show_bug.cgi?id=20821

Reviewed by Cameron Zwarich.

Implement a transition cache to improve the performance of new properties
being added to objects. This is extremely beneficial in constructors and
shows up as a 34% improvement on access-binary-trees in SunSpider (0.8%
overall)

File:
1 edited

Legend:

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

    r36325 r36401  
    4646    ASSERT(m_prototype);
    4747    ASSERT(m_prototype->isObject() || m_prototype->isNull());
     48}
     49
     50void StructureID::transitionTo(StructureID* oldStructureID, StructureID* newStructureID, JSObject* slotBase)
     51{
     52    if (!slotBase->usingInlineStorage() && oldStructureID->m_propertyMap.size() != newStructureID->m_propertyMap.size())
     53        slotBase->allocatePropertyStorage(oldStructureID->m_propertyMap.size(), newStructureID->m_propertyMap.size());
    4854}
    4955
     
    140146    }
    141147   
    142     m_vector.set(new RefPtr<StructureID>[size]);
     148    m_vector.set(new RefPtr<StructureID>[size + 1]);
    143149
    144150    size_t i;
     
    148154    }
    149155    m_vector[i] = structureID;
     156    m_vector[i + 1] = 0;
    150157}
    151158
Note: See TracChangeset for help on using the changeset viewer.