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

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: handle no-op shrink attempts 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
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/HeapPage.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..d78e07281424c8f370c82fbab7e680207a49bf0f 100644
--- a/third_party/WebKit/Source/platform/heap/HeapAllocator.cpp
+++ b/third_party/WebKit/Source/platform/heap/HeapAllocator.cpp
@@ -88,14 +88,10 @@ 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)
+ if (!address || quantizedShrunkSize == quantizedCurrentSize)
return true;
- if (!address)
- return true;
+ ASSERT(quantizedShrunkSize < quantizedCurrentSize);
ThreadState* state = ThreadState::current();
if (state->sweepForbidden())
@@ -112,6 +108,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->isObjectAllocatedAtAllocationPoint(header))
+ return true;
+
bool succeededAtAllocationPoint = heap->shrinkObject(header, quantizedShrunkSize);
if (succeededAtAllocationPoint)
state->allocationPointAdjusted(heap->heapIndex());
« no previous file with comments | « no previous file | third_party/WebKit/Source/platform/heap/HeapPage.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698