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

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

Issue 1252683003: Oilpan: Schedule a precise GC when a page navigates (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 4 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
« Source/core/dom/Document.h ('K') | « 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 f751bba454a88eeb6e42e80aaae8a002596dcfe4..99f72401c13e3becef994587052d23267affd5d3 100644
--- a/Source/platform/heap/ThreadState.cpp
+++ b/Source/platform/heap/ThreadState.cpp
@@ -650,6 +650,24 @@ bool ThreadState::shouldSchedulePreciseGC()
#endif
}
+void ThreadState::schedulePageNavigationGCIfNeeded(float estimatedRemovalRatio)
+{
haraken 2015/08/06 07:52:43 Add: if (UNLIKELY(isGCForbidden())) return
keishi 2015/08/11 06:59:53 Done.
+ // Avoid potential overflow by truncating to Kb.
+ size_t allocatedObjectSizeKb = Heap::allocatedObjectSize() >> 10;
+ // The estimated size is updated when the main thread finishes lazy
+ // sweeping. If this thread reaches here before the main thread finishes
+ // lazy sweeping, the thread will use the estimated size of the last GC.
+ size_t estimatedLiveObjectSizeKb = (estimatedLiveObjectSize() >> 10) * (1 - estimatedRemovalRatio);
+ // Heap::markedObjectSize() may be underestimated if any thread has not
+ // finished completeSweep().
+ size_t currentObjectSizeKb = currentObjectSize() >> 10;
+ // Schedule a precise GC if Oilpan has allocated more than 1 MB since
+ // the last GC and the current memory usage is >50% larger than
+ // the estimated live memory usage.
+ if (allocatedObjectSizeKb >= 1024 && currentObjectSizeKb > (estimatedLiveObjectSizeKb * 3) / 2)
+ schedulePreciseGC();
+}
haraken 2015/08/06 07:52:42 bool ThreadState::shouldSchedulePageNavigationGC(f
keishi 2015/08/11 06:59:53 Done.
+
// TODO(haraken): We should improve the GC heuristics.
// These heuristics affect performance significantly.
bool ThreadState::shouldForceConservativeGC()
@@ -908,7 +926,7 @@ void ThreadState::runScheduledGC(StackState stackState)
Heap::collectAllGarbage();
break;
case PreciseGCScheduled:
- Heap::collectGarbage(NoHeapPointersOnStack, GCWithoutSweep, Heap::PreciseGC);
+ Heap::collectGarbage(NoHeapPointersOnStack, GCWithSweep, Heap::PreciseGC);
haraken 2015/08/06 07:52:43 Hmm, I'm fine with forcing sweeping for navigation
keishi 2015/08/11 06:59:53 Done.
break;
case IdleGCScheduled:
// Idle time GC will be scheduled by Blink Scheduler.
« Source/core/dom/Document.h ('K') | « Source/platform/heap/ThreadState.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698