Ignore:
Timestamp:
May 25, 2008, 12:15:42 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

Changed regular expression matching result array to be lazily filled, because many callers
only care about it being non-null.

2% improvement on Acid3 test 26.

  • kjs/array_instance.cpp: Added a void* member to ArrayStorage for ArrayInstance subclasses to use.
  • kjs/array_instance.h: (KJS::ArrayInstance::lazyCreationData): (KJS::ArrayInstance::setLazyCreationData): Added methods to access it from subclasses.
  • kjs/regexp_object.cpp: (KJS::RegExpMatchesArray::RegExpMatchesArray): (KJS::RegExpMatchesArray::getOwnPropertySlot): (KJS::RegExpMatchesArray::put): (KJS::RegExpMatchesArray::deleteProperty): (KJS::RegExpMatchesArray::getPropertyNames): (KJS::RegExpMatchesArray::fillArrayInstanceIfNeeded): (KJS::RegExpMatchesArray::~RegExpMatchesArray): (KJS::RegExpObjectImp::arrayOfMatches): RegExpMatchesArray is a subclass of ArrayInstance that isn't filled until accessed for the first time.
File:
1 edited

Legend:

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

    r33967 r34118  
    3737    unsigned m_numValuesInVector;
    3838    SparseArrayValueMap* m_sparseValueMap;
     39    void* lazyCreationData; // An ArrayInstance subclass can use this to fill the vector lazily.
    3940    JSValue* m_vector[1];
    4041};
     
    683684}
    684685
    685 }
     686void* ArrayInstance::lazyCreationData()
     687{
     688    return m_storage->lazyCreationData;
     689}
     690
     691void ArrayInstance::setLazyCreationData(void* d)
     692{
     693    m_storage->lazyCreationData = d;
     694}
     695
     696}
Note: See TracChangeset for help on using the changeset viewer.