Commit e2249cfe authored by slewis@apple.com's avatar slewis@apple.com
Browse files

Committing for Gavin since he needed to leave.

PPC build fix; stop using std::swap on PageAllocation/PageReservation,
this was failing on some compilers since the lack of default construction
for the m_executable/m_writable fields meant the value being swapped may
not have been fully initialized.

Patch by Gavin Barraclough <barraclough@apple.com> on 2010-12-20
* wtf/PageAllocation.h:
(WTF::PageAllocation::deallocate):
* wtf/PageBlock.h:
* wtf/PageReservation.h:
(WTF::PageReservation::deallocate):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74382 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent a99586d0
2010-12-20 Gavin Barraclough <barraclough@apple.com>
PPC build fix; stop using std::swap on PageAllocation/PageReservation,
this was failing on some compilers since the lack of default construction
for the m_executable/m_writable fields meant the value being swapped may
not have been fully initialized.
* wtf/PageAllocation.h:
(WTF::PageAllocation::deallocate):
* wtf/PageBlock.h:
* wtf/PageReservation.h:
(WTF::PageReservation::deallocate):
2010-12-20 Oliver Hunt <oliver@apple.com>
 
Reviewed by Geoffrey Garen.
......
......@@ -109,9 +109,15 @@ public:
void deallocate()
{
ASSERT(*this);
PageAllocation tmp;
std::swap(tmp, *this);
OSAllocator::release(tmp.base(), tmp.size());
// Zero these before calling release; if this is *inside* allocation,
// we won't be able to clear then after the call to OSAllocator::release.
void* base = m_base;
size_t size = m_size;
m_base = 0;
m_size = 0;
OSAllocator::release(base, size);
}
private:
......
......@@ -44,7 +44,7 @@ public:
operator bool() const { return !!m_base; }
private:
protected:
void* m_base;
size_t m_size;
};
......
......@@ -98,9 +98,15 @@ public:
{
ASSERT(!m_committed);
ASSERT(*this);
PageReservation tmp;
std::swap(tmp, *this);
OSAllocator::release(tmp.base(), tmp.size());
// Zero these before calling release; if this is *inside* allocation,
// we won't be able to clear then after the call to OSAllocator::release.
void* base = m_base;
size_t size = m_size;
m_base = 0;
m_size = 0;
OSAllocator::release(base, size);
}
private:
......
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