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

Unified Diff: src/heap/heap.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/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 1fe546386ba8d8baa5c452f87a218a19a2111781..e97a5a17e6f30f138ec846254323ec966bf0b3a8 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4533,14 +4533,15 @@ void Heap::MakeHeapIterable() {
}
-void Heap::IdleMarkCompact(const char* message) {
+void Heap::IdleMarkCompact(bool reduce_memory, const char* message) {
bool uncommit = false;
if (gc_count_at_last_idle_gc_ == gc_count_) {
// No GC since the last full GC, the mutator is probably not active.
isolate_->compilation_cache()->Clear();
uncommit = true;
}
- CollectAllGarbage(kReduceMemoryFootprintMask, message);
+ int flags = reduce_memory ? kReduceMemoryFootprintMask : kNoGCFlags;
+ CollectAllGarbage(flags, message);
gc_idle_time_handler_.NotifyIdleMarkCompact();
gc_count_at_last_idle_gc_ = gc_count_;
if (uncommit) {
@@ -4672,10 +4673,14 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
gc_idle_time_handler_.NotifyIdleMarkCompact();
gc_count_at_last_idle_gc_ = gc_count_;
} else {
- IdleMarkCompact("idle notification: finalize idle round");
+ IdleMarkCompact(false, "idle notification: finalize idle round");
}
break;
}
+ case DO_FULL_GC_COMPACT: {
+ IdleMarkCompact(true, "idle notification: reduce memory footprint");
+ break;
+ }
case DO_SCAVENGE:
CollectGarbage(NEW_SPACE, "idle notification: scavenge");
break;

Powered by Google App Engine
This is Rietveld 408576698