| 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 977882a46ce36370a0e96427b1fc63816364c51e..e2816df6398c9e492bd035c7569f0115769b9df2 100644
|
| --- a/test/unittests/heap/gc-idle-time-handler-unittest.cc
|
| +++ b/test/unittests/heap/gc-idle-time-handler-unittest.cc
|
| @@ -184,7 +184,7 @@ TEST_F(GCIdleTimeHandlerTest, ContextDisposeLowRate) {
|
| GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
|
| heap_state.contexts_disposed = 1;
|
| heap_state.incremental_marking_stopped = true;
|
| - int idle_time_ms = 0;
|
| + double idle_time_ms = 0;
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_NOTHING, action.type);
|
| }
|
| @@ -196,7 +196,7 @@ TEST_F(GCIdleTimeHandlerTest, ContextDisposeHighRate) {
|
| heap_state.contexts_disposal_rate =
|
| GCIdleTimeHandler::kHighContextDisposalRate - 1;
|
| heap_state.incremental_marking_stopped = true;
|
| - int idle_time_ms = 0;
|
| + double idle_time_ms = 0;
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_FULL_GC, action.type);
|
| }
|
| @@ -209,8 +209,8 @@ TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeLargeIdleTime) {
|
| heap_state.incremental_marking_stopped = true;
|
| heap_state.can_start_incremental_marking = false;
|
| size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
|
| - int idle_time_ms =
|
| - static_cast<int>((heap_state.size_of_objects + speed - 1) / speed);
|
| + double idle_time_ms =
|
| + static_cast<double>((heap_state.size_of_objects + speed - 1) / speed);
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_FULL_GC, action.type);
|
| }
|
| @@ -221,7 +221,7 @@ TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeZeroIdleTime) {
|
| heap_state.contexts_disposed = 1;
|
| heap_state.contexts_disposal_rate = 1.0;
|
| heap_state.incremental_marking_stopped = true;
|
| - int idle_time_ms = 0;
|
| + double idle_time_ms = 0;
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_FULL_GC, action.type);
|
| }
|
| @@ -233,7 +233,8 @@ TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime1) {
|
| heap_state.contexts_disposal_rate = 1.0;
|
| heap_state.incremental_marking_stopped = true;
|
| size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
|
| - int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed - 1);
|
| + double idle_time_ms =
|
| + static_cast<double>(heap_state.size_of_objects / speed - 1);
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
|
| }
|
| @@ -244,7 +245,8 @@ TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime2) {
|
| heap_state.contexts_disposed = 1;
|
| heap_state.contexts_disposal_rate = 1.0;
|
| size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
|
| - int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed - 1);
|
| + double idle_time_ms =
|
| + static_cast<double>(heap_state.size_of_objects / speed - 1);
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
|
| }
|
| @@ -253,7 +255,7 @@ TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime2) {
|
| TEST_F(GCIdleTimeHandlerTest, IncrementalMarking1) {
|
| GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
|
| size_t speed = heap_state.incremental_marking_speed_in_bytes_per_ms;
|
| - int idle_time_ms = 10;
|
| + double idle_time_ms = 10;
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
|
| EXPECT_GT(speed * static_cast<size_t>(idle_time_ms),
|
| @@ -266,7 +268,7 @@ TEST_F(GCIdleTimeHandlerTest, IncrementalMarking2) {
|
| GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
|
| heap_state.incremental_marking_stopped = true;
|
| size_t speed = heap_state.incremental_marking_speed_in_bytes_per_ms;
|
| - int idle_time_ms = 10;
|
| + double idle_time_ms = 10;
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
|
| EXPECT_GT(speed * static_cast<size_t>(idle_time_ms),
|
| @@ -280,7 +282,8 @@ TEST_F(GCIdleTimeHandlerTest, NotEnoughTime) {
|
| heap_state.incremental_marking_stopped = true;
|
| heap_state.can_start_incremental_marking = false;
|
| size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
|
| - int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed - 1);
|
| + double idle_time_ms =
|
| + static_cast<double>(heap_state.size_of_objects / speed - 1);
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_NOTHING, action.type);
|
| }
|
| @@ -291,7 +294,8 @@ TEST_F(GCIdleTimeHandlerTest, StopEventually1) {
|
| heap_state.incremental_marking_stopped = true;
|
| heap_state.can_start_incremental_marking = false;
|
| size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
|
| - int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed + 1);
|
| + double idle_time_ms =
|
| + static_cast<double>(heap_state.size_of_objects / speed + 1);
|
| for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++) {
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_FULL_GC, action.type);
|
| @@ -304,7 +308,7 @@ TEST_F(GCIdleTimeHandlerTest, StopEventually1) {
|
|
|
| TEST_F(GCIdleTimeHandlerTest, StopEventually2) {
|
| GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
|
| - int idle_time_ms = 10;
|
| + double idle_time_ms = 10;
|
| for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++) {
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_INCREMENTAL_MARKING, action.type);
|
| @@ -323,7 +327,8 @@ TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop1) {
|
| heap_state.incremental_marking_stopped = true;
|
| heap_state.can_start_incremental_marking = false;
|
| size_t speed = heap_state.mark_compact_speed_in_bytes_per_ms;
|
| - int idle_time_ms = static_cast<int>(heap_state.size_of_objects / speed + 1);
|
| + double idle_time_ms =
|
| + static_cast<double>(heap_state.size_of_objects / speed + 1);
|
| for (int i = 0; i < GCIdleTimeHandler::kMaxMarkCompactsInIdleRound; i++) {
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_FULL_GC, action.type);
|
| @@ -342,7 +347,7 @@ TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop1) {
|
|
|
| TEST_F(GCIdleTimeHandlerTest, ContinueAfterStop2) {
|
| GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
|
| - int idle_time_ms = 10;
|
| + double 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;
|
| @@ -370,7 +375,8 @@ TEST_F(GCIdleTimeHandlerTest, Scavenge) {
|
| heap_state.used_new_space_size =
|
| heap_state.new_space_capacity -
|
| (kNewSpaceAllocationThroughput * idle_time_ms);
|
| - GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| + GCIdleTimeAction action =
|
| + handler()->Compute(static_cast<double>(idle_time_ms), heap_state);
|
| EXPECT_EQ(DO_SCAVENGE, action.type);
|
| }
|
|
|
| @@ -383,17 +389,18 @@ TEST_F(GCIdleTimeHandlerTest, ScavengeAndDone) {
|
| heap_state.used_new_space_size =
|
| heap_state.new_space_capacity -
|
| (kNewSpaceAllocationThroughput * idle_time_ms);
|
| - GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| + GCIdleTimeAction action =
|
| + handler()->Compute(static_cast<double>(idle_time_ms), heap_state);
|
| EXPECT_EQ(DO_SCAVENGE, action.type);
|
| heap_state.used_new_space_size = 0;
|
| - action = handler()->Compute(idle_time_ms, heap_state);
|
| + action = handler()->Compute(static_cast<double>(idle_time_ms), heap_state);
|
| EXPECT_EQ(DO_NOTHING, action.type);
|
| }
|
|
|
|
|
| TEST_F(GCIdleTimeHandlerTest, ZeroIdleTimeNothingToDo) {
|
| GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
|
| - int idle_time_ms = 0;
|
| + double idle_time_ms = 0;
|
| GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state);
|
| EXPECT_EQ(DO_NOTHING, action.type);
|
| }
|
| @@ -401,7 +408,7 @@ TEST_F(GCIdleTimeHandlerTest, ZeroIdleTimeNothingToDo) {
|
|
|
| TEST_F(GCIdleTimeHandlerTest, ZeroIdleTimeDoNothingButStartIdleRound) {
|
| GCIdleTimeHandler::HeapState heap_state = DefaultHeapState();
|
| - int idle_time_ms = 10;
|
| + double 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;
|
|
|