diff options
author | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
---|---|---|
committer | Oswald Buddenhagen <oswald.buddenhagen@qt.io> | 2017-05-30 12:48:17 +0200 |
commit | 881da28418d380042aa95a97f0cbd42560a64f7c (patch) | |
tree | a794dff3274695e99c651902dde93d934ea7a5af /Source/JavaScriptCore/heap/WeakBlock.h | |
parent | 7e104c57a70fdf551bb3d22a5d637cdcbc69dbea (diff) | |
parent | 0fcedcd17cc00d3dd44c718b3cb36c1033319671 (diff) | |
download | qtwebkit-881da28418d380042aa95a97f0cbd42560a64f7c.tar.gz |
Merge 'wip/next' into dev
Change-Id: Iff9ee5e23bb326c4371ec8ed81d56f2f05d680e9
Diffstat (limited to 'Source/JavaScriptCore/heap/WeakBlock.h')
-rw-r--r-- | Source/JavaScriptCore/heap/WeakBlock.h | 40 |
1 files changed, 20 insertions, 20 deletions
diff --git a/Source/JavaScriptCore/heap/WeakBlock.h b/Source/JavaScriptCore/heap/WeakBlock.h index b6b631e27..f5fbfdc87 100644 --- a/Source/JavaScriptCore/heap/WeakBlock.h +++ b/Source/JavaScriptCore/heap/WeakBlock.h @@ -26,41 +26,40 @@ #ifndef WeakBlock_h #define WeakBlock_h -#include "HeapBlock.h" -#include "WeakHandleOwner.h" #include "WeakImpl.h" #include <wtf/DoublyLinkedList.h> #include <wtf/StdLibExtras.h> namespace JSC { -class DeadBlock; +class Heap; class HeapRootVisitor; -class JSValue; -class WeakHandleOwner; +class MarkedBlock; -class WeakBlock : public HeapBlock<WeakBlock> { +class WeakBlock : public DoublyLinkedListNode<WeakBlock> { public: friend class WTF::DoublyLinkedListNode<WeakBlock>; - static const size_t blockSize = 4 * KB; // 5% of MarkedBlock size + static const size_t blockSize = 1 * KB; // 1/16 of MarkedBlock size struct FreeCell { FreeCell* next; }; struct SweepResult { - SweepResult(); bool isNull() const; - bool blockIsFree; - FreeCell* freeList; + bool blockIsFree { true }; + bool blockIsLogicallyEmpty { true }; + FreeCell* freeList { nullptr }; }; - static WeakBlock* create(DeadBlock*); + static WeakBlock* create(Heap&, MarkedBlock&); + static void destroy(Heap&, WeakBlock*); static WeakImpl* asWeakImpl(FreeCell*); bool isEmpty(); + bool isLogicallyEmptyButNotFree() const; void sweep(); SweepResult takeSweepResult(); @@ -69,27 +68,23 @@ public: void reap(); void lastChanceToFinalize(); + void disconnectMarkedBlock() { m_markedBlock = nullptr; } private: static FreeCell* asFreeCell(WeakImpl*); - WeakBlock(Region*); - WeakImpl* firstWeakImpl(); + explicit WeakBlock(MarkedBlock&); void finalize(WeakImpl*); WeakImpl* weakImpls(); size_t weakImplCount(); void addToFreeList(FreeCell**, WeakImpl*); + MarkedBlock* m_markedBlock; + WeakBlock* m_prev; + WeakBlock* m_next; SweepResult m_sweepResult; }; -inline WeakBlock::SweepResult::SweepResult() - : blockIsFree(true) - , freeList(0) -{ - ASSERT(isNull()); -} - inline bool WeakBlock::SweepResult::isNull() const { return blockIsFree && !freeList; // This state is impossible, so we can use it to mean null. @@ -138,6 +133,11 @@ inline bool WeakBlock::isEmpty() return !m_sweepResult.isNull() && m_sweepResult.blockIsFree; } +inline bool WeakBlock::isLogicallyEmptyButNotFree() const +{ + return !m_sweepResult.isNull() && !m_sweepResult.blockIsFree && m_sweepResult.blockIsLogicallyEmpty; +} + } // namespace JSC #endif // WeakBlock_h |