Ignore:
Timestamp:
Dec 3, 2010, 6:05:56 PM (15 years ago)
Author:
[email protected]
Message:

2010-12-03 Oliver Hunt <[email protected]>

Reviewed by Geoff Garen.

Incorrect logic for returning memory at the end of linking.
Reviewed by Geoff Garen.

At the end of linking we return any space at the end of the
allocated executable region that was saved due to branch
compaction. This is currently by done by subtracting the
different from the m_freePtr in the allocation pool. This
can be incorrect if your allocation was made from a new
page that was not selected for subsequent allocations.

This patch corrects this behaviour by verifying that the
memory being returned actually comes from the current
allocation pool.

  • assembler/LinkBuffer.h: (JSC::LinkBuffer::linkCode):
  • jit/ExecutableAllocator.h: (JSC::ExecutablePool::tryShrink):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/ExecutableAllocator.h

    r69135 r73321  
    138138    }
    139139   
    140     void returnLastBytes(size_t count)
    141     {
    142         m_freePtr -= count;
     140    void tryShrink(void* allocation, size_t oldSize, size_t newSize)
     141    {
     142        if (static_cast<char*>(allocation) + oldSize != m_freePtr)
     143            return;
     144        m_freePtr = static_cast<char*>(allocation) + roundUpAllocationSize(newSize, sizeof(void*));
    143145    }
    144146
Note: See TracChangeset for help on using the changeset viewer.