2010-08-25 Michael Saboff <msaboff@apple.com>

        Reviewed by Geoffrey Garen.

        Changed the initial and subsequent allocation of vector storage to
        Array()s. The changes are to limit sparse arrays to 100000 entries
        and fixed the sparse map to vector storage conversion to use the
        minimum amount of memory needed to store the current number of entries.
        These changes address https://bugs.webkit.org/show_bug.cgi?id=43707

        * runtime/JSArray.cpp:
        (JSC::JSArray::putSlowCase):
        (JSC::JSArray::getNewVectorLength):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@66004 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f0a83476
2010-08-25 Michael Saboff <msaboff@apple.com>
Reviewed by Geoffrey Garen.
Changed the initial and subsequent allocation of vector storage to
Array()s. The changes are to limit sparse arrays to 100000 entries
and fixed the sparse map to vector storage conversion to use the
minimum amount of memory needed to store the current number of entries.
These changes address https://bugs.webkit.org/show_bug.cgi?id=43707
* runtime/JSArray.cpp:
(JSC::JSArray::putSlowCase):
(JSC::JSArray::getNewVectorLength):
2010-08-16 Gabor Loki <loki@webkit.org>
Reviewed by Gavin Barraclough.
......
......@@ -421,9 +421,10 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu
if (i >= MIN_SPARSE_ARRAY_INDEX)
newNumValuesInVector -= map->contains(i);
if (isDenseEnoughForVector(newVectorLength, newNumValuesInVector)) {
unsigned needLength = max(i + 1, storage->m_length);
unsigned proposedNewNumValuesInVector = newNumValuesInVector;
// If newVectorLength is already the maximum - MAX_STORAGE_VECTOR_LENGTH - then do not attempt to grow any further.
while (newVectorLength < MAX_STORAGE_VECTOR_LENGTH) {
while ((newVectorLength < needLength) && (newVectorLength < MAX_STORAGE_VECTOR_LENGTH)) {
unsigned proposedNewVectorLength = getNewVectorLength(newVectorLength + 1);
for (unsigned j = max(newVectorLength, MIN_SPARSE_ARRAY_INDEX); j < proposedNewVectorLength; ++j)
proposedNewNumValuesInVector += map->contains(j);
......@@ -553,10 +554,10 @@ ALWAYS_INLINE unsigned JSArray::getNewVectorLength(unsigned desiredLength)
ASSERT(desiredLength <= MAX_STORAGE_VECTOR_LENGTH);
unsigned increasedLength;
unsigned length = m_storage->m_length;
unsigned maxInitLength = min(m_storage->m_length, 100000U);
if (desiredLength < length)
increasedLength = length;
if (desiredLength < maxInitLength)
increasedLength = maxInitLength;
else if (!m_vectorLength)
increasedLength = max(desiredLength, lastArraySize);
else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment