Reland Set lower allocation limit in idle notification only if no GC happend recently...
authorhpayer <hpayer@chromium.org>
Wed, 20 May 2015 12:59:16 +0000 (05:59 -0700)
committerCommit bot <commit-bot@chromium.org>
Wed, 20 May 2015 12:59:00 +0000 (12:59 +0000)
TBR=ulan@chromium.org
NOPRESUBMIT=true
NOTREECHECKS=true
NOTRY=true
BUG=475674

Review URL: https://codereview.chromium.org/1143133004

Cr-Commit-Position: refs/heads/master@{#28512}

src/heap/heap.cc
src/heap/heap.h

index 72769fe..e66ae93 100644 (file)
@@ -133,6 +133,7 @@ Heap::Heap()
       marking_time_(0.0),
       sweeping_time_(0.0),
       last_idle_notification_time_(0.0),
+      last_gc_time_(0.0),
       mark_compact_collector_(this),
       store_buffer_(this),
       marking_(this),
@@ -725,6 +726,7 @@ void Heap::GarbageCollectionEpilogue() {
   // Remember the last top pointer so that we can later find out
   // whether we allocated in new space since the last GC.
   new_space_top_after_last_gc_ = new_space()->top();
+  last_gc_time_ = MonotonicallyIncreasingTimeInMs();
 }
 
 
@@ -4612,6 +4614,8 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
       static_cast<size_t>(idle_time_in_ms) >
       GCIdleTimeHandler::kMaxFrameRenderingIdleTime;
 
+  static const double kLastGCTimeTreshold = 1000;
+
   GCIdleTimeHandler::HeapState heap_state;
   heap_state.contexts_disposed = contexts_disposed_;
   heap_state.contexts_disposal_rate =
@@ -4620,7 +4624,8 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
   heap_state.incremental_marking_stopped = incremental_marking()->IsStopped();
   // TODO(ulan): Start incremental marking only for large heaps.
   intptr_t limit = old_generation_allocation_limit_;
-  if (is_long_idle_notification) {
+  if (is_long_idle_notification &&
+      (start_ms - last_gc_time_ > kLastGCTimeTreshold)) {
     limit = idle_old_generation_allocation_limit_;
   }
 
index e024c94..f460b55 100644 (file)
@@ -2142,15 +2142,18 @@ class Heap {
   // Minimal interval between two subsequent collections.
   double min_in_mutator_;
 
-  // Cumulative GC time spent in marking
+  // Cumulative GC time spent in marking.
   double marking_time_;
 
-  // Cumulative GC time spent in sweeping
+  // Cumulative GC time spent in sweeping.
   double sweeping_time_;
 
-  // Last time an idle notification happened
+  // Last time an idle notification happened.
   double last_idle_notification_time_;
 
+  // Last time a garbage collection happened.
+  double last_gc_time_;
+
   MarkCompactCollector mark_compact_collector_;
 
   StoreBuffer store_buffer_;