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

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

Issue 1038283003: Finalize sweeping in idle notification when all pages are swept. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 9 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/heap.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 b5f59bd5108f1792c24a70ece5499d97f3954c8d..76424627c5572e2eeb114de7e589801c102de5c3 100644
--- a/test/unittests/heap/gc-idle-time-handler-unittest.cc
+++ b/test/unittests/heap/gc-idle-time-handler-unittest.cc
@@ -27,6 +27,7 @@ class GCIdleTimeHandlerTest : public ::testing::Test {
result.incremental_marking_stopped = false;
result.can_start_incremental_marking = true;
result.sweeping_in_progress = false;
+ result.sweeping_completed = false;
result.mark_compact_speed_in_bytes_per_ms = kMarkCompactSpeed;
result.incremental_marking_speed_in_bytes_per_ms = kMarkingSpeed;
result.scavenge_speed_in_bytes_per_ms = kScavengeSpeed;
@@ -303,6 +304,30 @@ TEST_F(GCIdleTimeHandlerTest, NotEnoughTime) {
}
+TEST_F(GCIdleTimeHandlerTest, FinalizeSweeping) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ heap_state.incremental_marking_stopped = true;
+ heap_state.can_start_incremental_marking = false;
+ heap_state.sweeping_in_progress = true;
+ heap_state.sweeping_completed = true;
+ double idle_time_ms = 10.0;
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_FINALIZE_SWEEPING, action.type);
+}
+
+
+TEST_F(GCIdleTimeHandlerTest, CannotFinalizeSweeping) {
+ GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
+ heap_state.incremental_marking_stopped = true;
+ heap_state.can_start_incremental_marking = false;
+ heap_state.sweeping_in_progress = true;
+ heap_state.sweeping_completed = false;
+ double idle_time_ms = 10.0;
+ GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
+ EXPECT_EQ(DO_NOTHING, action.type);
+}
+
+
TEST_F(GCIdleTimeHandlerTest, StopEventually1) {
GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
heap_state.incremental_marking_stopped = true;
« no previous file with comments | « src/heap/heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698