Revision: 23965
Author:   [email protected]
Date:     Tue Sep 16 09:21:09 2014 UTC
Log:      Introduce DONE state in idle notification handler.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/577573002
https://code.google.com/p/v8/source/detail?r=23965

Modified:
 /branches/bleeding_edge/src/heap/gc-idle-time-handler-unittest.cc
 /branches/bleeding_edge/src/heap/gc-idle-time-handler.cc
 /branches/bleeding_edge/src/heap/gc-idle-time-handler.h
 /branches/bleeding_edge/src/heap/heap.cc

=======================================
--- /branches/bleeding_edge/src/heap/gc-idle-time-handler-unittest.cc Mon Sep 15 15:15:23 2014 UTC +++ /branches/bleeding_edge/src/heap/gc-idle-time-handler-unittest.cc Tue Sep 16 09:21:09 2014 UTC
@@ -182,7 +182,7 @@
     handler()->NotifyIdleMarkCompact();
   }
   GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
-  EXPECT_EQ(DO_NOTHING, action.type);
+  EXPECT_EQ(DONE, action.type);
 }


@@ -195,7 +195,7 @@
     handler()->NotifyIdleMarkCompact();
   }
   GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
-  EXPECT_EQ(DO_NOTHING, action.type);
+  EXPECT_EQ(DONE, action.type);
 }


@@ -211,7 +211,7 @@
     handler()->NotifyIdleMarkCompact();
   }
   GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
-  EXPECT_EQ(DO_NOTHING, action.type);
+  EXPECT_EQ(DONE, action.type);
   // Emulate mutator work.
   for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) {
     handler()->NotifyScavenge();
@@ -226,12 +226,12 @@
   int idle_time_ms = 10;
for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++) {
     GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
-    if (action.type == DO_NOTHING) break;
+    if (action.type == DONE) break;
     EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
     handler()->NotifyIdleMarkCompact();
   }
   GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
-  EXPECT_EQ(DO_NOTHING, action.type);
+  EXPECT_EQ(DONE, action.type);
   // Emulate mutator work.
   for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) {
     handler()->NotifyScavenge();
=======================================
--- /branches/bleeding_edge/src/heap/gc-idle-time-handler.cc Mon Sep 15 15:15:23 2014 UTC +++ /branches/bleeding_edge/src/heap/gc-idle-time-handler.cc Tue Sep 16 09:21:09 2014 UTC
@@ -18,6 +18,9 @@

 void GCIdleTimeAction::Print() {
   switch (type) {
+    case DONE:
+      PrintF("done");
+      break;
     case DO_NOTHING:
       PrintF("no action");
       break;
@@ -74,7 +77,7 @@
if (EnoughGarbageSinceLastIdleRound() || heap_state.contexts_disposed
0) {
       StartIdleRound();
     } else {
-      return GCIdleTimeAction::Nothing();
+      return GCIdleTimeAction::Done();
     }
   }
   if (heap_state.incremental_marking_stopped) {
=======================================
--- /branches/bleeding_edge/src/heap/gc-idle-time-handler.h Thu Sep 11 11:54:49 2014 UTC +++ /branches/bleeding_edge/src/heap/gc-idle-time-handler.h Tue Sep 16 09:21:09 2014 UTC
@@ -11,6 +11,7 @@
 namespace internal {

 enum GCIdleTimeActionType {
+  DONE,
   DO_NOTHING,
   DO_INCREMENTAL_MARKING,
   DO_SCAVENGE,
@@ -21,6 +22,13 @@

 class GCIdleTimeAction {
  public:
+  static GCIdleTimeAction Done() {
+    GCIdleTimeAction result;
+    result.type = DONE;
+    result.parameter = 0;
+    return result;
+  }
+
   static GCIdleTimeAction Nothing() {
     GCIdleTimeAction result;
     result.type = DO_NOTHING;
=======================================
--- /branches/bleeding_edge/src/heap/heap.cc    Mon Sep 15 13:27:46 2014 UTC
+++ /branches/bleeding_edge/src/heap/heap.cc    Tue Sep 16 09:21:09 2014 UTC
@@ -4318,6 +4318,9 @@

   bool result = false;
   switch (action.type) {
+    case DONE:
+      result = true;
+      break;
     case DO_INCREMENTAL_MARKING:
       if (incremental_marking()->IsStopped()) {
         incremental_marking()->Start();
@@ -4340,7 +4343,6 @@
       mark_compact_collector()->EnsureSweepingCompleted();
       break;
     case DO_NOTHING:
-      result = true;
       break;
   }
   if (FLAG_trace_idle_notification) {

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