Index: Source/platform/heap/Heap.h |
diff --git a/Source/platform/heap/Heap.h b/Source/platform/heap/Heap.h |
index af83b7c11ac4bdb74534cc6b3b538f6546208e7d..04ca17ade716ecc9f36859aa9ecfe407018a0865 100644 |
--- a/Source/platform/heap/Heap.h |
+++ b/Source/platform/heap/Heap.h |
@@ -1103,7 +1103,11 @@ public: |
static bool weakTableRegistered(const void*); |
#endif |
- template<typename T, typename HeapTraits = HeapTypeTrait<T> > static Address allocate(size_t); |
+ template<typename T, typename HeapTraits> static Address allocate(size_t); |
+ // TODO(mostynb) remove this once c++11 is allowed, in favour of the one |
haraken
2014/09/10 00:51:10
TODO(mostynb) => FIXME
Mostyn Bramley-Moore
2014/09/10 08:09:16
Done.
|
+ // above: |
+ template<typename T> static Address allocate(size_t); |
+ |
template<typename T> static Address reallocate(void* previous, size_t); |
static void collectGarbage(ThreadState::StackState); |
@@ -1573,6 +1577,18 @@ Address Heap::allocate(size_t size) |
return static_cast<typename HeapTraits::HeapType*>(heap)->allocate(size, gcInfo); |
} |
+// TODO(mostynb) remove this once c++11 is allowed, in favour of the one above: |
haraken
2014/09/10 00:51:10
Ditto.
Mostyn Bramley-Moore
2014/09/10 08:09:16
Done.
|
+template<typename T> |
+Address Heap::allocate(size_t size) |
+{ |
+ ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(); |
+ ASSERT(state->isAllocationAllowed()); |
+ const GCInfo* gcInfo = GCInfoTrait<T>::get(); |
+ int heapIndex = HeapTypeTrait<T>::index(gcInfo->hasFinalizer()); |
+ BaseHeap* heap = state->heap(heapIndex); |
+ return static_cast<typename HeapTypeTrait<T>::HeapType*>(heap)->allocate(size, gcInfo); |
+} |
+ |
template<typename T> |
Address Heap::reallocate(void* previous, size_t size) |
{ |