| 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());
|
|
|