diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-05-25 15:09:11 +0200 |
commit | a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd (patch) | |
tree | b7abd9f49ae1d4d2e426a5883bfccd42b8e2ee12 /Source/JavaScriptCore/heap/WeakBlock.cpp | |
parent | 8d473cf9743f1d30a16a27114e93bd5af5648d23 (diff) | |
download | qtwebkit-a89b2ebb8e192c5e8cea21079bda2ee2c0c7dddd.tar.gz |
Imported WebKit commit eb5c1b8fe4d4b1b90b5137433fc58a91da0e6878 (http://svn.webkit.org/repository/webkit/trunk@118516)
Diffstat (limited to 'Source/JavaScriptCore/heap/WeakBlock.cpp')
-rw-r--r-- | Source/JavaScriptCore/heap/WeakBlock.cpp | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/Source/JavaScriptCore/heap/WeakBlock.cpp b/Source/JavaScriptCore/heap/WeakBlock.cpp index f307e111e..685779d3a 100644 --- a/Source/JavaScriptCore/heap/WeakBlock.cpp +++ b/Source/JavaScriptCore/heap/WeakBlock.cpp @@ -36,19 +36,16 @@ namespace JSC { WeakBlock* WeakBlock::create() { - PageAllocation allocation = PageAllocation::allocate(blockSize, OSAllocator::JSGCHeapPages); - if (!static_cast<bool>(allocation)) - CRASH(); - return new (NotNull, allocation.base()) WeakBlock(allocation); + void* allocation = fastMalloc(blockSize); + return new (NotNull, allocation) WeakBlock; } void WeakBlock::destroy(WeakBlock* block) { - block->m_allocation.deallocate(); + fastFree(block); } -WeakBlock::WeakBlock(PageAllocation& allocation) - : m_allocation(allocation) +WeakBlock::WeakBlock() { for (size_t i = 0; i < weakImplCount(); ++i) { WeakImpl* weakImpl = &weakImpls()[i]; @@ -56,10 +53,10 @@ WeakBlock::WeakBlock(PageAllocation& allocation) addToFreeList(&m_sweepResult.freeList, weakImpl); } - ASSERT(!m_sweepResult.isNull() && m_sweepResult.blockIsFree); + ASSERT(isEmpty()); } -void WeakBlock::finalizeAll() +void WeakBlock::lastChanceToFinalize() { for (size_t i = 0; i < weakImplCount(); ++i) { WeakImpl* weakImpl = &weakImpls()[i]; @@ -90,10 +87,10 @@ void WeakBlock::sweep() ASSERT(!m_sweepResult.isNull()); } -void WeakBlock::visitLiveWeakImpls(HeapRootVisitor& heapRootVisitor) +void WeakBlock::visit(HeapRootVisitor& heapRootVisitor) { // If a block is completely empty, a visit won't have any effect. - if (!m_sweepResult.isNull() && m_sweepResult.blockIsFree) + if (isEmpty()) return; SlotVisitor& visitor = heapRootVisitor.visitor(); @@ -118,10 +115,10 @@ void WeakBlock::visitLiveWeakImpls(HeapRootVisitor& heapRootVisitor) } } -void WeakBlock::visitDeadWeakImpls(HeapRootVisitor&) +void WeakBlock::reap() { - // If a block is completely empty, a visit won't have any effect. - if (!m_sweepResult.isNull() && m_sweepResult.blockIsFree) + // If a block is completely empty, a reaping won't have any effect. + if (isEmpty()) return; for (size_t i = 0; i < weakImplCount(); ++i) { |