Reviewers: jochen (slow),

https://codereview.chromium.org/767233003/diff/1/src/heap/heap.cc
File src/heap/heap.cc (right):

https://codereview.chromium.org/767233003/diff/1/src/heap/heap.cc#newcode4500
src/heap/heap.cc:4500: } while (remaining_idle_time_in_ms >= 2 &&
On 2014/12/02 10:30:31, jochen (slow) wrote:
maybe 2.0 * kIncrementalMarkingStepTimeInMs?

Done.

Description:
Perform smaller marking steps incrementally in idle notification.

BUG=

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

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

Affected files (+18, -8 lines):
  M src/heap/gc-idle-time-handler.h
  M src/heap/gc-idle-time-handler.cc
  M src/heap/heap.cc


Index: src/heap/gc-idle-time-handler.cc
diff --git a/src/heap/gc-idle-time-handler.cc b/src/heap/gc-idle-time-handler.cc index 92fb5530ef57acb1e5e8650a93ee914c1ed4b3f7..bbc4c394afcb18ab511d1394cf51b39e17ab697e 100644
--- a/src/heap/gc-idle-time-handler.cc
+++ b/src/heap/gc-idle-time-handler.cc
@@ -27,7 +27,8 @@ void GCIdleTimeAction::Print() {
       PrintF("no action");
       break;
     case DO_INCREMENTAL_MARKING:
- PrintF("incremental marking with step %" V8_PTR_PREFIX "d", parameter);
+      PrintF("incremental marking with step %" V8_PTR_PREFIX "d / ms",
+             parameter);
       break;
     case DO_SCAVENGE:
       PrintF("scavenge");
@@ -250,7 +251,7 @@ GCIdleTimeAction GCIdleTimeHandler::Compute(double idle_time_in_ms,
     return GCIdleTimeAction::Nothing();
   }
   size_t step_size = EstimateMarkingStepSize(
-      static_cast<size_t>(idle_time_in_ms),
+      static_cast<size_t>(kIncrementalMarkingStepTimeInMs),
       heap_state.incremental_marking_speed_in_bytes_per_ms);
   return GCIdleTimeAction::IncrementalMarking(step_size);
 }
Index: src/heap/gc-idle-time-handler.h
diff --git a/src/heap/gc-idle-time-handler.h b/src/heap/gc-idle-time-handler.h index 8dfe92d9f79f5510484978829bbbb7184a8b6c5e..9b7f2b59977f1e96d571be1dd843c13ba798b118 100644
--- a/src/heap/gc-idle-time-handler.h
+++ b/src/heap/gc-idle-time-handler.h
@@ -125,6 +125,9 @@ class GCIdleTimeHandler {
   // If contexts are disposed at a higher rate a full gc is triggered.
   static const double kHighContextDisposalRate;

+  // Incremental marking step time.
+  static const size_t kIncrementalMarkingStepTimeInMs = 1;
+
   class HeapState {
    public:
     void Print();
Index: src/heap/heap.cc
diff --git a/src/heap/heap.cc b/src/heap/heap.cc
index 8986087486995ac660de31f0d164b0a03ebc37f4..fa327641250cd51d24d01f822ff04e641a758ab4 100644
--- a/src/heap/heap.cc
+++ b/src/heap/heap.cc
@@ -4489,12 +4489,18 @@ bool Heap::IdleNotification(double deadline_in_seconds) {
       if (incremental_marking()->IsStopped()) {
         incremental_marking()->Start();
       }
-      incremental_marking()->Step(action.parameter,
- IncrementalMarking::NO_GC_VIA_STACK_GUARD,
-                                  IncrementalMarking::FORCE_MARKING,
- IncrementalMarking::DO_NOT_FORCE_COMPLETION);
-      double remaining_idle_time_in_ms =
-          deadline_in_ms - MonotonicallyIncreasingTimeInMs();
+      double remaining_idle_time_in_ms = 0.0;
+      do {
+        incremental_marking()->Step(
+            action.parameter, IncrementalMarking::NO_GC_VIA_STACK_GUARD,
+            IncrementalMarking::FORCE_MARKING,
+            IncrementalMarking::DO_NOT_FORCE_COMPLETION);
+        remaining_idle_time_in_ms =
+            deadline_in_ms - MonotonicallyIncreasingTimeInMs();
+      } while (remaining_idle_time_in_ms >=
+ 2.0 * GCIdleTimeHandler::kIncrementalMarkingStepTimeInMs &&
+               !incremental_marking()->IsComplete() &&
+               !mark_compact_collector_.marking_deque()->IsEmpty());
       if (remaining_idle_time_in_ms > 0.0) {
         TryFinalizeIdleIncrementalMarking(
             remaining_idle_time_in_ms, heap_state.size_of_objects,


--
--
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