Ignore:
Timestamp:
Jul 2, 2008, 5:47:00 PM (17 years ago)
Author:
[email protected]
Message:

2008-07-02 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.

Optimized a[n] get for cases where a is an array or a string, and a[n]
put for cases where a is an array.


SunSpider says 9.0% faster.

File:
1 edited

Legend:

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

    r34868 r34964  
    3535namespace KJS {
    3636
    37 typedef HashMap<unsigned, JSValue*> SparseArrayValueMap;
    38 
    39 struct ArrayStorage {
    40     unsigned m_vectorLength;
    41     unsigned m_numValuesInVector;
    42     SparseArrayValueMap* m_sparseValueMap;
    43     void* lazyCreationData; // An JSArray subclass can use this to fill the vector lazily.
    44     JSValue* m_vector[1];
    45 };
    46 
    4737// 0xFFFFFFFF is a bit weird -- is not an array index even though it's an integer.
    4838static const unsigned maxArrayIndex = 0xFFFFFFFEU;
     
    8272#endif
    8373
    84 JSArray::JSArray(JSObject* prototype, unsigned initialLength)
     74JSArray::JSArray(JSValue* prototype, unsigned initialLength)
    8575    : JSObject(prototype)
    8676{
Note: See TracChangeset for help on using the changeset viewer.