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 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 |
182 | 182 |
| 183 TEST_F(GCIdleTimeHandlerTest, ShouldDoFinalIncrementalMarkCompact) { |
| 184 size_t idle_time_in_ms = 16; |
| 185 EXPECT_TRUE(GCIdleTimeHandler::ShouldDoFinalIncrementalMarkCompact( |
| 186 idle_time_in_ms, 0, 0)); |
| 187 } |
| 188 |
| 189 |
| 190 TEST_F(GCIdleTimeHandlerTest, DontDoFinalIncrementalMarkCompact) { |
| 191 size_t idle_time_in_ms = 1; |
| 192 EXPECT_FALSE(GCIdleTimeHandler::ShouldDoFinalIncrementalMarkCompact( |
| 193 idle_time_in_ms, kSizeOfObjects, kMarkingSpeed)); |
| 194 } |
| 195 |
| 196 |
183 TEST_F(GCIdleTimeHandlerTest, ContextDisposeLowRate) { | 197 TEST_F(GCIdleTimeHandlerTest, ContextDisposeLowRate) { |
184 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); | 198 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); |
185 heap_state.contexts_disposed = 1; | 199 heap_state.contexts_disposed = 1; |
186 heap_state.incremental_marking_stopped = true; | 200 heap_state.incremental_marking_stopped = true; |
187 int idle_time_ms = 0; | 201 int idle_time_ms = 0; |
188 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); | 202 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); |
189 EXPECT_EQ(DO_NOTHING, action.type); | 203 EXPECT_EQ(DO_NOTHING, action.type); |
190 } | 204 } |
191 | 205 |
192 | 206 |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 // Emulate mutator work. | 428 // Emulate mutator work. |
415 for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) { | 429 for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) { |
416 handler()->NotifyScavenge(); | 430 handler()->NotifyScavenge(); |
417 } | 431 } |
418 action = handler()->Compute(0, heap_state); | 432 action = handler()->Compute(0, heap_state); |
419 EXPECT_EQ(DO_NOTHING, action.type); | 433 EXPECT_EQ(DO_NOTHING, action.type); |
420 } | 434 } |
421 | 435 |
422 } // namespace internal | 436 } // namespace internal |
423 } // namespace v8 | 437 } // namespace v8 |
OLD | NEW |