Ignore:
Timestamp:
Apr 23, 2007, 1:53:41 AM (18 years ago)
Author:
mjs
Message:

Reviewed by Darin.



I did this by storing the capacity before the beginning of the storage array. It turns out
it is rarely needed and is by definition 0 when the storage array is null.


  • kjs/array_instance.h: (KJS::ArrayInstance::capacity): Get it from the secret stash
  • kjs/array_object.cpp: (allocateStorage): New function to encapsulate allocating the storage with extra space ahead for the capacity. (reallocateStorage): ditto for realloc (ArrayInstance::ArrayInstance): (ArrayInstance::~ArrayInstance): (ArrayInstance::resizeStorage):
File:
1 edited

Legend:

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

    r16200 r21029  
    6262    void resizeStorage(unsigned);
    6363
     64    // store capacity in extra space at the beginning of the storage array to save space
     65    size_t capacity() { return storage ? reinterpret_cast<size_t>(storage[-1]) : 0; }
     66
    6467    unsigned length;
    6568    unsigned storageLength;
    66     unsigned capacity;
    6769    JSValue **storage;
    6870  };
Note: See TracChangeset for help on using the changeset viewer.