OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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/incremental-marking.h" | 5 #include "src/heap/incremental-marking.h" |
6 | 6 |
7 #include "src/code-stubs.h" | 7 #include "src/code-stubs.h" |
8 #include "src/compilation-cache.h" | 8 #include "src/compilation-cache.h" |
9 #include "src/conversions.h" | 9 #include "src/conversions.h" |
10 #include "src/heap/gc-idle-time-handler.h" | 10 #include "src/heap/gc-idle-time-handler.h" |
(...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1020 | 1020 |
1021 void IncrementalMarking::Epilogue() { | 1021 void IncrementalMarking::Epilogue() { |
1022 was_activated_ = false; | 1022 was_activated_ = false; |
1023 finalize_marking_completed_ = false; | 1023 finalize_marking_completed_ = false; |
1024 incremental_marking_finalization_rounds_ = 0; | 1024 incremental_marking_finalization_rounds_ = 0; |
1025 } | 1025 } |
1026 | 1026 |
1027 double IncrementalMarking::AdvanceIncrementalMarking( | 1027 double IncrementalMarking::AdvanceIncrementalMarking( |
1028 double deadline_in_ms, CompletionAction completion_action, | 1028 double deadline_in_ms, CompletionAction completion_action, |
1029 ForceCompletionAction force_completion, StepOrigin step_origin) { | 1029 ForceCompletionAction force_completion, StepOrigin step_origin) { |
| 1030 HistogramTimerScope incremental_marking_scope( |
| 1031 heap_->isolate()->counters()->gc_incremental_marking()); |
| 1032 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); |
| 1033 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL); |
1030 DCHECK(!IsStopped()); | 1034 DCHECK(!IsStopped()); |
1031 | 1035 |
1032 double remaining_time_in_ms = 0.0; | 1036 double remaining_time_in_ms = 0.0; |
1033 intptr_t step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( | 1037 intptr_t step_size_in_bytes = GCIdleTimeHandler::EstimateMarkingStepSize( |
1034 kStepSizeInMs, | 1038 kStepSizeInMs, |
1035 heap()->tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); | 1039 heap()->tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); |
1036 | 1040 |
1037 do { | 1041 do { |
1038 Step(step_size_in_bytes, completion_action, force_completion, step_origin); | 1042 Step(step_size_in_bytes, completion_action, force_completion, step_origin); |
1039 remaining_time_in_ms = | 1043 remaining_time_in_ms = |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1103 bytes_to_process = Min(bytes_to_process, max_step_size); | 1107 bytes_to_process = Min(bytes_to_process, max_step_size); |
1104 | 1108 |
1105 size_t bytes_processed = 0; | 1109 size_t bytes_processed = 0; |
1106 if (bytes_marked_ahead_of_schedule_ >= bytes_to_process) { | 1110 if (bytes_marked_ahead_of_schedule_ >= bytes_to_process) { |
1107 // Steps performed in tasks have put us ahead of schedule. | 1111 // Steps performed in tasks have put us ahead of schedule. |
1108 // We skip processing of marking dequeue here and thus | 1112 // We skip processing of marking dequeue here and thus |
1109 // shift marking time from inside V8 to standalone tasks. | 1113 // shift marking time from inside V8 to standalone tasks. |
1110 bytes_marked_ahead_of_schedule_ -= bytes_to_process; | 1114 bytes_marked_ahead_of_schedule_ -= bytes_to_process; |
1111 bytes_processed = bytes_to_process; | 1115 bytes_processed = bytes_to_process; |
1112 } else { | 1116 } else { |
| 1117 HistogramTimerScope incremental_marking_scope( |
| 1118 heap_->isolate()->counters()->gc_incremental_marking()); |
| 1119 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); |
| 1120 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL); |
1113 bytes_processed = Step(bytes_to_process, GC_VIA_STACK_GUARD, | 1121 bytes_processed = Step(bytes_to_process, GC_VIA_STACK_GUARD, |
1114 FORCE_COMPLETION, StepOrigin::kV8); | 1122 FORCE_COMPLETION, StepOrigin::kV8); |
1115 } | 1123 } |
1116 bytes_allocated_ -= Min(bytes_allocated_, bytes_processed); | 1124 bytes_allocated_ -= Min(bytes_allocated_, bytes_processed); |
1117 } | 1125 } |
1118 } | 1126 } |
1119 | 1127 |
1120 size_t IncrementalMarking::Step(size_t bytes_to_process, | 1128 size_t IncrementalMarking::Step(size_t bytes_to_process, |
1121 CompletionAction action, | 1129 CompletionAction action, |
1122 ForceCompletionAction completion, | 1130 ForceCompletionAction completion, |
1123 StepOrigin step_origin) { | 1131 StepOrigin step_origin) { |
1124 HistogramTimerScope incremental_marking_scope( | |
1125 heap_->isolate()->counters()->gc_incremental_marking()); | |
1126 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); | |
1127 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL); | |
1128 double start = heap_->MonotonicallyIncreasingTimeInMs(); | 1132 double start = heap_->MonotonicallyIncreasingTimeInMs(); |
1129 | 1133 |
1130 if (state_ == SWEEPING) { | 1134 if (state_ == SWEEPING) { |
1131 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL_SWEEPING); | 1135 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL_SWEEPING); |
1132 FinalizeSweeping(); | 1136 FinalizeSweeping(); |
1133 } | 1137 } |
1134 | 1138 |
1135 size_t bytes_processed = 0; | 1139 size_t bytes_processed = 0; |
1136 if (state_ == MARKING) { | 1140 if (state_ == MARKING) { |
1137 const bool incremental_wrapper_tracing = | 1141 const bool incremental_wrapper_tracing = |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 idle_marking_delay_counter_++; | 1203 idle_marking_delay_counter_++; |
1200 } | 1204 } |
1201 | 1205 |
1202 | 1206 |
1203 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1207 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1204 idle_marking_delay_counter_ = 0; | 1208 idle_marking_delay_counter_ = 0; |
1205 } | 1209 } |
1206 | 1210 |
1207 } // namespace internal | 1211 } // namespace internal |
1208 } // namespace v8 | 1212 } // namespace v8 |
OLD | NEW |