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 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 StepSizeToKeepUpWithAllocations() + StepSizeToMakeProgress(); | 1098 StepSizeToKeepUpWithAllocations() + StepSizeToMakeProgress(); |
1099 | 1099 |
1100 if (bytes_to_process >= IncrementalMarking::kAllocatedThreshold) { | 1100 if (bytes_to_process >= IncrementalMarking::kAllocatedThreshold) { |
1101 // The first step after Scavenge will see many allocated bytes. | 1101 // The first step after Scavenge will see many allocated bytes. |
1102 // Cap the step size to distribute the marking work more uniformly. | 1102 // Cap the step size to distribute the marking work more uniformly. |
1103 size_t max_step_size = GCIdleTimeHandler::EstimateMarkingStepSize( | 1103 size_t max_step_size = GCIdleTimeHandler::EstimateMarkingStepSize( |
1104 kMaxStepSizeInMs, | 1104 kMaxStepSizeInMs, |
1105 heap()->tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); | 1105 heap()->tracer()->IncrementalMarkingSpeedInBytesPerMillisecond()); |
1106 bytes_to_process = Min(bytes_to_process, max_step_size); | 1106 bytes_to_process = Min(bytes_to_process, max_step_size); |
1107 | 1107 |
1108 intptr_t bytes_processed = 0; | 1108 size_t bytes_processed = 0; |
1109 if (bytes_marked_ahead_of_schedule_ >= bytes_to_process) { | 1109 if (bytes_marked_ahead_of_schedule_ >= bytes_to_process) { |
1110 // Steps performed in tasks have put us ahead of schedule. | 1110 // Steps performed in tasks have put us ahead of schedule. |
1111 // We skip processing of marking dequeue here and thus | 1111 // We skip processing of marking dequeue here and thus |
1112 // shift marking time from inside V8 to standalone tasks. | 1112 // shift marking time from inside V8 to standalone tasks. |
1113 bytes_marked_ahead_of_schedule_ -= bytes_to_process; | 1113 bytes_marked_ahead_of_schedule_ -= bytes_to_process; |
1114 bytes_processed = bytes_to_process; | 1114 bytes_processed = bytes_to_process; |
1115 } else { | 1115 } else { |
1116 bytes_processed = Step(bytes_to_process, GC_VIA_STACK_GUARD, | 1116 bytes_processed = Step(bytes_to_process, GC_VIA_STACK_GUARD, |
1117 FORCE_COMPLETION, StepOrigin::kV8); | 1117 FORCE_COMPLETION, StepOrigin::kV8); |
1118 } | 1118 } |
1119 bytes_allocated_ -= Min(bytes_allocated_, bytes_to_process); | 1119 bytes_allocated_ -= Min(bytes_allocated_, bytes_processed); |
1120 } | 1120 } |
1121 } | 1121 } |
1122 | 1122 |
1123 size_t IncrementalMarking::Step(size_t bytes_to_process, | 1123 size_t IncrementalMarking::Step(size_t bytes_to_process, |
1124 CompletionAction action, | 1124 CompletionAction action, |
1125 ForceCompletionAction completion, | 1125 ForceCompletionAction completion, |
1126 StepOrigin step_origin) { | 1126 StepOrigin step_origin) { |
1127 HistogramTimerScope incremental_marking_scope( | 1127 HistogramTimerScope incremental_marking_scope( |
1128 heap_->isolate()->counters()->gc_incremental_marking()); | 1128 heap_->isolate()->counters()->gc_incremental_marking()); |
1129 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); | 1129 TRACE_EVENT0("v8", "V8.GCIncrementalMarking"); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 idle_marking_delay_counter_++; | 1201 idle_marking_delay_counter_++; |
1202 } | 1202 } |
1203 | 1203 |
1204 | 1204 |
1205 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 1205 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
1206 idle_marking_delay_counter_ = 0; | 1206 idle_marking_delay_counter_ = 0; |
1207 } | 1207 } |
1208 | 1208 |
1209 } // namespace internal | 1209 } // namespace internal |
1210 } // namespace v8 | 1210 } // namespace v8 |
OLD | NEW |