Ignore:
Timestamp:
Sep 10, 2008, 7:42:18 PM (17 years ago)
Author:
[email protected]
Message:

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

Reviewed by Geoff Garen.

Add inline property storage for JSObject.

1.2% progression on Sunspider. .5% progression on the v8 test suite.

  • JavaScriptCore.exp:
  • VM/CTI.cpp: (JSC::CTI::privateCompileGetByIdProto): (JSC::CTI::privateCompileGetByIdChain):
  • kjs/JSObject.cpp: (JSC::JSObject::mark): There is no reason to check storageSize now that we start from 0. (JSC::JSObject::allocatePropertyStorage): Allocates/reallocates heap storage.
  • kjs/JSObject.h: (JSC::JSObject::offsetForLocation): m_propertyStorage is not an OwnArrayPtr now so there is no reason to .get() (JSC::JSObject::usingInlineStorage): (JSC::JSObject::JSObject): Start with m_propertyStorage pointing to the inline storage. (JSC::JSObject::~JSObject): Free the heap storage if not using the inline storage. (JSC::JSObject::putDirect): Switch to the heap storage only when we know we know that we are about to add a property that will overflow the inline storage.
  • kjs/PropertyMap.cpp: (JSC::PropertyMap::createTable): Don't allocate the propertyStorage, that is now handled by JSObject. (JSC::PropertyMap::rehash): PropertyStorage is not a OwnArrayPtr anymore.
  • kjs/PropertyMap.h: (JSC::PropertyMap::storageSize): Rename from markingCount.
  • kjs/StructureID.cpp: (JSC::StructureID::addPropertyTransition): Don't resize the property storage if we are using inline storage.
  • kjs/StructureID.h:
File:
1 edited

Legend:

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

    r36310 r36325  
    7171    m_structureID->mark();
    7272
    73     unsigned storageSize = m_structureID->propertyMap().markingCount();
    74     if (storageSize) {
    75         for (unsigned i = 0; i < storageSize; ++i) {
    76             JSValue* v = m_propertyStorage[i];
    77             if (!v->marked())
    78                 v->mark();
    79         }
     73    unsigned storageSize = m_structureID->propertyMap().storageSize();
     74    for (unsigned i = 0; i < storageSize; ++i) {
     75        JSValue* v = m_propertyStorage[i];
     76        if (!v->marked())
     77            v->mark();
    8078    }
    8179
     
    529527}
    530528
     529void JSObject::allocatePropertyStorage(size_t oldSize, size_t newSize)
     530{
     531    JSValue** oldPropertStorage = m_propertyStorage;
     532    m_propertyStorage = new JSValue*[newSize];
     533
     534    for (unsigned i = 0; i < oldSize; ++i)
     535        m_propertyStorage[i] = oldPropertStorage[i];
     536
     537    if (oldPropertStorage != m_inlineStorage)
     538        delete oldPropertStorage;
     539}
     540
    531541JSObject* constructEmptyObject(ExecState* exec)
    532542{
Note: See TracChangeset for help on using the changeset viewer.