Chromium Code Reviews| 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 10b30f8de75112e2dafff32746ad59ed959836b9..b2dd15fddcaea22a91d61606c3ec805a2e3ce2ed 100644 |
| --- a/third_party/WebKit/Source/platform/heap/HeapPage.cpp |
| +++ b/third_party/WebKit/Source/platform/heap/HeapPage.cpp |
| @@ -127,8 +127,8 @@ 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()); |
| - Heap::orphanedPagePool()->addOrphanedPage(heapIndex(), page); |
| + ThreadState::current()->decreaseAllocatedSpace(page->size()); |
| + ThreadState::current()->orphanedPagePool()->addOrphanedPage(heapIndex(), page); |
| } |
| m_firstPage = nullptr; |
| } |
| @@ -306,7 +306,7 @@ Address BaseHeap::lazySweep(size_t allocationSize, size_t gcInfoIndex) |
| ScriptForbiddenScope::exit(); |
| threadState()->accumulateSweepingTime(WTF::currentTimeMS() - startTime); |
| - Heap::reportMemoryUsageForTracing(); |
| + threadState()->reportMemoryUsageForTracing(); |
| return result; |
| } |
| @@ -344,13 +344,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; |
| } |
| @@ -363,7 +363,7 @@ void BaseHeap::completeSweep() |
| while (m_firstUnsweptPage) { |
| sweepUnsweptPage(); |
| } |
| - Heap::reportMemoryUsageForTracing(); |
| + threadState()->reportMemoryUsageForTracing(); |
| } |
| NormalPageHeap::NormalPageHeap(ThreadState* state, int index) |
| @@ -422,7 +422,7 @@ void NormalPageHeap::takeFreelistSnapshot(const String& dumpName) |
| void NormalPageHeap::allocatePage() |
| { |
| threadState()->shouldFlushHeapDoesNotContainCache(); |
| - PageMemory* pageMemory = Heap::freePagePool()->takeFreePage(heapIndex()); |
| + PageMemory* pageMemory = threadState()->freePagePool()->takeFreePage(heapIndex()); |
| if (!pageMemory) { |
| // Allocate a memory region for blinkPagesPerRegion pages that |
| @@ -445,7 +445,7 @@ void NormalPageHeap::allocatePage() |
| RELEASE_ASSERT(result); |
| pageMemory = memory; |
| } else { |
| - Heap::freePagePool()->addFreePage(heapIndex(), memory); |
| + threadState()->freePagePool()->addFreePage(heapIndex(), memory); |
| } |
| } |
| } |
| @@ -453,7 +453,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. |
| @@ -468,7 +468,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 |
| @@ -479,11 +479,11 @@ void NormalPageHeap::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::orphanedPagePool()->addOrphanedPage(heapIndex(), page); |
| + ThreadState::current()->orphanedPagePool()->addOrphanedPage(heapIndex(), page); |
| } else { |
| PageMemory* memory = page->storage(); |
| page->~NormalPage(); |
| - Heap::freePagePool()->addFreePage(heapIndex(), memory); |
| + threadState()->freePagePool()->addFreePage(heapIndex(), memory); |
| } |
| } |
| @@ -549,7 +549,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; |
| @@ -667,16 +667,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()); |
| @@ -842,8 +842,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; |
| } |
| @@ -851,7 +851,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. |
| @@ -868,7 +868,7 @@ void LargeObjectHeap::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::orphanedPagePool()->addOrphanedPage(heapIndex(), object); |
| + ThreadState::current()->orphanedPagePool()->addOrphanedPage(heapIndex(), object); |
| } else { |
| ASSERT(!ThreadState::current()->isTerminating()); |
| PageMemory* memory = object->storage(); |
| @@ -1163,7 +1163,7 @@ void NormalPage::sweep() |
| heapForNormalPage()->addToFreeList(startOfGap, payloadEnd() - startOfGap); |
| if (markedObjectSize) |
| - Heap::increaseMarkedObjectSize(markedObjectSize); |
| + ThreadState::current()->increaseMarkedObjectSize(markedObjectSize); |
| } |
| void NormalPage::makeConsistentForGC() |
| @@ -1188,7 +1188,7 @@ void NormalPage::makeConsistentForGC() |
| headerAddress += header->size(); |
| } |
| if (markedObjectSize) |
| - Heap::increaseMarkedObjectSize(markedObjectSize); |
| + ThreadState::current()->increaseMarkedObjectSize(markedObjectSize); |
| } |
| void NormalPage::makeConsistentForMutator() |
| @@ -1460,7 +1460,7 @@ void LargeObjectPage::removeFromHeap() |
| void LargeObjectPage::sweep() |
| { |
| heapObjectHeader()->unmark(); |
| - Heap::increaseMarkedObjectSize(size()); |
| + ThreadState::current()->increaseMarkedObjectSize(size()); |
|
haraken
2015/11/30 02:54:42
ThreadState::current() needs to look up thread-loc
|
| } |
| void LargeObjectPage::makeConsistentForGC() |
| @@ -1468,7 +1468,7 @@ void LargeObjectPage::makeConsistentForGC() |
| HeapObjectHeader* header = heapObjectHeader(); |
| if (header->isMarked()) { |
| header->unmark(); |
| - Heap::increaseMarkedObjectSize(size()); |
| + ThreadState::current()->increaseMarkedObjectSize(size()); |
| } else { |
| header->markDead(); |
| } |