diff options
Diffstat (limited to 'Source/JavaScriptCore/heap/HeapBlock.h')
-rw-r--r-- | Source/JavaScriptCore/heap/HeapBlock.h | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Source/JavaScriptCore/heap/HeapBlock.h b/Source/JavaScriptCore/heap/HeapBlock.h index f67ef9129..a63b7ebe1 100644 --- a/Source/JavaScriptCore/heap/HeapBlock.h +++ b/Source/JavaScriptCore/heap/HeapBlock.h @@ -27,14 +27,13 @@ #define HeapBlock_h #include <wtf/DoublyLinkedList.h> +#include <wtf/PageAllocationAligned.h> #include <wtf/StdLibExtras.h> namespace JSC { enum AllocationEffort { AllocationCanFail, AllocationMustSucceed }; -class Region; - #if COMPILER(GCC) #define CLASS_IF_GCC class #else @@ -47,25 +46,28 @@ class HeapBlock : public DoublyLinkedListNode<T> { public: static const size_t s_blockSize = 64 * KB; - static HeapBlock* destroy(HeapBlock* block) + static PageAllocationAligned destroy(HeapBlock* block) { static_cast<T*>(block)->~T(); - return block; + + PageAllocationAligned allocation; + std::swap(allocation, block->m_allocation); + return allocation; } - HeapBlock(Region* region) + HeapBlock(const PageAllocationAligned& allocation) : DoublyLinkedListNode<T>() - , m_region(region) + , m_allocation(allocation) , m_prev(0) , m_next(0) { - ASSERT(m_region); + ASSERT(m_allocation); } - Region* region() const { return m_region; } + const PageAllocationAligned allocation() const { return m_allocation; } private: - Region* m_region; + PageAllocationAligned m_allocation; T* m_prev; T* m_next; }; |