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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 if (incremental_marking->IsStopped()) { | 74 if (incremental_marking->IsStopped()) { |
75 return kDone; | 75 return kDone; |
76 } | 76 } |
77 if (incremental_marking->IsSweeping()) { | 77 if (incremental_marking->IsSweeping()) { |
78 incremental_marking->FinalizeSweeping(); | 78 incremental_marking->FinalizeSweeping(); |
79 // TODO(hpayer): We can continue here if enough idle time is left. | 79 // TODO(hpayer): We can continue here if enough idle time is left. |
80 return kMoreWork; | 80 return kMoreWork; |
81 } | 81 } |
82 const double remaining_idle_time_in_ms = | 82 const double remaining_idle_time_in_ms = |
83 incremental_marking->AdvanceIncrementalMarking( | 83 incremental_marking->AdvanceIncrementalMarking( |
84 deadline_in_ms, IncrementalMarking::IdleStepActions()); | 84 deadline_in_ms, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 85 IncrementalMarking::DO_NOT_FORCE_COMPLETION); |
85 if (remaining_idle_time_in_ms > 0.0) { | 86 if (remaining_idle_time_in_ms > 0.0) { |
86 heap->TryFinalizeIdleIncrementalMarking(remaining_idle_time_in_ms); | 87 heap->TryFinalizeIdleIncrementalMarking(remaining_idle_time_in_ms); |
87 } | 88 } |
88 return incremental_marking->IsStopped() ? kDone : kMoreWork; | 89 return incremental_marking->IsStopped() ? kDone : kMoreWork; |
89 } | 90 } |
90 | 91 |
91 | 92 |
92 void IncrementalMarkingJob::IdleTask::RunInternal(double deadline_in_seconds) { | 93 void IncrementalMarkingJob::IdleTask::RunInternal(double deadline_in_seconds) { |
93 double deadline_in_ms = | 94 double deadline_in_ms = |
94 deadline_in_seconds * | 95 deadline_in_seconds * |
(...skipping 17 matching lines...) Expand all Loading... |
112 deadline_difference); | 113 deadline_difference); |
113 } | 114 } |
114 } | 115 } |
115 | 116 |
116 | 117 |
117 void IncrementalMarkingJob::DelayedTask::Step(Heap* heap) { | 118 void IncrementalMarkingJob::DelayedTask::Step(Heap* heap) { |
118 const int kIncrementalMarkingDelayMs = 50; | 119 const int kIncrementalMarkingDelayMs = 50; |
119 double deadline = | 120 double deadline = |
120 heap->MonotonicallyIncreasingTimeInMs() + kIncrementalMarkingDelayMs; | 121 heap->MonotonicallyIncreasingTimeInMs() + kIncrementalMarkingDelayMs; |
121 heap->incremental_marking()->AdvanceIncrementalMarking( | 122 heap->incremental_marking()->AdvanceIncrementalMarking( |
122 deadline, i::IncrementalMarking::StepActions( | 123 deadline, IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
123 i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 124 IncrementalMarking::FORCE_COMPLETION); |
124 i::IncrementalMarking::FORCE_MARKING, | |
125 i::IncrementalMarking::FORCE_COMPLETION)); | |
126 heap->FinalizeIncrementalMarkingIfComplete( | 125 heap->FinalizeIncrementalMarkingIfComplete( |
127 "Incremental marking task: finalize incremental marking"); | 126 "Incremental marking task: finalize incremental marking"); |
128 } | 127 } |
129 | 128 |
130 | 129 |
131 void IncrementalMarkingJob::DelayedTask::RunInternal() { | 130 void IncrementalMarkingJob::DelayedTask::RunInternal() { |
132 Heap* heap = isolate()->heap(); | 131 Heap* heap = isolate()->heap(); |
133 job_->NotifyDelayedTask(); | 132 job_->NotifyDelayedTask(); |
134 IncrementalMarking* incremental_marking = heap->incremental_marking(); | 133 IncrementalMarking* incremental_marking = heap->incremental_marking(); |
135 if (!incremental_marking->IsStopped()) { | 134 if (!incremental_marking->IsStopped()) { |
136 if (job_->ShouldForceMarkingStep()) { | 135 if (job_->ShouldForceMarkingStep()) { |
137 Step(heap); | 136 Step(heap); |
138 } | 137 } |
139 // The Step() above could have finished incremental marking. | 138 // The Step() above could have finished incremental marking. |
140 if (!incremental_marking->IsStopped()) { | 139 if (!incremental_marking->IsStopped()) { |
141 job_->ScheduleDelayedTask(heap); | 140 job_->ScheduleDelayedTask(heap); |
142 } | 141 } |
143 } | 142 } |
144 } | 143 } |
145 | 144 |
146 } // namespace internal | 145 } // namespace internal |
147 } // namespace v8 | 146 } // namespace v8 |
OLD | NEW |