Changeset 160063 in webkit


Ignore:
Timestamp:
Dec 3, 2013 6:19:09 PM (10 years ago)
Author:
mark.lam@apple.com
Message:

testapi test crashes on Windows in WTF::Vector<wchar_t,64,WTF::UnsafeVectorOverflow>::size().
https://bugs.webkit.org/show_bug.cgi?id=121972.

Reviewed by Brent Fulgham.

Source/JavaScriptCore:

  • interpreter/JSStack.cpp:

(JSC::JSStack::~JSStack):

  • Reverting the change from r160004 since it's better to fix OSAllocatorWin to be consistent with OSAllocatorPosix.

Source/WTF:

  • wtf/OSAllocatorWin.cpp:

(WTF::OSAllocator::decommit):
(WTF::OSAllocator::releaseDecommitted):

  • Added a check to ensure that the bytes to decommit / release is not 0. On Windows, a 0 length passed to VirtualFree() has a special meaning, and it's not "decommit / release nothing" as one would expect. Adding this check makes OSAllocatorWin consistent with OSAllocatorPosix for these 2 functions.
Location:
trunk/Source
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r160062 r160063  
     12013-12-03  Mark Lam  <mark.lam@apple.com>
     2
     3        testapi test crashes on Windows in WTF::Vector<wchar_t,64,WTF::UnsafeVectorOverflow>::size().
     4        https://bugs.webkit.org/show_bug.cgi?id=121972.
     5
     6        Reviewed by Brent Fulgham.
     7
     8        * interpreter/JSStack.cpp:
     9        (JSC::JSStack::~JSStack):
     10        - Reverting the change from r160004 since it's better to fix OSAllocatorWin
     11          to be consistent with OSAllocatorPosix.
     12
    1132013-12-03  Mark Lam  <mark.lam@apple.com>
    214
  • trunk/Source/JavaScriptCore/interpreter/JSStack.cpp

    r160004 r160063  
    6464{
    6565    void* highAddress = reinterpret_cast<void*>(static_cast<char*>(m_reservation.base()) + m_reservation.size());
    66     if (highAddress > m_commitEnd) {
    67         m_reservation.decommit(reinterpret_cast<void*>(m_commitEnd), reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitEnd));
    68         addToCommittedByteCount(-(reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitEnd)));
    69     }
     66    m_reservation.decommit(reinterpret_cast<void*>(m_commitEnd), reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitEnd));
     67    addToCommittedByteCount(-(reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitEnd)));
    7068    m_reservation.deallocate();
    7169}
  • trunk/Source/WTF/ChangeLog

    r159987 r160063  
     12013-12-03  Mark Lam  <mark.lam@apple.com>
     2
     3        testapi test crashes on Windows in WTF::Vector<wchar_t,64,WTF::UnsafeVectorOverflow>::size().
     4        https://bugs.webkit.org/show_bug.cgi?id=121972.
     5
     6        Reviewed by Brent Fulgham.
     7
     8        * wtf/OSAllocatorWin.cpp:
     9        (WTF::OSAllocator::decommit):
     10        (WTF::OSAllocator::releaseDecommitted):
     11        - Added a check to ensure that the bytes to decommit / release is not 0.
     12          On Windows, a 0 length passed to VirtualFree() has a special meaning,
     13          and it's not "decommit / release nothing" as one would expect. Adding
     14          this check makes OSAllocatorWin consistent with OSAllocatorPosix for
     15          these 2 functions.
     16
    1172013-12-02  Mark Lam  <mark.lam@apple.com>
    218
  • trunk/Source/WTF/wtf/OSAllocatorWin.cpp

    r139974 r160063  
    6666void OSAllocator::decommit(void* address, size_t bytes)
    6767{
     68    // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
     69    // bytes (i.e. dwSize) being 0 when dwFreeType is MEM_DECOMMIT means that we'll
     70    // decommit the entire region allocated by VirtualAlloc() instead of decommitting
     71    // nothing as we would expect. Hence, we should check if bytes is 0 and handle it
     72    // appropriately before calling VirtualFree().
     73    // See: https://bugs.webkit.org/show_bug.cgi?id=121972.
     74    if (!bytes)
     75        return;
    6876    bool result = VirtualFree(address, bytes, MEM_DECOMMIT);
    6977    if (!result)
     
    7381void OSAllocator::releaseDecommitted(void* address, size_t bytes)
    7482{
     83    // See comment in OSAllocator::decommit(). Similarly, when bytes is 0, we
     84    // don't want to release anything. So, don't call VirtualFree() below.
     85    if (!bytes)
     86        return;
    7587    // According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
    7688    // dwSize must be 0 if dwFreeType is MEM_RELEASE.
Note: See TracChangeset for help on using the changeset viewer.