Changeset 47159 in webkit


Ignore:
Timestamp:
Aug 12, 2009 4:07:08 PM (15 years ago)
Author:
adachan@apple.com
Message:

Added workaround for the limitation that VirtualFree with MEM_RELEASE
can only accept the base address returned by VirtualAlloc when the region
was reserved and it can only free the entire region, and not a part of it.

Reviewed by Oliver Hunt.

  • runtime/MarkStack.h: (JSC::MarkStack::MarkStackArray::shrinkAllocation):
  • runtime/MarkStackWin.cpp: (JSC::MarkStack::releaseStack):
Location:
trunk/JavaScriptCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r47102 r47159  
     12009-08-12  Ada Chan  <adachan@apple.com>
     2
     3        Added workaround for the limitation that VirtualFree with MEM_RELEASE
     4        can only accept the base address returned by VirtualAlloc when the region
     5        was reserved and it can only free the entire region, and not a part of it.
     6
     7        Reviewed by Oliver Hunt.
     8
     9        * runtime/MarkStack.h:
     10        (JSC::MarkStack::MarkStackArray::shrinkAllocation):
     11        * runtime/MarkStackWin.cpp:
     12        (JSC::MarkStack::releaseStack):
     13
    1142009-08-12  Balazs Kelemen  <kelemen.balazs.3@stud.u-szeged.hu>
    215
  • trunk/JavaScriptCore/runtime/MarkStack.h

    r47023 r47159  
    151151                if (size == m_allocated)
    152152                    return;
     153#if PLATFORM(WIN)
     154                // We cannot release a part of a region with VirtualFree.  To get around this,
     155                // we'll release the entire region and reallocate the size that we want.
     156                releaseStack(m_data, m_allocated);
     157                m_data = reinterpret_cast<T*>(allocateStack(size));
     158#else
    153159                releaseStack(reinterpret_cast<char*>(m_data) + size, m_allocated - size);
     160#endif
    154161                m_allocated = size;
    155162                m_capacity = m_allocated / sizeof(T);
  • trunk/JavaScriptCore/runtime/MarkStackWin.cpp

    r47023 r47159  
    4444    return VirtualAlloc(0, size, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE);
    4545}
    46 void MarkStack::releaseStack(void* addr, size_t size)
     46void MarkStack::releaseStack(void* addr, size_t)
    4747{
    48     VirtualFree(addr, size, MEM_RELEASE);
     48    // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
     49    // dwSize must be 0 if dwFreeType is MEM_RELEASE.
     50    VirtualFree(addr, 0, MEM_RELEASE);
    4951}
    5052
Note: See TracChangeset for help on using the changeset viewer.