diff options
author | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
---|---|---|
committer | Lorry Tar Creator <lorry-tar-importer@lorry> | 2017-06-27 06:07:23 +0000 |
commit | 1bf1084f2b10c3b47fd1a588d85d21ed0eb41d0c (patch) | |
tree | 46dcd36c86e7fbc6e5df36deb463b33e9967a6f7 /Source/JavaScriptCore/heap/WeakSet.h | |
parent | 32761a6cee1d0dee366b885b7b9c777e67885688 (diff) | |
download | WebKitGtk-tarball-master.tar.gz |
webkitgtk-2.16.5HEADwebkitgtk-2.16.5master
Diffstat (limited to 'Source/JavaScriptCore/heap/WeakSet.h')
-rw-r--r-- | Source/JavaScriptCore/heap/WeakSet.h | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/Source/JavaScriptCore/heap/WeakSet.h b/Source/JavaScriptCore/heap/WeakSet.h index a5ddcaffa..ddcf743b5 100644 --- a/Source/JavaScriptCore/heap/WeakSet.h +++ b/Source/JavaScriptCore/heap/WeakSet.h @@ -1,5 +1,5 @@ /* - * Copyright (C) 2012 Apple Inc. All rights reserved. + * Copyright (C) 2012-2017 Apple Inc. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -23,33 +23,38 @@ * THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef WeakSet_h -#define WeakSet_h +#pragma once +#include "CellContainer.h" #include "WeakBlock.h" +#include <wtf/SentinelLinkedList.h> namespace JSC { class Heap; class WeakImpl; -class WeakSet { +class WeakSet : public BasicRawSentinelNode<WeakSet> { friend class LLIntOffsetsExtractor; public: static WeakImpl* allocate(JSValue, WeakHandleOwner* = 0, void* context = 0); static void deallocate(WeakImpl*); - WeakSet(VM*); + WeakSet(VM*, CellContainer); ~WeakSet(); void lastChanceToFinalize(); + + CellContainer container() const { return m_container; } + void setContainer(CellContainer container) { m_container = container; } Heap* heap() const; VM* vm() const; bool isEmpty() const; - void visit(HeapRootVisitor&); + void visit(SlotVisitor&); + void reap(); void sweep(); void shrink(); @@ -65,12 +70,14 @@ private: WeakBlock* m_nextAllocator; DoublyLinkedList<WeakBlock> m_blocks; VM* m_vm; + CellContainer m_container; }; -inline WeakSet::WeakSet(VM* vm) +inline WeakSet::WeakSet(VM* vm, CellContainer container) : m_allocator(0) , m_nextAllocator(0) , m_vm(vm) + , m_container(container) { } @@ -100,7 +107,7 @@ inline void WeakSet::lastChanceToFinalize() block->lastChanceToFinalize(); } -inline void WeakSet::visit(HeapRootVisitor& visitor) +inline void WeakSet::visit(SlotVisitor& visitor) { for (WeakBlock* block = m_blocks.head(); block; block = block->next()) block->visit(visitor); @@ -112,19 +119,6 @@ inline void WeakSet::reap() block->reap(); } -inline void WeakSet::shrink() -{ - WeakBlock* next; - for (WeakBlock* block = m_blocks.head(); block; block = next) { - next = block->next(); - - if (block->isEmpty()) - removeAllocator(block); - } - - resetAllocator(); -} - inline void WeakSet::resetAllocator() { m_allocator = 0; @@ -132,5 +126,3 @@ inline void WeakSet::resetAllocator() } } // namespace JSC - -#endif // WeakSet_h |