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

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

Reviewed by Darin Adler.

Patch for https://bugs.webkit.org/show_bug.cgi?id=20928
Speed up JS property enumeration by caching entire PropertyNameArray

1.3% speedup on Sunspider, 30% on string-fasta.

  • JavaScriptCore.exp:
  • VM/JSPropertyNameIterator.cpp: (JSC::JSPropertyNameIterator::~JSPropertyNameIterator): (JSC::JSPropertyNameIterator::invalidate):
  • VM/JSPropertyNameIterator.h: (JSC::JSPropertyNameIterator::JSPropertyNameIterator): (JSC::JSPropertyNameIterator::create):
  • kjs/JSObject.cpp: (JSC::JSObject::getPropertyNames):
  • kjs/PropertyMap.cpp: (JSC::PropertyMap::getEnumerablePropertyNames):
  • kjs/PropertyMap.h:
  • kjs/PropertyNameArray.cpp: (JSC::PropertyNameArray::add):
  • kjs/PropertyNameArray.h: (JSC::PropertyNameArrayData::create): (JSC::PropertyNameArrayData::propertyNameVector): (JSC::PropertyNameArrayData::setCachedPrototypeChain): (JSC::PropertyNameArrayData::cachedPrototypeChain): (JSC::PropertyNameArrayData::begin): (JSC::PropertyNameArrayData::end): (JSC::PropertyNameArrayData::PropertyNameArrayData): (JSC::PropertyNameArray::PropertyNameArray): (JSC::PropertyNameArray::addKnownUnique): (JSC::PropertyNameArray::size): (JSC::PropertyNameArray::operator[]): (JSC::PropertyNameArray::begin): (JSC::PropertyNameArray::end): (JSC::PropertyNameArray::setData): (JSC::PropertyNameArray::data): (JSC::PropertyNameArray::releaseData):
  • kjs/ScopeChain.cpp: (JSC::ScopeChainNode::print):
  • kjs/StructureID.cpp: (JSC::structureIDChainsAreEqual): (JSC::StructureID::getEnumerablePropertyNames): (JSC::StructureID::clearEnumerationCache): (JSC::StructureID::createCachedPrototypeChain):
  • kjs/StructureID.h:
File:
1 edited

Legend:

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

    r36693 r36694  
    433433void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
    434434{
    435     m_structureID->getEnumerablePropertyNames(propertyNames);
    436 
    437     // Add properties from the static hashtables of properties
    438     for (const ClassInfo* info = classInfo(); info; info = info->parentClass) {
    439         const HashTable* table = info->propHashTable(exec);
    440         if (!table)
    441             continue;
    442         table->initializeIfNeeded(exec);
    443         ASSERT(table->table);
    444         int hashSizeMask = table->hashSizeMask;
    445         const HashEntry* entry = table->table;
    446         for (int i = 0; i <= hashSizeMask; ++i, ++entry) {
    447             if (entry->key && !(entry->attributes & DontEnum))
    448                 propertyNames.add(entry->key);
    449         }
    450     }
    451 
    452     if (prototype()->isObject())
    453         static_cast<JSObject*>(prototype())->getPropertyNames(exec, propertyNames);
     435    m_structureID->getEnumerablePropertyNames(exec, propertyNames, this);
    454436}
    455437
Note: See TracChangeset for help on using the changeset viewer.