Ignore:
Timestamp:
Sep 22, 2008, 7:44:09 PM (17 years ago)
Author:
[email protected]
Message:

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

Reviewed by Maciej Stachowiak.

Patch for https://bugs.webkit.org/show_bug.cgi?id=21014
Speed up for..in by using StructureID to avoid call hasProperty

Speeds up fasta by 8%.

  • VM/JSPropertyNameIterator.cpp: (JSC::JSPropertyNameIterator::invalidate):
  • VM/JSPropertyNameIterator.h: (JSC::JSPropertyNameIterator::next):
  • kjs/PropertyNameArray.h: (JSC::PropertyNameArrayData::begin): (JSC::PropertyNameArrayData::end): (JSC::PropertyNameArrayData::setCachedStructureID): (JSC::PropertyNameArrayData::cachedStructureID):
  • kjs/StructureID.cpp: (JSC::StructureID::getEnumerablePropertyNames): (JSC::structureIDChainsAreEqual):
  • kjs/StructureID.h:
File:
1 edited

Legend:

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

    r36756 r36789  
    5050}
    5151
    52 static bool structureIDChainsAreEqual(StructureIDChain* chainA, StructureIDChain* chainB)
    53 {
    54     if (!chainA || !chainB)
    55         return false;
    56 
    57     RefPtr<StructureID>* a = chainA->head();
    58     RefPtr<StructureID>* b = chainB->head();
    59     while (1) {
    60         if (*a != *b)
    61             return false;
    62         if (!*a)
    63             return true;
    64         a++;
    65         b++;
    66     }
    67 }
    68 
    6952void StructureID::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject)
    7053{
     
    10588            chain = createCachedPrototypeChain();
    10689        m_cachedPropertyNameArrayData->setCachedPrototypeChain(chain);
     90        m_cachedPropertyNameArrayData->setCachedStructureID(this);
    10791    }
    10892}
     
    236220}
    237221
     222bool structureIDChainsAreEqual(StructureIDChain* chainA, StructureIDChain* chainB)
     223{
     224    if (!chainA || !chainB)
     225        return false;
     226
     227    RefPtr<StructureID>* a = chainA->head();
     228    RefPtr<StructureID>* b = chainB->head();
     229    while (1) {
     230        if (*a != *b)
     231            return false;
     232        if (!*a)
     233            return true;
     234        a++;
     235        b++;
     236    }
     237}
     238
    238239} // namespace JSC
Note: See TracChangeset for help on using the changeset viewer.