summaryrefslogtreecommitdiff
path: root/Source/JavaScriptCore/heap/HeapBlock.h
diff options
context:
space:
mode:
authorSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
committerSimon Hausmann <simon.hausmann@nokia.com>2012-08-12 09:27:39 +0200
commit3749d61e1f7a59f5ec5067e560af1eb610c82015 (patch)
tree73dc228333948738bbe02976cacca8cd382bc978 /Source/JavaScriptCore/heap/HeapBlock.h
parentb32b4dcd9a51ab8de6afc53d9e17f8707e1f7a5e (diff)
downloadqtwebkit-3749d61e1f7a59f5ec5067e560af1eb610c82015.tar.gz
Imported WebKit commit a77350243e054f3460d1137301d8b3faee3d2052 (http://svn.webkit.org/repository/webkit/trunk@125365)
New snapshot with build fixes for latest API changes in Qt and all WK1 Win MSVC fixes upstream
Diffstat (limited to 'Source/JavaScriptCore/heap/HeapBlock.h')
-rw-r--r--Source/JavaScriptCore/heap/HeapBlock.h34
1 files changed, 27 insertions, 7 deletions
diff --git a/Source/JavaScriptCore/heap/HeapBlock.h b/Source/JavaScriptCore/heap/HeapBlock.h
index 3cd3c6322..a63b7ebe1 100644
--- a/Source/JavaScriptCore/heap/HeapBlock.h
+++ b/Source/JavaScriptCore/heap/HeapBlock.h
@@ -34,22 +34,42 @@ namespace JSC {
enum AllocationEffort { AllocationCanFail, AllocationMustSucceed };
-class HeapBlock : public DoublyLinkedListNode<HeapBlock> {
+#if COMPILER(GCC)
+#define CLASS_IF_GCC class
+#else
+#define CLASS_IF_GCC
+#endif
+
+template<typename T>
+class HeapBlock : public DoublyLinkedListNode<T> {
+ friend CLASS_IF_GCC DoublyLinkedListNode<T>;
public:
+ static const size_t s_blockSize = 64 * KB;
+
+ static PageAllocationAligned destroy(HeapBlock* block)
+ {
+ static_cast<T*>(block)->~T();
+
+ PageAllocationAligned allocation;
+ std::swap(allocation, block->m_allocation);
+ return allocation;
+ }
+
HeapBlock(const PageAllocationAligned& allocation)
- : DoublyLinkedListNode<HeapBlock>()
+ : DoublyLinkedListNode<T>()
+ , m_allocation(allocation)
, m_prev(0)
, m_next(0)
- , m_allocation(allocation)
{
ASSERT(m_allocation);
}
- HeapBlock* m_prev;
- HeapBlock* m_next;
+ const PageAllocationAligned allocation() const { return m_allocation; }
+
+private:
PageAllocationAligned m_allocation;
-
- static const size_t s_blockSize = 64 * KB;
+ T* m_prev;
+ T* m_next;
};
} // namespace JSC