| 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 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); | 214 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); |
| 215 EXPECT_EQ(DO_FULL_GC, action.type); | 215 EXPECT_EQ(DO_FULL_GC, action.type); |
| 216 } | 216 } |
| 217 | 217 |
| 218 | 218 |
| 219 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeZeroIdleTime) { | 219 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeZeroIdleTime) { |
| 220 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); | 220 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); |
| 221 heap_state.contexts_disposed = 1; | 221 heap_state.contexts_disposed = 1; |
| 222 heap_state.contexts_disposal_rate = 1.0; | 222 heap_state.contexts_disposal_rate = 1.0; |
| 223 heap_state.incremental_marking_stopped = true; | 223 heap_state.incremental_marking_stopped = true; |
| 224 heap_state.size_of_objects = GCIdleTimeHandler::kSmallHeapSize / 2; | |
| 225 int idle_time_ms = 0; | 224 int idle_time_ms = 0; |
| 226 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); | 225 GCIdleTimeAction action = handler()->Compute(idle_time_ms, heap_state); |
| 227 EXPECT_EQ(DO_FULL_GC, action.type); | 226 EXPECT_EQ(DO_FULL_GC, action.type); |
| 228 } | 227 } |
| 229 | 228 |
| 230 | 229 |
| 231 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime1) { | 230 TEST_F(GCIdleTimeHandlerTest, AfterContextDisposeSmallIdleTime1) { |
| 232 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); | 231 GCIdleTimeHandler::HeapState heap_state = DefaultHeapState(); |
| 233 heap_state.contexts_disposed = 1; | 232 heap_state.contexts_disposed = 1; |
| 234 heap_state.contexts_disposal_rate = 1.0; | 233 heap_state.contexts_disposal_rate = 1.0; |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 415 // Emulate mutator work. | 414 // Emulate mutator work. |
| 416 for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) { | 415 for (int i = 0; i < GCIdleTimeHandler::kIdleScavengeThreshold; i++) { |
| 417 handler()->NotifyScavenge(); | 416 handler()->NotifyScavenge(); |
| 418 } | 417 } |
| 419 action = handler()->Compute(0, heap_state); | 418 action = handler()->Compute(0, heap_state); |
| 420 EXPECT_EQ(DO_NOTHING, action.type); | 419 EXPECT_EQ(DO_NOTHING, action.type); |
| 421 } | 420 } |
| 422 | 421 |
| 423 } // namespace internal | 422 } // namespace internal |
| 424 } // namespace v8 | 423 } // namespace v8 |
| OLD | NEW |