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

Unified Diff: src/heap/gc-idle-time-handler.cc

Issue 1072363002: Make full GC reduce memory footprint an explicit event in the idle notification handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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
Index: src/heap/gc-idle-time-handler.cc
diff --git a/src/heap/gc-idle-time-handler.cc b/src/heap/gc-idle-time-handler.cc
index a3383b9c0c0dcde34864a7fbbafef853d24d5d55..5d12ac21bea9e0cbc3891bdd9a3b24272d1ab8a7 100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -39,6 +39,9 @@ void GCIdleTimeAction::Print() {
case DO_FULL_GC:
PrintF("full GC");
break;
+ case DO_FULL_GC_COMPACT:
+ PrintF("full GC compact");
+ break;
case DO_FINALIZE_SWEEPING:
PrintF("finalize sweeping");
break;
@@ -156,10 +159,15 @@ bool GCIdleTimeHandler::ShouldDoScavenge(
bool GCIdleTimeHandler::ShouldDoMarkCompact(
size_t idle_time_in_ms, size_t size_of_objects,
size_t mark_compact_speed_in_bytes_per_ms) {
- return idle_time_in_ms >= kMaxScheduledIdleTime &&
- idle_time_in_ms >=
- EstimateMarkCompactTime(size_of_objects,
- mark_compact_speed_in_bytes_per_ms);
+ return idle_time_in_ms >=
+ EstimateMarkCompactTime(size_of_objects,
+ mark_compact_speed_in_bytes_per_ms);
+}
+
+
+bool GCIdleTimeHandler::ShouldDoReduceMemoryMarkCompact(
+ size_t idle_time_in_ms) {
+ return idle_time_in_ms >= kMinTimeForReduceMemory;
}
@@ -207,13 +215,14 @@ GCIdleTimeAction GCIdleTimeHandler::NothingOrDone() {
// (3) If there is currently no MarkCompact idle round going on, we start a
// new idle round if enough garbage was created. Otherwise we do not perform
// garbage collection to keep system utilization low.
-// (4) If incremental marking is done, we perform a full garbage collection
-// if we are allowed to still do full garbage collections during this idle
+// (4) If we have long idle time, we try to reduce the memory footprint.
+// (5) If incremental marking is done, we perform a full garbage collection
+// if we are allowed to still do full garbage collections during this idle
// round or if we are not allowed to start incremental marking. Otherwise we
// do not perform garbage collection to keep system utilization low.
-// (5) If sweeping is in progress and we received a large enough idle time
+// (6) If sweeping is in progress and we received a large enough idle time
// request, we finalize sweeping here.
-// (6) If incremental marking is in progress, we perform a marking step. Note,
+// (7) If incremental marking is in progress, we perform a marking step. Note,
// that this currently may trigger a full garbage collection.
GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
HeapState heap_state) {
@@ -247,6 +256,10 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
}
}
+ if (ShouldDoReduceMemoryMarkCompact(static_cast<size_t>(idle_time_in_ms))) {
+ return GCIdleTimeAction::FullGCCompact();
+ }
+
if (heap_state.incremental_marking_stopped) {
if (ShouldDoMarkCompact(static_cast<size_t>(idle_time_in_ms),
heap_state.size_of_objects,

Powered by Google App Engine
This is Rietveld 408576698