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 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 heap_state.scavenge_speed_in_bytes_per_ms = kNewSpaceCapacity; | 161 heap_state.scavenge_speed_in_bytes_per_ms = kNewSpaceCapacity; |
162 int idle_time_in_ms = 16; | 162 int idle_time_in_ms = 16; |
163 EXPECT_TRUE(GCIdleTimeHandler::ShouldDoScavenge( | 163 EXPECT_TRUE(GCIdleTimeHandler::ShouldDoScavenge( |
164 idle_time_in_ms, heap_state.new_space_capacity, | 164 idle_time_in_ms, heap_state.new_space_capacity, |
165 heap_state.used_new_space_size, heap_state.scavenge_speed_in_bytes_per_ms, | 165 heap_state.used_new_space_size, heap_state.scavenge_speed_in_bytes_per_ms, |
166 heap_state.new_space_allocation_throughput_in_bytes_per_ms)); | 166 heap_state.new_space_allocation_throughput_in_bytes_per_ms)); |
167 } | 167 } |
168 | 168 |
169 | 169 |
170 TEST_F(GCIdleTimeHandlerTest, ShouldDoMarkCompact) { | 170 TEST_F(GCIdleTimeHandlerTest, ShouldDoMarkCompact) { |
171 size_t idle_time_in_ms = 16; | 171 size_t idle_time_in_ms = GCIdleTimeHandler::kMaxScheduledIdleTime; |
172 EXPECT_TRUE(GCIdleTimeHandler::ShouldDoMarkCompact(idle_time_in_ms, 0, 0)); | 172 EXPECT_TRUE(GCIdleTimeHandler::ShouldDoMarkCompact(idle_time_in_ms, 0, 0)); |
173 } | 173 } |
174 | 174 |
175 | 175 |
176 TEST_F(GCIdleTimeHandlerTest, DontDoMarkCompact) { | 176 TEST_F(GCIdleTimeHandlerTest, DontDoMarkCompact) { |
177 size_t idle_time_in_ms = 1; | 177 size_t idle_time_in_ms = 1; |
178 EXPECT_FALSE(GCIdleTimeHandler::ShouldDoMarkCompact( | 178 EXPECT_FALSE(GCIdleTimeHandler::ShouldDoMarkCompact( |
179 idle_time_in_ms, kSizeOfObjects, kMarkingSpeed)); | 179 idle_time_in_ms, kSizeOfObjects, kMarkingSpeed)); |
180 } | 180 } |
181 | 181 |
(...skipping 253 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 |