Commit 029c2749 authored by mark.lam@apple.com's avatar mark.lam@apple.com

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.



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@160063 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent f60b15bd
2013-12-03 Mark Lam <mark.lam@apple.com>
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.
* interpreter/JSStack.cpp:
(JSC::JSStack::~JSStack):
- Reverting the change from r160004 since it's better to fix OSAllocatorWin
to be consistent with OSAllocatorPosix.
2013-12-03 Mark Lam <mark.lam@apple.com>
Fix LLINT_C_LOOP build for Win64.
......
......@@ -63,10 +63,8 @@ JSStack::JSStack(VM& vm, size_t capacity)
JSStack::~JSStack()
{
void* highAddress = reinterpret_cast<void*>(static_cast<char*>(m_reservation.base()) + m_reservation.size());
if (highAddress > m_commitEnd) {
m_reservation.decommit(reinterpret_cast<void*>(m_commitEnd), reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitEnd));
addToCommittedByteCount(-(reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitEnd)));
}
m_reservation.decommit(reinterpret_cast<void*>(m_commitEnd), reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitEnd));
addToCommittedByteCount(-(reinterpret_cast<intptr_t>(highAddress) - reinterpret_cast<intptr_t>(m_commitEnd)));
m_reservation.deallocate();
}
......
2013-12-03 Mark Lam <mark.lam@apple.com>
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.
* 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.
2013-12-02 Mark Lam <mark.lam@apple.com>
Build failure when disabling JIT, YARR_JIT, and ASSEMBLER.
......
......@@ -65,6 +65,14 @@ void OSAllocator::commit(void* address, size_t bytes, bool writable, bool execut
void OSAllocator::decommit(void* address, size_t bytes)
{
// According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
// bytes (i.e. dwSize) being 0 when dwFreeType is MEM_DECOMMIT means that we'll
// decommit the entire region allocated by VirtualAlloc() instead of decommitting
// nothing as we would expect. Hence, we should check if bytes is 0 and handle it
// appropriately before calling VirtualFree().
// See: https://bugs.webkit.org/show_bug.cgi?id=121972.
if (!bytes)
return;
bool result = VirtualFree(address, bytes, MEM_DECOMMIT);
if (!result)
CRASH();
......@@ -72,6 +80,10 @@ void OSAllocator::decommit(void* address, size_t bytes)
void OSAllocator::releaseDecommitted(void* address, size_t bytes)
{
// See comment in OSAllocator::decommit(). Similarly, when bytes is 0, we
// don't want to release anything. So, don't call VirtualFree() below.
if (!bytes)
return;
// According to http://msdn.microsoft.com/en-us/library/aa366892(VS.85).aspx,
// dwSize must be 0 if dwFreeType is MEM_RELEASE.
bool result = VirtualFree(address, 0, MEM_RELEASE);
......
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