Reviewers: Vyacheslav Egorov,

Message:
Please take a look.

Description:
Abort incremental marking on idle notification after context disposal.

[email protected]


Please review this at https://chromiumcodereview.appspot.com/9841001/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
  M src/heap.cc


Index: src/heap.cc
diff --git a/src/heap.cc b/src/heap.cc
index d2986682782a71303c9d1060315ef2e57afb2150..8dcf4887a2079386d73d9f822cb06e80ab05af4b 100644
--- a/src/heap.cc
+++ b/src/heap.cc
@@ -4838,7 +4838,8 @@ void Heap::AdvanceIdleIncrementalMarking(intptr_t step_size) {


 bool Heap::IdleNotification(int hint) {
-  intptr_t size_factor = Min(Max(hint, 30), 1000) / 10;
+  const int kMaxHint = 1000;
+  intptr_t size_factor = Min(Max(hint, 30), kMaxHint) / 10;
   // The size factor is in range [3..100].
intptr_t step_size = size_factor * IncrementalMarking::kAllocatedThreshold;

@@ -4846,8 +4847,16 @@ bool Heap::IdleNotification(int hint) {
     int mark_sweep_time = Min(TimeMarkSweepWouldTakeInMs(), 1000);
     if (hint >= mark_sweep_time && !FLAG_expose_gc) {
       HistogramTimerScope scope(isolate_->counters()->gc_context());
-      CollectAllGarbage(kReduceMemoryFootprintMask,
-                        "idle notification: contexts disposed");
+      if (hint >= kMaxHint) {
+        // The embedder can tolerate long pauses, do precise GC.
+        CollectAllGarbage(kReduceMemoryFootprintMask |
+                          kAbortIncrementalMarkingMask,
+                          "idle notification: contexts disposed"
+                          " (abort incremental marking)");
+      } else {
+        CollectAllGarbage(kReduceMemoryFootprintMask,
+                          "idle notification: contexts disposed");
+      }
     } else {
       AdvanceIdleIncrementalMarking(step_size);
       contexts_disposed_ = 0;
@@ -4859,7 +4868,7 @@ bool Heap::IdleNotification(int hint) {
     return false;
   }

-  if (hint >= 1000 || !FLAG_incremental_marking ||
+  if (hint >= kMaxHint || !FLAG_incremental_marking ||
       FLAG_expose_gc || Serializer::enabled()) {
     return IdleGlobalGC();
   }


--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev

Reply via email to