Reviewers: Mads Ager, Description: Experimental change to idle notifications: Try to limit the interactions between idle notifications for background tabs and the context disposal GCs even further.
Please review this at http://codereview.chromium.org/698003 SVN Base: http://v8.googlecode.com/svn/branches/bleeding_edge/ Affected files: M src/heap.cc Index: src/heap.cc =================================================================== --- src/heap.cc (revision 4059) +++ src/heap.cc (working copy) @@ -3076,14 +3076,7 @@ static int number_idle_notifications = 0; static int last_gc_count = gc_count_; - if (!FLAG_expose_gc && (contexts_disposed_ > 0)) { - HistogramTimerScope scope(&Counters::gc_context); - CollectAllGarbage(false); - ASSERT(contexts_disposed_ == 0); - last_gc_count = gc_count_; - return false; - } - + bool uncommit = true; bool finished = false; if (last_gc_count == gc_count_) { @@ -3094,7 +3087,12 @@ } if (number_idle_notifications == kIdlesBeforeScavenge) { - CollectGarbage(0, NEW_SPACE); + if (contexts_disposed_ > 0) { + HistogramTimerScope scope(&Counters::gc_context); + CollectAllGarbage(false); + } else { + CollectGarbage(0, NEW_SPACE); + } new_space_.Shrink(); last_gc_count = gc_count_; @@ -3114,10 +3112,27 @@ last_gc_count = gc_count_; number_idle_notifications = 0; finished = true; + + } else if (contexts_disposed_ > 0) { + if (!FLAG_expose_gc) { + HistogramTimerScope scope(&Counters::gc_context); + CollectAllGarbage(false); + last_gc_count = gc_count_; + } + // If this is the first idle notification, we reset the + // notification count to avoid letting idle notifications for + // context disposal garbage collections start a potentially too + // aggressive idle GC cycle. + if (number_idle_notifications <= 1) { + number_idle_notifications = 0; + uncommit = false; + } } - // Uncommit unused memory in new space. - Heap::UncommitFromSpace(); + // Make sure that we have no pending context disposals and + // conditionally uncommit from space. + ASSERT(contexts_disposed_ == 0); + if (uncommit) Heap::UncommitFromSpace(); return finished; } -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
