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-job.h" | 5 #include "src/heap/incremental-marking-job.h" |
6 | 6 |
7 #include "src/base/platform/time.h" | 7 #include "src/base/platform/time.h" |
8 #include "src/heap/heap-inl.h" | 8 #include "src/heap/heap-inl.h" |
9 #include "src/heap/heap.h" | 9 #include "src/heap/heap.h" |
10 #include "src/heap/incremental-marking.h" | 10 #include "src/heap/incremental-marking.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 return kDone; | 76 return kDone; |
77 } | 77 } |
78 if (mark_compact_collector->sweeping_in_progress()) { | 78 if (mark_compact_collector->sweeping_in_progress()) { |
79 if (mark_compact_collector->IsSweepingCompleted()) { | 79 if (mark_compact_collector->IsSweepingCompleted()) { |
80 mark_compact_collector->EnsureSweepingCompleted(); | 80 mark_compact_collector->EnsureSweepingCompleted(); |
81 } | 81 } |
82 return kMoreWork; | 82 return kMoreWork; |
83 } | 83 } |
84 const double remaining_idle_time_in_ms = | 84 const double remaining_idle_time_in_ms = |
85 incremental_marking->AdvanceIncrementalMarking( | 85 incremental_marking->AdvanceIncrementalMarking( |
86 0, deadline_in_ms, IncrementalMarking::IdleStepActions()); | 86 deadline_in_ms, IncrementalMarking::IdleStepActions()); |
87 if (remaining_idle_time_in_ms > 0.0) { | 87 if (remaining_idle_time_in_ms > 0.0) { |
88 heap->TryFinalizeIdleIncrementalMarking(remaining_idle_time_in_ms); | 88 heap->TryFinalizeIdleIncrementalMarking(remaining_idle_time_in_ms); |
89 } | 89 } |
90 return incremental_marking->IsStopped() ? kDone : kMoreWork; | 90 return incremental_marking->IsStopped() ? kDone : kMoreWork; |
91 } | 91 } |
92 | 92 |
93 | 93 |
94 void IncrementalMarkingJob::IdleTask::RunInternal(double deadline_in_seconds) { | 94 void IncrementalMarkingJob::IdleTask::RunInternal(double deadline_in_seconds) { |
95 double deadline_in_ms = | 95 double deadline_in_ms = |
96 deadline_in_seconds * | 96 deadline_in_seconds * |
(...skipping 17 matching lines...) Expand all Loading... |
114 deadline_difference); | 114 deadline_difference); |
115 } | 115 } |
116 } | 116 } |
117 | 117 |
118 | 118 |
119 void IncrementalMarkingJob::DelayedTask::Step(Heap* heap) { | 119 void IncrementalMarkingJob::DelayedTask::Step(Heap* heap) { |
120 const int kIncrementalMarkingDelayMs = 50; | 120 const int kIncrementalMarkingDelayMs = 50; |
121 double deadline = | 121 double deadline = |
122 heap->MonotonicallyIncreasingTimeInMs() + kIncrementalMarkingDelayMs; | 122 heap->MonotonicallyIncreasingTimeInMs() + kIncrementalMarkingDelayMs; |
123 heap->incremental_marking()->AdvanceIncrementalMarking( | 123 heap->incremental_marking()->AdvanceIncrementalMarking( |
124 0, deadline, i::IncrementalMarking::StepActions( | 124 deadline, i::IncrementalMarking::StepActions( |
125 i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 125 i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
126 i::IncrementalMarking::FORCE_MARKING, | 126 i::IncrementalMarking::FORCE_MARKING, |
127 i::IncrementalMarking::FORCE_COMPLETION)); | 127 i::IncrementalMarking::FORCE_COMPLETION)); |
128 heap->FinalizeIncrementalMarkingIfComplete( | 128 heap->FinalizeIncrementalMarkingIfComplete( |
129 "Incremental marking task: finalize incremental marking"); | 129 "Incremental marking task: finalize incremental marking"); |
130 } | 130 } |
131 | 131 |
132 | 132 |
133 void IncrementalMarkingJob::DelayedTask::RunInternal() { | 133 void IncrementalMarkingJob::DelayedTask::RunInternal() { |
134 Heap* heap = isolate()->heap(); | 134 Heap* heap = isolate()->heap(); |
135 job_->NotifyDelayedTask(); | 135 job_->NotifyDelayedTask(); |
136 IncrementalMarking* incremental_marking = heap->incremental_marking(); | 136 IncrementalMarking* incremental_marking = heap->incremental_marking(); |
137 if (!incremental_marking->IsStopped()) { | 137 if (!incremental_marking->IsStopped()) { |
138 if (job_->ShouldForceMarkingStep()) { | 138 if (job_->ShouldForceMarkingStep()) { |
139 Step(heap); | 139 Step(heap); |
140 } | 140 } |
141 // The Step() above could have finished incremental marking. | 141 // The Step() above could have finished incremental marking. |
142 if (!incremental_marking->IsStopped()) { | 142 if (!incremental_marking->IsStopped()) { |
143 job_->ScheduleDelayedTask(heap); | 143 job_->ScheduleDelayedTask(heap); |
144 } | 144 } |
145 } | 145 } |
146 } | 146 } |
147 | 147 |
148 } // namespace internal | 148 } // namespace internal |
149 } // namespace v8 | 149 } // namespace v8 |
OLD | NEW |