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

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

Issue 850663002: Oilpan: fix computation of ThreadState::m_collectionRate. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: compute m_collectionRate in postGC() Created 5 years, 11 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/ThreadState.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/ThreadState.cpp
diff --git a/Source/platform/heap/ThreadState.cpp b/Source/platform/heap/ThreadState.cpp
index deaa5135d82c09596854b74a0164c6e37fec1fe5..4322bac7365fc1242b8fc16090670446ee4989eb 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -857,16 +857,6 @@ void ThreadState::completeSweep()
m_heaps[i]->completeSweep();
}
- if (isMainThread()) {
- // FIXME: Heap::markedObjectSize() may not be accurate because other
- // threads may not have finished sweeping.
- m_collectionRate = 1.0 * Heap::markedObjectSize() / m_allocatedObjectSizeBeforeSweeping;
- } else {
- // FIXME: We should make m_lowCollectionRate available in non-main
- // threads.
- m_collectionRate = 1.0;
- }
-
setGCState(gcState() == Sweeping ? NoGCScheduled : GCScheduled);
}
@@ -893,12 +883,24 @@ void ThreadState::preGC()
makeConsistentForSweeping();
prepareRegionTree();
flushHeapDoesNotContainCacheIfNeeded();
+ if (isMainThread())
+ m_allocatedObjectSizeBeforeGC = Heap::allocatedObjectSize() + Heap::markedObjectSize();
}
void ThreadState::postGC(GCType gcType)
{
ASSERT(isInGC());
setGCState(gcType == GCWithSweep ? EagerSweepScheduled : LazySweepScheduled);
+ if (isMainThread() && m_allocatedObjectSizeBeforeGC) {
+ // FIXME: Heap::markedObjectSize() may not be accurate because other
+ // threads may not have finished sweeping.
+ m_collectionRate = 1.0 * Heap::markedObjectSize() / m_allocatedObjectSizeBeforeGC;
haraken 2015/01/14 01:36:26 Heap::markedObjectSize() is accumulated in the (la
sof 2015/01/14 06:14:27 Thanks, I realized the same overnight. Sorry about
sof 2015/01/14 09:53:24 Now tidied, to some extent. The lagging sweeps acr
+ ASSERT(m_collectionRate >= 0. && m_collectionRate <= 1.);
+ } else {
+ // FIXME: We should make m_collectionRate available in non-main threads.
+ m_collectionRate = 1.0;
+ }
+
for (int i = 0; i < NumberOfHeaps; i++)
m_heaps[i]->prepareForSweep();
}
@@ -1037,8 +1039,6 @@ void ThreadState::postGCProcessing()
return;
m_didV8GCAfterLastGC = false;
- if (isMainThread())
- m_allocatedObjectSizeBeforeSweeping = Heap::allocatedObjectSize();
#if ENABLE(GC_PROFILE_HEAP)
// We snapshot the heap prior to sweeping to get numbers for both resources
« no previous file with comments | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698