summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/heap/WeakBlock.cpp
diff options
context:
space:
mode:
authorLorry Tar Creator <lorry-tar-importer@lorry>2015-05-20 09:56:07 +0000
committerLorry Tar Creator <lorry-tar-importer@lorry>2015-05-20 09:56:07 +0000
commit41386e9cb918eed93b3f13648cbef387e371e451 (patch)
treea97f9d7bd1d9d091833286085f72da9d83fd0606 /Source/JavaScriptCore/heap/WeakBlock.cpp
parente15dd966d523731101f70ccf768bba12435a0208 (diff)
downloadWebKitGtk-tarball-41386e9cb918eed93b3f13648cbef387e371e451.tar.gz
webkitgtk-2.4.9webkitgtk-2.4.9
Diffstat (limited to 'Source/JavaScriptCore/heap/WeakBlock.cpp')
-rw-r--r--Source/JavaScriptCore/heap/WeakBlock.cpp39
1 files changed, 9 insertions, 30 deletions
diff --git a/Source/JavaScriptCore/heap/WeakBlock.cpp b/Source/JavaScriptCore/heap/WeakBlock.cpp
index 7c7d86c59..957090569 100644
--- a/Source/JavaScriptCore/heap/WeakBlock.cpp
+++ b/Source/JavaScriptCore/heap/WeakBlock.cpp
@@ -29,25 +29,19 @@
#include "Heap.h"
#include "HeapRootVisitor.h"
#include "JSObject.h"
-#include "JSCInlines.h"
+#include "Operations.h"
#include "Structure.h"
namespace JSC {
-WeakBlock* WeakBlock::create(MarkedBlock& markedBlock)
+WeakBlock* WeakBlock::create(DeadBlock* block)
{
- return new (NotNull, fastMalloc(blockSize)) WeakBlock(markedBlock);
+ Region* region = block->region();
+ return new (NotNull, block) WeakBlock(region);
}
-void WeakBlock::destroy(WeakBlock* block)
-{
- block->~WeakBlock();
- fastFree(block);
-}
-
-WeakBlock::WeakBlock(MarkedBlock& markedBlock)
- : DoublyLinkedListNode<WeakBlock>()
- , m_markedBlock(&markedBlock)
+WeakBlock::WeakBlock(Region* region)
+ : HeapBlock<WeakBlock>(region)
{
for (size_t i = 0; i < weakImplCount(); ++i) {
WeakImpl* weakImpl = &weakImpls()[i];
@@ -82,11 +76,8 @@ void WeakBlock::sweep()
finalize(weakImpl);
if (weakImpl->state() == WeakImpl::Deallocated)
addToFreeList(&sweepResult.freeList, weakImpl);
- else {
+ else
sweepResult.blockIsFree = false;
- if (weakImpl->state() == WeakImpl::Live)
- sweepResult.blockIsLogicallyEmpty = false;
- }
}
m_sweepResult = sweepResult;
@@ -99,12 +90,6 @@ void WeakBlock::visit(HeapRootVisitor& heapRootVisitor)
if (isEmpty())
return;
- // If this WeakBlock doesn't belong to a MarkedBlock, we won't even be here.
- ASSERT(m_markedBlock);
-
- if (m_markedBlock->isAllocated())
- return;
-
SlotVisitor& visitor = heapRootVisitor.visitor();
for (size_t i = 0; i < weakImplCount(); ++i) {
@@ -113,7 +98,7 @@ void WeakBlock::visit(HeapRootVisitor& heapRootVisitor)
continue;
const JSValue& jsValue = weakImpl->jsValue();
- if (m_markedBlock->isMarkedOrNewlyAllocated(jsValue.asCell()))
+ if (Heap::isLive(jsValue.asCell()))
continue;
WeakHandleOwner* weakHandleOwner = weakImpl->weakHandleOwner();
@@ -133,18 +118,12 @@ void WeakBlock::reap()
if (isEmpty())
return;
- // If this WeakBlock doesn't belong to a MarkedBlock, we won't even be here.
- ASSERT(m_markedBlock);
-
- if (m_markedBlock->isAllocated())
- return;
-
for (size_t i = 0; i < weakImplCount(); ++i) {
WeakImpl* weakImpl = &weakImpls()[i];
if (weakImpl->state() > WeakImpl::Dead)
continue;
- if (m_markedBlock->isMarkedOrNewlyAllocated(weakImpl->jsValue().asCell())) {
+ if (Heap::isLive(weakImpl->jsValue().asCell())) {
ASSERT(weakImpl->state() == WeakImpl::Live);
continue;
}