Ignore:
Timestamp:
Mar 23, 2012, 8:11:45 PM (13 years ago)
Author:
[email protected]
Message:

tryReallocate could break the zero-ed memory invariant of CopiedBlocks
https://bugs.webkit.org/show_bug.cgi?id=82087

Reviewed by Filip Pizlo.

Removing this optimization turned out to be ~1% regression on kraken, so I simply
undid the modification to the current block if we fail.

  • heap/CopiedSpace.cpp:

(JSC::CopiedSpace::tryReallocate): Undid the reset in the CopiedAllocator if we fail
to reallocate from the current block.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/CopiedSpace.cpp

    r111877 r111973  
    101101
    102102    if (m_allocator.wasLastAllocation(oldPtr, oldSize)) {
    103         m_allocator.resetLastAllocation(oldPtr);
    104         if (m_allocator.fitsInCurrentBlock(newSize))
    105             return m_allocator.allocate(newSize);
     103        size_t delta = newSize - oldSize;
     104        if (m_allocator.fitsInCurrentBlock(delta)) {
     105            (void)m_allocator.allocate(delta);
     106            return true;
     107        }
    106108    }
    107109
Note: See TracChangeset for help on using the changeset viewer.