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 1119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1130 if (state_ == SWEEPING) { | 1130 if (state_ == SWEEPING) { |
1131 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL_SWEEPING); | 1131 TRACE_GC(heap_->tracer(), GCTracer::Scope::MC_INCREMENTAL_SWEEPING); |
1132 FinalizeSweeping(); | 1132 FinalizeSweeping(); |
1133 } | 1133 } |
1134 | 1134 |
1135 size_t bytes_processed = 0; | 1135 size_t bytes_processed = 0; |
1136 if (state_ == MARKING) { | 1136 if (state_ == MARKING) { |
1137 const bool incremental_wrapper_tracing = | 1137 const bool incremental_wrapper_tracing = |
1138 FLAG_incremental_marking_wrappers && | 1138 FLAG_incremental_marking_wrappers && |
1139 heap_->local_embedder_heap_tracer()->InUse(); | 1139 heap_->local_embedder_heap_tracer()->InUse(); |
1140 const bool process_wrappers = | 1140 const bool v8_marking_deque_empty = |
1141 incremental_wrapper_tracing && | 1141 heap_->mark_compact_collector()->marking_deque()->IsEmpty(); |
1142 (heap_->local_embedder_heap_tracer() | 1142 const bool process_wrappers = incremental_wrapper_tracing && |
1143 ->RequiresImmediateWrapperProcessing() || | 1143 (heap_->local_embedder_heap_tracer() |
1144 heap_->mark_compact_collector()->marking_deque()->IsEmpty()); | 1144 ->RequiresImmediateWrapperProcessing() || |
| 1145 v8_marking_deque_empty); |
1145 bool wrapper_work_left = incremental_wrapper_tracing; | 1146 bool wrapper_work_left = incremental_wrapper_tracing; |
1146 if (!process_wrappers) { | 1147 if (!process_wrappers) { |
1147 bytes_processed = ProcessMarkingDeque(bytes_to_process); | 1148 bytes_processed = ProcessMarkingDeque(bytes_to_process); |
1148 if (step_origin == StepOrigin::kTask) { | 1149 if (step_origin == StepOrigin::kTask) { |
1149 bytes_marked_ahead_of_schedule_ += bytes_processed; | 1150 bytes_marked_ahead_of_schedule_ += bytes_processed; |
1150 } | 1151 } |
1151 } else { | 1152 } else { |
1152 const double wrapper_deadline = | 1153 const double wrapper_deadline = |
1153 heap_->MonotonicallyIncreasingTimeInMs() + kStepSizeInMs; | 1154 heap_->MonotonicallyIncreasingTimeInMs() + kStepSizeInMs; |
1154 TRACE_GC(heap()->tracer(), | 1155 TRACE_GC(heap()->tracer(), |
1155 GCTracer::Scope::MC_INCREMENTAL_WRAPPER_TRACING); | 1156 GCTracer::Scope::MC_INCREMENTAL_WRAPPER_TRACING); |
| 1157 if (v8_marking_deque_empty) |
| 1158 heap_->local_embedder_heap_tracer()->NotifyV8MarkingDequeWasEmpty(); |
1156 wrapper_work_left = heap_->local_embedder_heap_tracer()->Trace( | 1159 wrapper_work_left = heap_->local_embedder_heap_tracer()->Trace( |
1157 wrapper_deadline, EmbedderHeapTracer::AdvanceTracingActions( | 1160 wrapper_deadline, EmbedderHeapTracer::AdvanceTracingActions( |
1158 EmbedderHeapTracer::ForceCompletionAction:: | 1161 EmbedderHeapTracer::ForceCompletionAction:: |
1159 DO_NOT_FORCE_COMPLETION)); | 1162 DO_NOT_FORCE_COMPLETION)); |
1160 } | 1163 } |
1161 | 1164 |
1162 if (heap_->mark_compact_collector()->marking_deque()->IsEmpty() && | 1165 if (heap_->mark_compact_collector()->marking_deque()->IsEmpty() && |
1163 !wrapper_work_left) { | 1166 !wrapper_work_left) { |
1164 if (completion == FORCE_COMPLETION || | 1167 if (completion == FORCE_COMPLETION || |
1165 IsIdleMarkingDelayCounterLimitReached()) { | 1168 IsIdleMarkingDelayCounterLimitReached()) { |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1199 idle_marking_delay_counter_++; | 1202 idle_marking_delay_counter_++; |
1200 } | 1203 } |
1201 | 1204 |
1202 | 1205 |
1203 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1206 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1204 idle_marking_delay_counter_ = 0; | 1207 idle_marking_delay_counter_ = 0; |
1205 } | 1208 } |
1206 | 1209 |
1207 } // namespace internal | 1210 } // namespace internal |
1208 } // namespace v8 | 1211 } // namespace v8 |
OLD | NEW |