| Index: third_party/WebKit/Source/platform/heap/HeapPage.cpp
|
| diff --git a/third_party/WebKit/Source/platform/heap/HeapPage.cpp b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
|
| index a739f1dfbb3dcf5f2e3657d27c25d6d80879dd3f..a54c3fad8cfa56257ac5b04d6836e94d3c9bd6b9 100644
|
| --- a/third_party/WebKit/Source/platform/heap/HeapPage.cpp
|
| +++ b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
|
| @@ -99,7 +99,7 @@ void HeapObjectHeader::zapMagic()
|
| void HeapObjectHeader::finalize(Address object, size_t objectSize)
|
| {
|
| HeapAllocHooks::freeHookIfEnabled(object);
|
| - const GCInfo* gcInfo = Heap::gcInfo(gcInfoIndex());
|
| + const GCInfo* gcInfo = ThreadHeap::gcInfo(gcInfoIndex());
|
| if (gcInfo->hasFinalizer())
|
| gcInfo->m_finalize(object);
|
|
|
| @@ -127,8 +127,8 @@ void BaseArena::cleanupPages()
|
| ASSERT(!m_firstUnsweptPage);
|
| // Add the BaseArena's pages to the orphanedPagePool.
|
| for (BasePage* page = m_firstPage; page; page = page->next()) {
|
| - Heap::decreaseAllocatedSpace(page->size());
|
| - Heap::getOrphanedPagePool()->addOrphanedPage(arenaIndex(), page);
|
| + getThreadState()->heap().heapStats().decreaseAllocatedSpace(page->size());
|
| + getThreadState()->heap().getOrphanedPagePool()->addOrphanedPage(arenaIndex(), page);
|
| }
|
| m_firstPage = nullptr;
|
| }
|
| @@ -283,7 +283,7 @@ Address BaseArena::lazySweep(size_t allocationSize, size_t gcInfoIndex)
|
| double startTime = WTF::currentTimeMS();
|
| Address result = lazySweepPages(allocationSize, gcInfoIndex);
|
| getThreadState()->accumulateSweepingTime(WTF::currentTimeMS() - startTime);
|
| - Heap::reportMemoryUsageForTracing();
|
| + ThreadHeap::reportMemoryUsageForTracing();
|
|
|
| return result;
|
| }
|
| @@ -321,13 +321,13 @@ bool BaseArena::lazySweepWithDeadline(double deadlineSeconds)
|
| if (pageCount % deadlineCheckInterval == 0) {
|
| if (deadlineSeconds <= monotonicallyIncreasingTime()) {
|
| // Deadline has come.
|
| - Heap::reportMemoryUsageForTracing();
|
| + ThreadHeap::reportMemoryUsageForTracing();
|
| return !m_firstUnsweptPage;
|
| }
|
| }
|
| pageCount++;
|
| }
|
| - Heap::reportMemoryUsageForTracing();
|
| + ThreadHeap::reportMemoryUsageForTracing();
|
| return true;
|
| }
|
|
|
| @@ -340,7 +340,7 @@ void BaseArena::completeSweep()
|
| while (m_firstUnsweptPage) {
|
| sweepUnsweptPage();
|
| }
|
| - Heap::reportMemoryUsageForTracing();
|
| + ThreadHeap::reportMemoryUsageForTracing();
|
| }
|
|
|
| NormalPageArena::NormalPageArena(ThreadState* state, int index)
|
| @@ -399,7 +399,7 @@ void NormalPageArena::takeFreelistSnapshot(const String& dumpName)
|
| void NormalPageArena::allocatePage()
|
| {
|
| getThreadState()->shouldFlushHeapDoesNotContainCache();
|
| - PageMemory* pageMemory = Heap::getFreePagePool()->takeFreePage(arenaIndex());
|
| + PageMemory* pageMemory = getThreadState()->heap().getFreePagePool()->takeFreePage(arenaIndex());
|
|
|
| if (!pageMemory) {
|
| // Allocate a memory region for blinkPagesPerRegion pages that
|
| @@ -407,7 +407,7 @@ void NormalPageArena::allocatePage()
|
| //
|
| // [ guard os page | ... payload ... | guard os page ]
|
| // ^---{ aligned to blink page size }
|
| - PageMemoryRegion* region = PageMemoryRegion::allocateNormalPages(Heap::getRegionTree());
|
| + PageMemoryRegion* region = PageMemoryRegion::allocateNormalPages(getThreadState()->heap().getRegionTree());
|
|
|
| // Setup the PageMemory object for each of the pages in the region.
|
| for (size_t i = 0; i < blinkPagesPerRegion; ++i) {
|
| @@ -422,7 +422,7 @@ void NormalPageArena::allocatePage()
|
| RELEASE_ASSERT(result);
|
| pageMemory = memory;
|
| } else {
|
| - Heap::getFreePagePool()->addFreePage(arenaIndex(), memory);
|
| + getThreadState()->heap().getFreePagePool()->addFreePage(arenaIndex(), memory);
|
| }
|
| }
|
| }
|
| @@ -430,7 +430,7 @@ void NormalPageArena::allocatePage()
|
| NormalPage* page = new (pageMemory->writableStart()) NormalPage(pageMemory, this);
|
| page->link(&m_firstPage);
|
|
|
| - Heap::increaseAllocatedSpace(page->size());
|
| + getThreadState()->heap().heapStats().increaseAllocatedSpace(page->size());
|
| #if ENABLE(ASSERT) || defined(LEAK_SANITIZER) || defined(ADDRESS_SANITIZER)
|
| // Allow the following addToFreeList() to add the newly allocated memory
|
| // to the free list.
|
| @@ -445,7 +445,7 @@ void NormalPageArena::allocatePage()
|
|
|
| void NormalPageArena::freePage(NormalPage* page)
|
| {
|
| - Heap::decreaseAllocatedSpace(page->size());
|
| + getThreadState()->heap().heapStats().decreaseAllocatedSpace(page->size());
|
|
|
| if (page->terminating()) {
|
| // The thread is shutting down and this page is being removed as a part
|
| @@ -456,11 +456,11 @@ void NormalPageArena::freePage(NormalPage* page)
|
| // ensures that tracing the dangling pointer in the next global GC just
|
| // crashes instead of causing use-after-frees. After the next global
|
| // GC, the orphaned pages are removed.
|
| - Heap::getOrphanedPagePool()->addOrphanedPage(arenaIndex(), page);
|
| + getThreadState()->heap().getOrphanedPagePool()->addOrphanedPage(arenaIndex(), page);
|
| } else {
|
| PageMemory* memory = page->storage();
|
| page->~NormalPage();
|
| - Heap::getFreePagePool()->addFreePage(arenaIndex(), memory);
|
| + getThreadState()->heap().getFreePagePool()->addFreePage(arenaIndex(), memory);
|
| }
|
| }
|
|
|
| @@ -566,7 +566,7 @@ bool NormalPageArena::expandObject(HeapObjectHeader* header, size_t newSize)
|
| ASSERT(header->checkHeader());
|
| if (header->payloadSize() >= newSize)
|
| return true;
|
| - size_t allocationSize = Heap::allocationSizeFromSize(newSize);
|
| + size_t allocationSize = ThreadHeap::allocationSizeFromSize(newSize);
|
| ASSERT(allocationSize > header->size());
|
| size_t expandSize = allocationSize - header->size();
|
| if (isObjectAllocatedAtAllocationPoint(header) && expandSize <= m_remainingAllocationSize) {
|
| @@ -586,7 +586,7 @@ bool NormalPageArena::shrinkObject(HeapObjectHeader* header, size_t newSize)
|
| {
|
| ASSERT(header->checkHeader());
|
| ASSERT(header->payloadSize() > newSize);
|
| - size_t allocationSize = Heap::allocationSizeFromSize(newSize);
|
| + size_t allocationSize = ThreadHeap::allocationSizeFromSize(newSize);
|
| ASSERT(header->size() > allocationSize);
|
| size_t shrinkSize = header->size() - allocationSize;
|
| if (isObjectAllocatedAtAllocationPoint(header)) {
|
| @@ -797,7 +797,7 @@ Address LargeObjectArena::doAllocateLargeObjectPage(size_t allocationSize, size_
|
| #endif
|
|
|
| getThreadState()->shouldFlushHeapDoesNotContainCache();
|
| - PageMemory* pageMemory = PageMemory::allocate(largeObjectSize, Heap::getRegionTree());
|
| + PageMemory* pageMemory = PageMemory::allocate(largeObjectSize, getThreadState()->heap().getRegionTree());
|
| Address largeObjectAddress = pageMemory->writableStart();
|
| Address headerAddress = largeObjectAddress + LargeObjectPage::pageHeaderSize();
|
| #if ENABLE(ASSERT)
|
| @@ -818,7 +818,7 @@ Address LargeObjectArena::doAllocateLargeObjectPage(size_t allocationSize, size_
|
|
|
| largeObject->link(&m_firstPage);
|
|
|
| - Heap::increaseAllocatedSpace(largeObject->size());
|
| + getThreadState()->heap().heapStats().increaseAllocatedSpace(largeObject->size());
|
| getThreadState()->increaseAllocatedObjectSize(largeObject->size());
|
| return result;
|
| }
|
| @@ -827,7 +827,7 @@ void LargeObjectArena::freeLargeObjectPage(LargeObjectPage* object)
|
| {
|
| ASAN_UNPOISON_MEMORY_REGION(object->payload(), object->payloadSize());
|
| object->heapObjectHeader()->finalize(object->payload(), object->payloadSize());
|
| - Heap::decreaseAllocatedSpace(object->size());
|
| + getThreadState()->heap().heapStats().decreaseAllocatedSpace(object->size());
|
|
|
| // Unpoison the object header and allocationGranularity bytes after the
|
| // object before freeing.
|
| @@ -844,7 +844,7 @@ void LargeObjectArena::freeLargeObjectPage(LargeObjectPage* object)
|
| // ensures that tracing the dangling pointer in the next global GC just
|
| // crashes instead of causing use-after-frees. After the next global
|
| // GC, the orphaned pages are removed.
|
| - Heap::getOrphanedPagePool()->addOrphanedPage(arenaIndex(), object);
|
| + getThreadState()->heap().getOrphanedPagePool()->addOrphanedPage(arenaIndex(), object);
|
| } else {
|
| ASSERT(!ThreadState::current()->isTerminating());
|
| PageMemory* memory = object->storage();
|
| @@ -1141,7 +1141,7 @@ void NormalPage::sweep()
|
| #if !ENABLE(ASSERT) && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER)
|
| // Discarding pages increases page faults and may regress performance.
|
| // So we enable this only on low-RAM devices.
|
| - if (Heap::isLowEndDevice())
|
| + if (ProcessHeap::isLowEndDevice())
|
| discardPages(startOfGap + sizeof(FreeListEntry), headerAddress);
|
| #endif
|
| }
|
| @@ -1153,7 +1153,7 @@ void NormalPage::sweep()
|
| if (startOfGap != payloadEnd()) {
|
| pageArena->addToFreeList(startOfGap, payloadEnd() - startOfGap);
|
| #if !ENABLE(ASSERT) && !defined(LEAK_SANITIZER) && !defined(ADDRESS_SANITIZER)
|
| - if (Heap::isLowEndDevice())
|
| + if (ProcessHeap::isLowEndDevice())
|
| discardPages(startOfGap + sizeof(FreeListEntry), payloadEnd());
|
| #endif
|
| }
|
| @@ -1319,7 +1319,7 @@ static bool isUninitializedMemory(void* objectPointer, size_t objectSize)
|
| static void markPointer(Visitor* visitor, HeapObjectHeader* header)
|
| {
|
| ASSERT(header->checkHeader());
|
| - const GCInfo* gcInfo = Heap::gcInfo(header->gcInfoIndex());
|
| + const GCInfo* gcInfo = ThreadHeap::gcInfo(header->gcInfoIndex());
|
| if (gcInfo->hasVTable() && !vTableInitialized(header->payload())) {
|
| // We hit this branch when a GC strikes before GarbageCollected<>'s
|
| // constructor runs.
|
|
|