Reviewers: ulan,

Description:
Set lower allocation limit in idle notification only if no GC happend recently.

BUG=475674
LOG=n

Please review this at https://codereview.chromium.org/1143113002/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+11, -4 lines):
  M src/heap/heap.h
  M src/heap/heap.cc


Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 99f2e93f505f78a4d3894f828083d41b42d3decd..d2f3df3dfa3faf9b3a6dc03d7f904e5be3a39546 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -725,6 +725,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 +4613,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 +4623,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: src/heap/heap.h
diff --git a/src/heap/heap.h b/src/heap/heap.h
index 8c1b459e0866a682ac5f9af160bcf0c20426ab3a..a9d7a4729311f83d4f99475f9f1df2fd78bdd084 100644
--- a/src/heap/heap.h
+++ b/src/heap/heap.h
@@ -2129,15 +2129,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_;


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to