Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Unified Diff: src/heap/gc-idle-time-handler-unittest.cc

Issue 580083002: Avoid idle times smaller than 1ms. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/gc-idle-time-handler.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/gc-idle-time-handler-unittest.cc
diff --git a/src/heap/gc-idle-time-handler-unittest.cc b/src/heap/gc-idle-time-handler-unittest.cc
index 195a88dcc1fe79630b4ffae6ea67607479b57563..b4f2f74f57b245b96f7e4f28908664ab3e012a50 100644
--- a/src/heap/gc-idle-time-handler-unittest.cc
+++ b/src/heap/gc-idle-time-handler-unittest.cc
@@ -315,5 +315,34 @@ TEST_F(GCIdleTimeHandlerTest, ScavengeAndDone) {
EXPECT_EQ(DO_NOTHING, action.type);
}
+
+TEST_F(GCIdleTimeHandlerTest, ZeroIdleTimeNothingToDo) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ int idle_time_ms = 0;
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_NOTHING, action.type);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, ZeroIdleTimeDoNothingButStartIdleRound) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ 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 == DONE) break;
+ EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
+ // In this case we try to emulate incremental marking steps the finish with
+ // a full gc.
+ handler()->NotifyIdleMarkCompact();
+ }
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ // Emulate mutator work.
+ for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) {
+ handler()->NotifyScavenge();
+ }
+ action = handler()->Compute(0, heap_state);
+ EXPECT_EQ(DO_NOTHING, action.type);
+}
+
} // namespace internal
} // namespace v8
« no previous file with comments | « src/heap/gc-idle-time-handler.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698