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

Unified Diff: third_party/WebKit/Source/platform/heap/HeapAllocator.cpp

Issue 1393863004: Oilpan: always shrink tail-allocated backing storage (reland.) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 2 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
Index: third_party/WebKit/Source/platform/heap/HeapAllocator.cpp
diff --git a/third_party/WebKit/Source/platform/heap/HeapAllocator.cpp b/third_party/WebKit/Source/platform/heap/HeapAllocator.cpp
index 8d27428b2d4aa8084f36731368b34a4b7d6827ac..92c32fccfe243b45758e9c49a5d326d247bb92a2 100644
--- a/third_party/WebKit/Source/platform/heap/HeapAllocator.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.cpp
@@ -88,12 +88,6 @@ bool HeapAllocator::expandHashTableBacking(void* address, size_t newSize)
bool 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 true;
-
if (!address)
return true;
@@ -112,6 +106,12 @@ bool HeapAllocator::backingShrink(void* address, size_t quantizedCurrentSize, si
HeapObjectHeader* header = HeapObjectHeader::fromPayload(address);
ASSERT(header->checkHeader());
NormalPageHeap* heap = static_cast<NormalPage*>(page)->heapForNormalPage();
+ // 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 && !heap->isObjectAllocatedLast(header))
+ return true;
+
bool succeededAtAllocationPoint = heap->shrinkObject(header, quantizedShrunkSize);
if (succeededAtAllocationPoint)
state->allocationPointAdjusted(heap->heapIndex());

Powered by Google App Engine
This is Rietveld 408576698