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

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

Issue 1360763002: Sync m_lastRemainingAllocationSize on promptly freeing objects. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: invert the logic Created 5 years, 3 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/HeapPage.cpp
diff --git a/Source/platform/heap/HeapPage.cpp b/Source/platform/heap/HeapPage.cpp
index 85ca1afc8c9edc7b8ea0ae5b17d38c0f39776149..f38a2f87209ef0e56d46b03cdf0591412e87bd5a 100644
--- a/Source/platform/heap/HeapPage.cpp
+++ b/Source/platform/heap/HeapPage.cpp
@@ -667,11 +667,15 @@ void NormalPageHeap::promptlyFreeObject(HeapObjectHeader* header)
header->finalize(payload, payloadSize);
if (address + size == m_currentAllocationPoint) {
m_currentAllocationPoint = address;
- if (m_lastRemainingAllocationSize == m_remainingAllocationSize) {
- Heap::decreaseAllocatedObjectSize(size);
- m_lastRemainingAllocationSize += size;
- }
m_remainingAllocationSize += size;
+ // Sync recorded allocated-object size:
+ // - 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);
+ else if (m_lastRemainingAllocationSize != m_remainingAllocationSize)
+ Heap::decreaseAllocatedObjectSize(m_remainingAllocationSize - m_lastRemainingAllocationSize);
+ m_lastRemainingAllocationSize = m_remainingAllocationSize;
SET_MEMORY_INACCESSIBLE(address, size);
return;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698