| 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 48fef56bb8d22195b33ce7ad3b0c8a15ffeb2b25..07a6977bad8e055e168579b7a1a893efb93d18b1 100644
|
| --- a/third_party/WebKit/Source/platform/heap/HeapPage.cpp
|
| +++ b/third_party/WebKit/Source/platform/heap/HeapPage.cpp
|
| @@ -126,7 +126,7 @@ void BaseHeap::cleanupPages()
|
| ASSERT(!m_firstUnsweptPage);
|
| // Add the BaseHeap's pages to the orphanedPagePool.
|
| for (BasePage* page = m_firstPage; page; page = page->next()) {
|
| - Heap::decreaseAllocatedSpace(page->size());
|
| + threadState()->decreaseAllocatedSpace(page->size());
|
| Heap::orphanedPagePool()->addOrphanedPage(heapIndex(), page);
|
| }
|
| m_firstPage = nullptr;
|
| @@ -303,7 +303,7 @@ Address BaseHeap::lazySweep(size_t allocationSize, size_t gcInfoIndex)
|
| double startTime = WTF::currentTimeMS();
|
| Address result = lazySweepPages(allocationSize, gcInfoIndex);
|
| threadState()->accumulateSweepingTime(WTF::currentTimeMS() - startTime);
|
| - Heap::reportMemoryUsageForTracing();
|
| + threadState()->reportMemoryUsageForTracing();
|
|
|
| return result;
|
| }
|
| @@ -341,13 +341,13 @@ bool BaseHeap::lazySweepWithDeadline(double deadlineSeconds)
|
| if (pageCount % deadlineCheckInterval == 0) {
|
| if (deadlineSeconds <= Platform::current()->monotonicallyIncreasingTimeSeconds()) {
|
| // Deadline has come.
|
| - Heap::reportMemoryUsageForTracing();
|
| + threadState()->reportMemoryUsageForTracing();
|
| return !m_firstUnsweptPage;
|
| }
|
| }
|
| pageCount++;
|
| }
|
| - Heap::reportMemoryUsageForTracing();
|
| + threadState()->reportMemoryUsageForTracing();
|
| return true;
|
| }
|
|
|
| @@ -360,7 +360,7 @@ void BaseHeap::completeSweep()
|
| while (m_firstUnsweptPage) {
|
| sweepUnsweptPage();
|
| }
|
| - Heap::reportMemoryUsageForTracing();
|
| + threadState()->reportMemoryUsageForTracing();
|
| }
|
|
|
| NormalPageHeap::NormalPageHeap(ThreadState* state, int index)
|
| @@ -450,7 +450,7 @@ void NormalPageHeap::allocatePage()
|
| NormalPage* page = new (pageMemory->writableStart()) NormalPage(pageMemory, this);
|
| page->link(&m_firstPage);
|
|
|
| - Heap::increaseAllocatedSpace(page->size());
|
| + threadState()->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.
|
| @@ -465,7 +465,7 @@ void NormalPageHeap::allocatePage()
|
|
|
| void NormalPageHeap::freePage(NormalPage* page)
|
| {
|
| - Heap::decreaseAllocatedSpace(page->size());
|
| + ThreadState::current()->decreaseAllocatedSpace(page->size());
|
|
|
| if (page->terminating()) {
|
| // The thread is shutting down and this page is being removed as a part
|
| @@ -545,7 +545,7 @@ bool NormalPageHeap::coalesce()
|
| if (startOfGap != page->payloadEnd())
|
| addToFreeList(startOfGap, page->payloadEnd() - startOfGap);
|
| }
|
| - Heap::decreaseAllocatedObjectSize(freedSize);
|
| + threadState()->decreaseAllocatedObjectSize(freedSize);
|
| ASSERT(m_promptlyFreedSize == freedSize);
|
| m_promptlyFreedSize = 0;
|
| return true;
|
| @@ -663,16 +663,16 @@ void NormalPageHeap::setRemainingAllocationSize(size_t newRemainingAllocationSiz
|
| // - if previous alloc checkpoint is larger, allocation size has increased.
|
| // - if smaller, a net reduction in size since last call to updateRemainingAllocationSize().
|
| if (m_lastRemainingAllocationSize > m_remainingAllocationSize)
|
| - Heap::increaseAllocatedObjectSize(m_lastRemainingAllocationSize - m_remainingAllocationSize);
|
| + threadState()->increaseAllocatedObjectSize(m_lastRemainingAllocationSize - m_remainingAllocationSize);
|
| else if (m_lastRemainingAllocationSize != m_remainingAllocationSize)
|
| - Heap::decreaseAllocatedObjectSize(m_remainingAllocationSize - m_lastRemainingAllocationSize);
|
| + threadState()->decreaseAllocatedObjectSize(m_remainingAllocationSize - m_lastRemainingAllocationSize);
|
| m_lastRemainingAllocationSize = m_remainingAllocationSize;
|
| }
|
|
|
| void NormalPageHeap::updateRemainingAllocationSize()
|
| {
|
| if (m_lastRemainingAllocationSize > remainingAllocationSize()) {
|
| - Heap::increaseAllocatedObjectSize(m_lastRemainingAllocationSize - remainingAllocationSize());
|
| + threadState()->increaseAllocatedObjectSize(m_lastRemainingAllocationSize - remainingAllocationSize());
|
| m_lastRemainingAllocationSize = remainingAllocationSize();
|
| }
|
| ASSERT(m_lastRemainingAllocationSize == remainingAllocationSize());
|
| @@ -838,8 +838,8 @@ Address LargeObjectHeap::doAllocateLargeObjectPage(size_t allocationSize, size_t
|
|
|
| largeObject->link(&m_firstPage);
|
|
|
| - Heap::increaseAllocatedSpace(largeObject->size());
|
| - Heap::increaseAllocatedObjectSize(largeObject->size());
|
| + threadState()->increaseAllocatedSpace(largeObject->size());
|
| + threadState()->increaseAllocatedObjectSize(largeObject->size());
|
| return result;
|
| }
|
|
|
| @@ -847,7 +847,7 @@ void LargeObjectHeap::freeLargeObjectPage(LargeObjectPage* object)
|
| {
|
| ASAN_UNPOISON_MEMORY_REGION(object->payload(), object->payloadSize());
|
| object->heapObjectHeader()->finalize(object->payload(), object->payloadSize());
|
| - Heap::decreaseAllocatedSpace(object->size());
|
| + ThreadState::current()->decreaseAllocatedSpace(object->size());
|
|
|
| // Unpoison the object header and allocationGranularity bytes after the
|
| // object before freeing.
|
| @@ -1157,7 +1157,7 @@ void NormalPage::sweep()
|
| heapForNormalPage()->addToFreeList(startOfGap, payloadEnd() - startOfGap);
|
|
|
| if (markedObjectSize)
|
| - Heap::increaseMarkedObjectSize(markedObjectSize);
|
| + ThreadState::current()->increaseMarkedObjectSize(markedObjectSize);
|
| }
|
|
|
| void NormalPage::makeConsistentForGC()
|
| @@ -1182,7 +1182,7 @@ void NormalPage::makeConsistentForGC()
|
| headerAddress += header->size();
|
| }
|
| if (markedObjectSize)
|
| - Heap::increaseMarkedObjectSize(markedObjectSize);
|
| + ThreadState::current()->increaseMarkedObjectSize(markedObjectSize);
|
| }
|
|
|
| void NormalPage::makeConsistentForMutator()
|
| @@ -1449,7 +1449,7 @@ void LargeObjectPage::removeFromHeap()
|
| void LargeObjectPage::sweep()
|
| {
|
| heapObjectHeader()->unmark();
|
| - Heap::increaseMarkedObjectSize(size());
|
| + ThreadState::current()->increaseMarkedObjectSize(size());
|
| }
|
|
|
| void LargeObjectPage::makeConsistentForGC()
|
| @@ -1457,7 +1457,7 @@ void LargeObjectPage::makeConsistentForGC()
|
| HeapObjectHeader* header = heapObjectHeader();
|
| if (header->isMarked()) {
|
| header->unmark();
|
| - Heap::increaseMarkedObjectSize(size());
|
| + ThreadState::current()->increaseMarkedObjectSize(size());
|
| } else {
|
| header->markDead();
|
| }
|
|
|