Ignore:
Timestamp:
Oct 21, 2007, 8:12:08 AM (18 years ago)
Author:
darin
Message:

Reviewed by Maciej.


Speeds up SunSpider by 10%.

  • kjs/array_object.cpp: (allocateStorage): Leave room for an additional pointer. (reallocateStorage): Ditto. (freeStorage): Ditto. (ArrayInstance::~ArrayInstance): Delete the overflow map if present. (ArrayInstance::getItem): Read values from the overflow map if present. Removed the check of length, since it slows down the common case. (ArrayInstance::getOwnPropertySlot): Ditto. Also removed the fallback to the property map. (ArrayInstance::put): Write values into the overflow map as needed. Also create overflow map when needed. (ArrayInstance::deleteProperty): Remove values from the overflow map as appropriate. (ArrayInstance::getPropertyNames): Add a name for each identifier in the property map. This is extremely inefficient. (ArrayInstance::setLength): Remove any values in the overflow map that are past the new length, as we formerly did with the property map. (ArrayInstance::mark): Mark any values in the overflow map. (compareByStringForQSort): Removed unneeded undefined case, since compactForSorting guarantees we will have no undefined values. (compareWithCompareFunctionForQSort): Ditto. (ArrayInstance::compactForSorting): Copy all the values out of the overflow map and destroy it.
  • kjs/property_map.h: Removed now-unused getSparseArrayPropertyNames.
  • kjs/property_map.cpp: Ditto.
File:
1 edited

Legend:

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

    r26688 r26847  
    621621}
    622622
    623 void PropertyMap::getSparseArrayPropertyNames(PropertyNameArray& propertyNames) const
    624 {
    625     if (!m_usingTable) {
    626 #if USE_SINGLE_ENTRY
    627         UString::Rep *key = m_singleEntryKey;
    628         if (key) {
    629             UString k(key);
    630             bool fitsInUInt32;
    631             k.toUInt32(&fitsInUInt32);
    632             if (fitsInUInt32)
    633                 propertyNames.add(Identifier(key));
    634         }
    635 #endif
    636         return;
    637     }
    638 
    639     int size = m_u.table->size;
    640     Entry *entries = m_u.table->entries;
    641     for (int i = 0; i != size; ++i) {
    642         UString::Rep *key = entries[i].key;
    643         if (isValid(key)) {
    644             UString k(key);
    645             bool fitsInUInt32;
    646             k.toUInt32(&fitsInUInt32);
    647             if (fitsInUInt32)
    648                 propertyNames.add(Identifier(key));
    649         }
    650     }
    651 }
    652 
    653623void PropertyMap::save(SavedProperties &p) const
    654624{
Note: See TracChangeset for help on using the changeset viewer.