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

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

Issue 1141393002: Restore NothingOrDone action in idle time handler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« src/heap/gc-idle-time-handler.cc ('K') | « 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: test/unittests/heap/gc-idle-time-handler-unittest.cc
diff --git a/test/unittests/heap/gc-idle-time-handler-unittest.cc b/test/unittests/heap/gc-idle-time-handler-unittest.cc
index 357b08f88108117d8c74d91ddbf6c42df215708c..2a1aeb44959792199aae6b1e6d9f82ca70b3dad9 100644
--- a/test/unittests/heap/gc-idle-time-handler-unittest.cc
+++ b/test/unittests/heap/gc-idle-time-handler-unittest.cc
@@ -48,7 +48,11 @@ class GCIdleTimeHandlerTest : public ::testing::Test {
heap_state.can_start_incremental_marking;
for (int i = 0; i < limit; i++) {
GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(incremental ? DO_INCREMENTAL_MARKING : DO_NOTHING, action.type);
+ if (incremental) {
+ EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
+ } else {
+ EXPECT_TRUE(DO_NOTHING == action.type || DONE == action.type);
+ }
}
handler()->Compute(idle_time_ms, heap_state);
EXPECT_EQ(GCIdleTimeHandler::kReduceMemory, handler()->mode());
@@ -73,16 +77,12 @@ class GCIdleTimeHandlerTest : public ::testing::Test {
void TransitionToReduceLatencyMode(
const GCIdleTimeHandler::HeapState& heap_state) {
EXPECT_EQ(GCIdleTimeHandler::kDone, handler()->mode());
- int limit = GCIdleTimeHandler::kGCsBeforeMutatorIsActive;
+ int limit = GCIdleTimeHandler::kMarkCompactsBeforeMutatorIsActive;
double idle_time_ms = GCIdleTimeHandler::kMinLongIdleTime;
for (int i = 0; i < limit; i++) {
GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
EXPECT_EQ(DONE, action.type);
- if (i % 2 == 0) {
- handler()->NotifyScavenge();
- } else {
- handler()->NotifyMarkCompact();
- }
+ handler()->NotifyMarkCompact();
}
handler()->Compute(idle_time_ms, heap_state);
EXPECT_EQ(GCIdleTimeHandler::kReduceLatency, handler()->mode());
@@ -550,7 +550,7 @@ TEST_F(GCIdleTimeHandlerTest, SmallIdleTimeNothingToDo) {
heap_state.can_start_incremental_marking = false;
for (int i = 0; i < kMaxNotifications; i++) {
GCIdleTimeAction action = handler()->Compute(10, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
+ EXPECT_TRUE(DO_NOTHING == action.type || DONE == action.type);
}
}
@@ -563,7 +563,7 @@ TEST_F(GCIdleTimeHandlerTest, StayInReduceLatencyModeBecauseOfScavenges) {
int limit = GCIdleTimeHandler::kLongIdleNotificationsBeforeMutatorIsIdle;
for (int i = 0; i < kMaxNotifications; i++) {
GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
+ EXPECT_TRUE(DO_NOTHING == action.type || DONE == action.type);
if ((i + 1) % limit == 0) handler()->NotifyScavenge();
EXPECT_EQ(GCIdleTimeHandler::kReduceLatency, handler()->mode());
}
@@ -578,7 +578,7 @@ TEST_F(GCIdleTimeHandlerTest, StayInReduceLatencyModeBecauseOfMarkCompacts) {
int limit = GCIdleTimeHandler::kLongIdleNotificationsBeforeMutatorIsIdle;
for (int i = 0; i < kMaxNotifications; i++) {
GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
- EXPECT_EQ(DO_NOTHING, action.type);
+ EXPECT_TRUE(DO_NOTHING == action.type || DONE == action.type);
if ((i + 1) % limit == 0) handler()->NotifyMarkCompact();
EXPECT_EQ(GCIdleTimeHandler::kReduceLatency, handler()->mode());
}
@@ -643,5 +643,21 @@ TEST_F(GCIdleTimeHandlerTest, ReduceMemoryToDone) {
}
+TEST_F(GCIdleTimeHandlerTest, Regress489323) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ // Simulate incremental marking stopped and not eligible to start.
+ heap_state.incremental_marking_stopped = true;
+ heap_state.can_start_incremental_marking = false;
+ double idle_time_ms = 10.0;
+ for (int i = 0; i < GCIdleTimeHandler::kMaxNoProgressIdleTimesPerMode; i++) {
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_NOTHING, action.type);
+ }
+ // We should return DONE after not making progress for some time.
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DONE, action.type);
+}
+
+
rmcilroy 2015/05/19 10:26:57 Can we add back the two tests for NothingOrDone wh
ulan 2015/05/19 11:21:52 Done.
} // namespace internal
} // namespace v8
« src/heap/gc-idle-time-handler.cc ('K') | « 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