| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef HeapAllocator_h | 5 #ifndef HeapAllocator_h |
| 6 #define HeapAllocator_h | 6 #define HeapAllocator_h |
| 7 | 7 |
| 8 #include "platform/heap/Heap.h" | 8 #include "platform/heap/Heap.h" |
| 9 #include "platform/heap/TraceTraits.h" | 9 #include "platform/heap/TraceTraits.h" |
| 10 #include "wtf/Assertions.h" | 10 #include "wtf/Assertions.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 return reinterpret_cast<T*>(heap->allocateObject(Heap::allocationSizeFro
mSize(size), gcInfoIndex)); | 53 return reinterpret_cast<T*>(heap->allocateObject(Heap::allocationSizeFro
mSize(size), gcInfoIndex)); |
| 54 } | 54 } |
| 55 static void freeVectorBacking(void*); | 55 static void freeVectorBacking(void*); |
| 56 static bool expandVectorBacking(void*, size_t); | 56 static bool expandVectorBacking(void*, size_t); |
| 57 static bool shrinkVectorBacking(void* address, size_t quantizedCurrentSize,
size_t quantizedShrunkSize); | 57 static bool shrinkVectorBacking(void* address, size_t quantizedCurrentSize,
size_t quantizedShrunkSize); |
| 58 template <typename T> | 58 template <typename T> |
| 59 static T* allocateInlineVectorBacking(size_t size) | 59 static T* allocateInlineVectorBacking(size_t size) |
| 60 { | 60 { |
| 61 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>:
:index(); | 61 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>:
:index(); |
| 62 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(
); | 62 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(
); |
| 63 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex(state, size, Threa
dState::InlineVectorHeapIndex, gcInfoIndex)); | 63 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex(state, size, Blink
GC::InlineVectorHeapIndex, gcInfoIndex)); |
| 64 } | 64 } |
| 65 static void freeInlineVectorBacking(void*); | 65 static void freeInlineVectorBacking(void*); |
| 66 static bool expandInlineVectorBacking(void*, size_t); | 66 static bool expandInlineVectorBacking(void*, size_t); |
| 67 static bool shrinkInlineVectorBacking(void* address, size_t quantizedCurrent
Size, size_t quantizedShrunkSize); | 67 static bool shrinkInlineVectorBacking(void* address, size_t quantizedCurrent
Size, size_t quantizedShrunkSize); |
| 68 | 68 |
| 69 template <typename T, typename HashTable> | 69 template <typename T, typename HashTable> |
| 70 static T* allocateHashTableBacking(size_t size) | 70 static T* allocateHashTableBacking(size_t size) |
| 71 { | 71 { |
| 72 size_t gcInfoIndex = GCInfoTrait<HeapHashTableBacking<HashTable>>::index
(); | 72 size_t gcInfoIndex = GCInfoTrait<HeapHashTableBacking<HashTable>>::index
(); |
| 73 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(
); | 73 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state(
); |
| 74 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex(state, size, Threa
dState::HashTableHeapIndex, gcInfoIndex)); | 74 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex(state, size, Blink
GC::HashTableHeapIndex, gcInfoIndex)); |
| 75 } | 75 } |
| 76 template <typename T, typename HashTable> | 76 template <typename T, typename HashTable> |
| 77 static T* allocateZeroedHashTableBacking(size_t size) | 77 static T* allocateZeroedHashTableBacking(size_t size) |
| 78 { | 78 { |
| 79 return allocateHashTableBacking<T, HashTable>(size); | 79 return allocateHashTableBacking<T, HashTable>(size); |
| 80 } | 80 } |
| 81 static void freeHashTableBacking(void* address); | 81 static void freeHashTableBacking(void* address); |
| 82 static bool expandHashTableBacking(void*, size_t); | 82 static bool expandHashTableBacking(void*, size_t); |
| 83 | 83 |
| 84 template <typename Return, typename Metadata> | 84 template <typename Return, typename Metadata> |
| (...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 template<size_t otherCapacity> | 382 template<size_t otherCapacity> |
| 383 HeapDeque(const HeapDeque<T, otherCapacity>& other) | 383 HeapDeque(const HeapDeque<T, otherCapacity>& other) |
| 384 : Deque<T, inlineCapacity, HeapAllocator>(other) | 384 : Deque<T, inlineCapacity, HeapAllocator>(other) |
| 385 { | 385 { |
| 386 } | 386 } |
| 387 }; | 387 }; |
| 388 | 388 |
| 389 } // namespace blink | 389 } // namespace blink |
| 390 | 390 |
| 391 #endif | 391 #endif |
| OLD | NEW |