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

Unified Diff: Source/platform/heap/Heap.cpp

Issue 1113093003: Oilpan: Move HeapAllocator methods to HeapAllocator.h (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/HeapAllocator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/Heap.cpp
diff --git a/Source/platform/heap/Heap.cpp b/Source/platform/heap/Heap.cpp
index f6ba2144e9c9c2302887e1d42b43e6f52b00aefd..a525cdf0229273c896c26b29006aefd3390606fd 100644
--- a/Source/platform/heap/Heap.cpp
+++ b/Source/platform/heap/Heap.cpp
@@ -2501,116 +2501,6 @@ size_t Heap::objectPayloadSizeForTesting()
return objectPayloadSize;
}
-void HeapAllocator::backingFree(void* address)
-{
- if (!address)
- return;
-
- ThreadState* state = ThreadState::current();
- if (state->sweepForbidden())
- return;
- ASSERT(!state->isInGC());
-
- // Don't promptly free large objects because their page is never reused.
- // Don't free backings allocated on other threads.
- BasePage* page = pageFromObject(address);
- if (page->isLargeObjectPage() || page->heap()->threadState() != state)
- return;
-
- HeapObjectHeader* header = HeapObjectHeader::fromPayload(address);
- header->checkHeader();
- NormalPageHeap* heap = static_cast<NormalPage*>(page)->heapForNormalPage();
- state->promptlyFreed(header->gcInfoIndex());
- heap->promptlyFreeObject(header);
-}
-
-void HeapAllocator::freeVectorBacking(void* address)
-{
- backingFree(address);
-}
-
-void HeapAllocator::freeInlineVectorBacking(void* address)
-{
- backingFree(address);
-}
-
-void HeapAllocator::freeHashTableBacking(void* address)
-{
- backingFree(address);
-}
-
-bool HeapAllocator::backingExpand(void* address, size_t newSize)
-{
- if (!address)
- return false;
-
- ThreadState* state = ThreadState::current();
- if (state->sweepForbidden())
- return false;
- ASSERT(!state->isInGC());
- ASSERT(state->isAllocationAllowed());
-
- // FIXME: Support expand for large objects.
- // Don't expand backings allocated on other threads.
- BasePage* page = pageFromObject(address);
- if (page->isLargeObjectPage() || page->heap()->threadState() != state)
- return false;
-
- HeapObjectHeader* header = HeapObjectHeader::fromPayload(address);
- header->checkHeader();
- NormalPageHeap* heap = static_cast<NormalPage*>(page)->heapForNormalPage();
- bool succeed = heap->expandObject(header, newSize);
- if (succeed)
- state->allocationPointAdjusted(heap->heapIndex());
- return succeed;
-}
-
-bool HeapAllocator::expandVectorBacking(void* address, size_t newSize)
-{
- return backingExpand(address, newSize);
-}
-
-bool HeapAllocator::expandInlineVectorBacking(void* address, size_t newSize)
-{
- return backingExpand(address, newSize);
-}
-
-bool HeapAllocator::expandHashTableBacking(void* address, size_t newSize)
-{
- return backingExpand(address, newSize);
-}
-
-void HeapAllocator::backingShrink(void* address, size_t quantizedCurrentSize, size_t quantizedShrunkSize)
-{
- // We shrink the object only if the shrinking will make a non-small
- // prompt-free block.
- // FIXME: Optimize the threshold size.
- if (quantizedCurrentSize <= quantizedShrunkSize + sizeof(HeapObjectHeader) + sizeof(void*) * 32)
- return;
-
- if (!address)
- return;
-
- ThreadState* state = ThreadState::current();
- if (state->sweepForbidden())
- return;
- ASSERT(!state->isInGC());
- ASSERT(state->isAllocationAllowed());
-
- // FIXME: Support shrink for large objects.
- // Don't shrink backings allocated on other threads.
- BasePage* page = pageFromObject(address);
- if (page->isLargeObjectPage() || page->heap()->threadState() != state)
- return;
-
- HeapObjectHeader* header = HeapObjectHeader::fromPayload(address);
- header->checkHeader();
- NormalPageHeap* heap = static_cast<NormalPage*>(page)->heapForNormalPage();
- bool succeed = heap->shrinkObject(header, quantizedShrunkSize);
- if (succeed)
- state->allocationPointAdjusted(heap->heapIndex());
-}
-
BasePage* Heap::lookup(Address address)
{
ASSERT(ThreadState::current()->isInGC());
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/HeapAllocator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698