OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <limits> | 5 #include <limits> |
6 | 6 |
7 #include "src/heap/gc-idle-time-handler.h" | 7 #include "src/heap/gc-idle-time-handler.h" |
8 #include "testing/gtest/include/gtest/gtest.h" | 8 #include "testing/gtest/include/gtest/gtest.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 idle_time_in_ms, heap_state.new_space_capacity, | 128 idle_time_in_ms, heap_state.new_space_capacity, |
129 heap_state.used_new_space_size, heap_state.scavenge_speed_in_bytes_per_ms, | 129 heap_state.used_new_space_size, heap_state.scavenge_speed_in_bytes_per_ms, |
130 heap_state.new_space_allocation_throughput_in_bytes_per_ms)); | 130 heap_state.new_space_allocation_throughput_in_bytes_per_ms)); |
131 } | 131 } |
132 | 132 |
133 | 133 |
134 TEST_F(GCIdleTimeHandlerTest, DoScavengeUnknownScavengeSpeed) { | 134 TEST_F(GCIdleTimeHandlerTest, DoScavengeUnknownScavengeSpeed) { |
135 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); | 135 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); |
136 heap_state.used_new_space_size = kNewSpaceCapacity; | 136 heap_state.used_new_space_size = kNewSpaceCapacity; |
137 heap_state.scavenge_speed_in_bytes_per_ms = 0; | 137 heap_state.scavenge_speed_in_bytes_per_ms = 0; |
138 int idle_time_in_ms = 16; | 138 int idle_time_in_ms = 8; |
139 EXPECT_FALSE(GCIdleTimeHandler::ShouldDoScavenge( | 139 EXPECT_FALSE(GCIdleTimeHandler::ShouldDoScavenge( |
140 idle_time_in_ms, heap_state.new_space_capacity, | 140 idle_time_in_ms, heap_state.new_space_capacity, |
141 heap_state.used_new_space_size, heap_state.scavenge_speed_in_bytes_per_ms, | 141 heap_state.used_new_space_size, heap_state.scavenge_speed_in_bytes_per_ms, |
142 heap_state.new_space_allocation_throughput_in_bytes_per_ms)); | 142 heap_state.new_space_allocation_throughput_in_bytes_per_ms)); |
143 } | 143 } |
144 | 144 |
145 | 145 |
146 TEST_F(GCIdleTimeHandlerTest, DoScavengeLowScavengeSpeed) { | 146 TEST_F(GCIdleTimeHandlerTest, DoScavengeLowScavengeSpeed) { |
147 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); | 147 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); |
148 heap_state.used_new_space_size = kNewSpaceCapacity; | 148 heap_state.used_new_space_size = kNewSpaceCapacity; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
435 // Emulate mutator work. | 435 // Emulate mutator work. |
436 for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) { | 436 for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) { |
437 handler()->NotifyScavenge(); | 437 handler()->NotifyScavenge(); |
438 } | 438 } |
439 action = handler()->Compute(0, heap_state); | 439 action = handler()->Compute(0, heap_state); |
440 EXPECT_EQ(DO_NOTHING, action.type); | 440 EXPECT_EQ(DO_NOTHING, action.type); |
441 } | 441 } |
442 | 442 |
443 } // namespace internal | 443 } // namespace internal |
444 } // namespace v8 | 444 } // namespace v8 |
OLD | NEW |