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

    r36314 r36325  
    429429    m_table->sizeMask = newTableSize - 1;
    430430
    431     propertyStorage.set(new JSValue*[m_table->size]);
    432 
    433431    checkConsistency(propertyStorage);
    434432}
     
    441439
    442440    Table* oldTable = m_table;
    443     JSValue** oldPropertStorage = propertyStorage.release();
     441    JSValue** oldPropertStorage = propertyStorage;
    444442
    445443    m_table = static_cast<Table*>(fastZeroedMalloc(Table::allocationSize(newTableSize)));
     
    447445    m_table->sizeMask = newTableSize - 1;
    448446
    449     propertyStorage.set(new JSValue*[m_table->size]);
     447    propertyStorage = new JSValue*[m_table->size];
    450448
    451449    unsigned lastIndexUsed = 0;
     
    461459    fastFree(oldTable);
    462460    delete [] oldPropertStorage;
    463 
    464     checkConsistency(propertyStorage);
    465 }
    466 
    467 void PropertyMap::resizePropertyStorage(PropertyStorage& propertyStorage, unsigned oldSize)
    468 {
    469     ASSERT(m_table);
    470 
    471     if (propertyStorage) {
    472         JSValue** oldPropertStorage = propertyStorage.release();
    473         propertyStorage.set(new JSValue*[m_table->size]);
    474 
    475         // FIXME: this can probalby use memcpy
    476         for (unsigned i = 0; i < oldSize; ++i)
    477             propertyStorage[i] = oldPropertStorage[i];
    478 
    479         delete [] oldPropertStorage;
    480     } else
    481         propertyStorage.set(new JSValue*[m_table->size]);
    482461
    483462    checkConsistency(propertyStorage);
Note: See TracChangeset for help on using the changeset viewer.