Index: third_party/WebKit/Source/platform/heap/HeapPage.h |
diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.h b/third_party/WebKit/Source/platform/heap/HeapPage.h |
index b35988ad1e2ba7aedcc8414a6dff58f0d6713fd4..20943efe9b8fc3d104782db344068b2e49da0e6c 100644 |
--- a/third_party/WebKit/Source/platform/heap/HeapPage.h |
+++ b/third_party/WebKit/Source/platform/heap/HeapPage.h |
@@ -37,6 +37,7 @@ |
#include "platform/heap/ThreadState.h" |
#include "platform/heap/Visitor.h" |
#include "wtf/AddressSanitizer.h" |
+#include "wtf/Allocator.h" |
#include "wtf/Assertions.h" |
#include "wtf/Atomics.h" |
#include "wtf/ContainerAnnotations.h" |
@@ -165,6 +166,7 @@ const size_t nonLargeObjectPageSizeMax = 1 << 17; |
static_assert(nonLargeObjectPageSizeMax >= blinkPageSize, "max size supported by HeapObjectHeader must at least be blinkPageSize"); |
class PLATFORM_EXPORT HeapObjectHeader { |
+ DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
public: |
// If gcInfoIndex is 0, this header is interpreted as a free list header. |
NO_SANITIZE_ADDRESS |
@@ -348,6 +350,7 @@ inline bool isPageHeaderAddress(Address address) |
// Note: An object whose size is between |largeObjectSizeThreshold| and |
// |blinkPageSize| can go to either of NormalPage or LargeObjectPage. |
class BasePage { |
+ DISALLOW_NEW_EXCEPT_PLACEMENT_NEW(); |
public: |
BasePage(PageMemory*, BaseHeap*); |
virtual ~BasePage() { } |
@@ -574,14 +577,13 @@ private: |
// The HeapDoesNotContainCache is a negative cache, so it must be flushed when |
// memory is added to the heap. |
class HeapDoesNotContainCache { |
+ USING_FAST_MALLOC(HeapDoesNotContainCache); |
public: |
- HeapDoesNotContainCache() |
- : m_entries(adoptArrayPtr(new Address[HeapDoesNotContainCache::numberOfEntries])) |
- , m_hasEntries(false) |
+ static HeapDoesNotContainCache* create() |
{ |
- // Start by flushing the cache in a non-empty state to initialize all the cache entries. |
- for (int i = 0; i < numberOfEntries; ++i) |
- m_entries[i] = nullptr; |
+ size_t size = sizeof(HeapDoesNotContainCache) + sizeof(Address) * HeapDoesNotContainCache::numberOfEntries; |
haraken
2016/01/20 10:52:27
Can we use a Vector?
tasak
2016/01/21 04:37:46
Yes... but I think, it's too much, because m_entri
haraken
2016/01/21 04:52:57
Then can we write something like:
class HeapDoesN
tasak
2016/01/26 02:54:45
I see. Sure. Done.
|
+ HeapDoesNotContainCache* cache = static_cast<HeapDoesNotContainCache*>(WTF::Partitions::fastMalloc(size, "HeapDoesNotContainCache")); |
+ return new (cache) HeapDoesNotContainCache(reinterpret_cast<Address*>(cache + 1)); |
} |
void flush(); |
@@ -601,16 +603,27 @@ public: |
PLATFORM_EXPORT void addEntry(Address); |
private: |
+ HeapDoesNotContainCache() = delete; |
+ HeapDoesNotContainCache(Address* entries) |
+ : m_entries(entries) |
+ , m_hasEntries(false) |
+ { |
+ // Start by flushing the cache in a non-empty state to initialize all the cache entries. |
+ for (int i = 0; i < numberOfEntries; ++i) |
+ m_entries[i] = nullptr; |
+ } |
+ |
static const int numberOfEntriesLog2 = 12; |
static const int numberOfEntries = 1 << numberOfEntriesLog2; |
static size_t hash(Address); |
- WTF::OwnPtr<Address[]> m_entries; |
+ Address* m_entries; |
bool m_hasEntries; |
}; |
class FreeList { |
+ DISALLOW_NEW(); |
public: |
FreeList(); |
@@ -646,6 +659,7 @@ private: |
// NormalPageHeap represents a heap that contains NormalPages |
// and LargeObjectHeap represents a heap that contains LargeObjectPages. |
class PLATFORM_EXPORT BaseHeap { |
+ USING_FAST_MALLOC(BaseHeap); |
public: |
BaseHeap(ThreadState*, int); |
virtual ~BaseHeap(); |