Commit 79513969 authored by weinig@apple.com's avatar weinig@apple.com

2009-01-28 Sam Weinig <sam@webkit.org>

        Reviewed by Geoff Garen.

        Initial patch by Mark Rowe.

        <rdar://problem/6519356>
        REGRESSION (r36006): "out of memory" alert running dromaeo on Windows

        Report the cost of the ArrayStorage vector more accurately/often.

        * runtime/JSArray.cpp:
        (JSC::JSArray::JSArray): Report the extra cost even for a filled array
        because JSString using the single character optimization and immediates
        wont increase the cost themselves. 
        (JSC::JSArray::putSlowCase): Update the cost when increasing the size of
        the array.
        (JSC::JSArray::increaseVectorLength): Ditto.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@40339 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent dce44adc
2009-01-28 Sam Weinig <sam@webkit.org>
Reviewed by Geoff Garen.
Initial patch by Mark Rowe.
<rdar://problem/6519356>
REGRESSION (r36006): "out of memory" alert running dromaeo on Windows
Report the cost of the ArrayStorage vector more accurately/often.
* runtime/JSArray.cpp:
(JSC::JSArray::JSArray): Report the extra cost even for a filled array
because JSString using the single character optimization and immediates
wont increase the cost themselves.
(JSC::JSArray::putSlowCase): Update the cost when increasing the size of
the array.
(JSC::JSArray::increaseVectorLength): Ditto.
2009-01-28 Sam Weinig <sam@webkit.org>
Reviewed by Geoff Garen.
......@@ -175,8 +175,7 @@ JSArray::JSArray(ExecState* exec, PassRefPtr<Structure> structure, const ArgList
m_storage = storage;
// When the array is created non-empty, its cells are filled, so it's really no worse than
// a property map. Therefore don't report extra memory cost.
Heap::heap(this)->reportExtraMemoryCost(storageSize(length));
checkConsistency();
}
......@@ -349,6 +348,9 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValuePtr v
}
unsigned vectorLength = storage->m_vectorLength;
Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength));
if (newNumValuesInVector == storage->m_numValuesInVector + 1) {
for (unsigned j = vectorLength; j < newVectorLength; ++j)
storage->m_vector[j] = noValue();
......@@ -462,6 +464,7 @@ bool JSArray::increaseVectorLength(unsigned newLength)
if (!storage)
return false;
Heap::heap(this)->reportExtraMemoryCost(storageSize(newVectorLength) - storageSize(vectorLength));
storage->m_vectorLength = newVectorLength;
for (unsigned i = vectorLength; i < newVectorLength; ++i)
......
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