| 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 "src/heap/gc-idle-time-handler.h" | 5 #include "src/heap/gc-idle-time-handler.h" |
| 6 #include "src/heap/gc-tracer.h" | 6 #include "src/heap/gc-tracer.h" |
| 7 #include "src/utils.h" | 7 #include "src/utils.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| 11 | 11 |
| 12 const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9; | 12 const double GCIdleTimeHandler::kConservativeTimeRatio = 0.9; |
| 13 const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000; | 13 const size_t GCIdleTimeHandler::kMaxMarkCompactTimeInMs = 1000; |
| 14 const size_t GCIdleTimeHandler::kMaxFinalIncrementalMarkCompactTimeInMs = 1000; | 14 const size_t GCIdleTimeHandler::kMaxFinalIncrementalMarkCompactTimeInMs = 1000; |
| 15 const size_t GCIdleTimeHandler::kMinTimeForFinalizeSweeping = 100; | 15 const size_t GCIdleTimeHandler::kMinTimeForFinalizeSweeping = 100; |
| 16 const int GCIdleTimeHandler::kMaxMarkCompactsInIdleRound = 7; | 16 const int GCIdleTimeHandler::kMaxMarkCompactsInIdleRound = 7; |
| 17 const int GCIdleTimeHandler::kIdleScavengeThreshold = 5; | 17 const int GCIdleTimeHandler::kIdleScavengeThreshold = 5; |
| 18 const double GCIdleTimeHandler::kHighContextDisposalRate = 100; | 18 const double GCIdleTimeHandler::kHighContextDisposalRate = 100; |
| 19 | 19 |
| 20 | 20 |
| 21 void GCIdleTimeAction::Print() { | 21 void GCIdleTimeAction::Print() { |
| 22 switch (type) { | 22 switch (type) { |
| 23 case DONE: | 23 case DONE: |
| 24 PrintF("done"); | 24 PrintF("done"); |
| 25 break; | 25 break; |
| 26 case DO_NOTHING: | 26 case DO_NOTHING: |
| 27 PrintF("no action"); | 27 PrintF("no action"); |
| 28 break; | 28 break; |
| 29 case DO_INCREMENTAL_MARKING: | 29 case DO_INCREMENTAL_MARKING: |
| 30 PrintF("incremental marking with step %" V8_PTR_PREFIX "d", parameter); | 30 PrintF("incremental marking with step %" V8_PTR_PREFIX "d / ms", |
| 31 parameter); |
| 31 break; | 32 break; |
| 32 case DO_SCAVENGE: | 33 case DO_SCAVENGE: |
| 33 PrintF("scavenge"); | 34 PrintF("scavenge"); |
| 34 break; | 35 break; |
| 35 case DO_FULL_GC: | 36 case DO_FULL_GC: |
| 36 PrintF("full GC"); | 37 PrintF("full GC"); |
| 37 break; | 38 break; |
| 38 case DO_FINALIZE_SWEEPING: | 39 case DO_FINALIZE_SWEEPING: |
| 39 PrintF("finalize sweeping"); | 40 PrintF("finalize sweeping"); |
| 40 break; | 41 break; |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 if (heap_state.sweeping_in_progress && | 244 if (heap_state.sweeping_in_progress && |
| 244 static_cast<size_t>(idle_time_in_ms) >= kMinTimeForFinalizeSweeping) { | 245 static_cast<size_t>(idle_time_in_ms) >= kMinTimeForFinalizeSweeping) { |
| 245 return GCIdleTimeAction::FinalizeSweeping(); | 246 return GCIdleTimeAction::FinalizeSweeping(); |
| 246 } | 247 } |
| 247 | 248 |
| 248 if (heap_state.incremental_marking_stopped && | 249 if (heap_state.incremental_marking_stopped && |
| 249 !heap_state.can_start_incremental_marking) { | 250 !heap_state.can_start_incremental_marking) { |
| 250 return GCIdleTimeAction::Nothing(); | 251 return GCIdleTimeAction::Nothing(); |
| 251 } | 252 } |
| 252 size_t step_size = EstimateMarkingStepSize( | 253 size_t step_size = EstimateMarkingStepSize( |
| 253 static_cast<size_t>(idle_time_in_ms), | 254 static_cast<size_t>(kIncrementalMarkingStepTimeInMs), |
| 254 heap_state.incremental_marking_speed_in_bytes_per_ms); | 255 heap_state.incremental_marking_speed_in_bytes_per_ms); |
| 255 return GCIdleTimeAction::IncrementalMarking(step_size); | 256 return GCIdleTimeAction::IncrementalMarking(step_size); |
| 256 } | 257 } |
| 257 } | 258 } |
| 258 } | 259 } |
| OLD | NEW |