Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2859)

Side by Side Diff: third_party/WebKit/Source/platform/heap/HeapAllocator.h

Issue 1754183002: Rename BaseHeap to BaseArena (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/Allocator.h" 10 #include "wtf/Allocator.h"
(...skipping 24 matching lines...) Expand all
35 { 35 {
36 RELEASE_ASSERT(count <= maxHeapObjectSize / sizeof(T)); 36 RELEASE_ASSERT(count <= maxHeapObjectSize / sizeof(T));
37 return Heap::allocationSizeFromSize(count * sizeof(T)) - sizeof(HeapObje ctHeader); 37 return Heap::allocationSizeFromSize(count * sizeof(T)) - sizeof(HeapObje ctHeader);
38 } 38 }
39 template <typename T> 39 template <typename T>
40 static T* allocateVectorBacking(size_t size) 40 static T* allocateVectorBacking(size_t size)
41 { 41 {
42 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( ); 42 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( );
43 ASSERT(state->isAllocationAllowed()); 43 ASSERT(state->isAllocationAllowed());
44 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>: :index(); 44 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>: :index();
45 NormalPageHeap* heap = static_cast<NormalPageHeap*>(state->vectorBacking Heap(gcInfoIndex)); 45 NormalPageHeap* heap = static_cast<NormalPageHeap*>(state->vectorBacking Arena(gcInfoIndex));
46 return reinterpret_cast<T*>(heap->allocateObject(Heap::allocationSizeFro mSize(size), gcInfoIndex)); 46 return reinterpret_cast<T*>(heap->allocateObject(Heap::allocationSizeFro mSize(size), gcInfoIndex));
47 } 47 }
48 template <typename T> 48 template <typename T>
49 static T* allocateExpandedVectorBacking(size_t size) 49 static T* allocateExpandedVectorBacking(size_t size)
50 { 50 {
51 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( ); 51 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( );
52 ASSERT(state->isAllocationAllowed()); 52 ASSERT(state->isAllocationAllowed());
53 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>: :index(); 53 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>: :index();
54 NormalPageHeap* heap = static_cast<NormalPageHeap*>(state->expandedVecto rBackingHeap(gcInfoIndex)); 54 NormalPageHeap* heap = static_cast<NormalPageHeap*>(state->expandedVecto rBackingHeap(gcInfoIndex));
55 return reinterpret_cast<T*>(heap->allocateObject(Heap::allocationSizeFro mSize(size), gcInfoIndex)); 55 return reinterpret_cast<T*>(heap->allocateObject(Heap::allocationSizeFro mSize(size), gcInfoIndex));
56 } 56 }
57 static void freeVectorBacking(void*); 57 static void freeVectorBacking(void*);
58 static bool expandVectorBacking(void*, size_t); 58 static bool expandVectorBacking(void*, size_t);
59 static bool shrinkVectorBacking(void* address, size_t quantizedCurrentSize, size_t quantizedShrunkSize); 59 static bool shrinkVectorBacking(void* address, size_t quantizedCurrentSize, size_t quantizedShrunkSize);
60 template <typename T> 60 template <typename T>
61 static T* allocateInlineVectorBacking(size_t size) 61 static T* allocateInlineVectorBacking(size_t size)
62 { 62 {
63 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>: :index(); 63 size_t gcInfoIndex = GCInfoTrait<HeapVectorBacking<T, VectorTraits<T>>>: :index();
64 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( ); 64 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( );
65 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex(state, size, Blink GC::InlineVectorHeapIndex, gcInfoIndex)); 65 return reinterpret_cast<T*>(Heap::allocateOnArenaIndex(state, size, Blin kGC::InlineVectorArenaIndex, gcInfoIndex));
66 } 66 }
67 static void freeInlineVectorBacking(void*); 67 static void freeInlineVectorBacking(void*);
68 static bool expandInlineVectorBacking(void*, size_t); 68 static bool expandInlineVectorBacking(void*, size_t);
69 static bool shrinkInlineVectorBacking(void* address, size_t quantizedCurrent Size, size_t quantizedShrunkSize); 69 static bool shrinkInlineVectorBacking(void* address, size_t quantizedCurrent Size, size_t quantizedShrunkSize);
70 70
71 template <typename T, typename HashTable> 71 template <typename T, typename HashTable>
72 static T* allocateHashTableBacking(size_t size) 72 static T* allocateHashTableBacking(size_t size)
73 { 73 {
74 size_t gcInfoIndex = GCInfoTrait<HeapHashTableBacking<HashTable>>::index (); 74 size_t gcInfoIndex = GCInfoTrait<HeapHashTableBacking<HashTable>>::index ();
75 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( ); 75 ThreadState* state = ThreadStateFor<ThreadingTrait<T>::Affinity>::state( );
76 return reinterpret_cast<T*>(Heap::allocateOnHeapIndex(state, size, Blink GC::HashTableHeapIndex, gcInfoIndex)); 76 return reinterpret_cast<T*>(Heap::allocateOnArenaIndex(state, size, Blin kGC::HashTableArenaIndex, gcInfoIndex));
77 } 77 }
78 template <typename T, typename HashTable> 78 template <typename T, typename HashTable>
79 static T* allocateZeroedHashTableBacking(size_t size) 79 static T* allocateZeroedHashTableBacking(size_t size)
80 { 80 {
81 return allocateHashTableBacking<T, HashTable>(size); 81 return allocateHashTableBacking<T, HashTable>(size);
82 } 82 }
83 static void freeHashTableBacking(void* address); 83 static void freeHashTableBacking(void* address);
84 static bool expandHashTableBacking(void*, size_t); 84 static bool expandHashTableBacking(void*, size_t);
85 85
86 template <typename Return, typename Metadata> 86 template <typename Return, typename Metadata>
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 static_assert(sizeof(T), "T must be fully defined"); 555 static_assert(sizeof(T), "T must be fully defined");
556 // All heap allocated node pointers need visiting to keep the nodes alive, 556 // All heap allocated node pointers need visiting to keep the nodes alive,
557 // regardless of whether they contain pointers to other heap allocated 557 // regardless of whether they contain pointers to other heap allocated
558 // objects. 558 // objects.
559 static const bool value = true; 559 static const bool value = true;
560 }; 560 };
561 561
562 } // namespace WTF 562 } // namespace WTF
563 563
564 #endif 564 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Heap.cpp ('k') | third_party/WebKit/Source/platform/heap/HeapAllocator.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698