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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 heap->HighMemoryPressure() ? kShortDelayInSeconds : kLongDelayInSeconds; | 64 heap->HighMemoryPressure() ? kShortDelayInSeconds : kLongDelayInSeconds; |
65 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread(isolate, task, | 65 V8::GetCurrentPlatform()->CallDelayedOnForegroundThread(isolate, task, |
66 delay); | 66 delay); |
67 } | 67 } |
68 } | 68 } |
69 | 69 |
70 | 70 |
71 IncrementalMarkingJob::IdleTask::Progress IncrementalMarkingJob::IdleTask::Step( | 71 IncrementalMarkingJob::IdleTask::Progress IncrementalMarkingJob::IdleTask::Step( |
72 Heap* heap, double deadline_in_ms) { | 72 Heap* heap, double deadline_in_ms) { |
73 IncrementalMarking* incremental_marking = heap->incremental_marking(); | 73 IncrementalMarking* incremental_marking = heap->incremental_marking(); |
74 MarkCompactCollector* mark_compact_collector = heap->mark_compact_collector(); | |
75 if (incremental_marking->IsStopped()) { | 74 if (incremental_marking->IsStopped()) { |
76 return kDone; | 75 return kDone; |
77 } | 76 } |
78 if (mark_compact_collector->sweeping_in_progress()) { | 77 if (incremental_marking->IsSweeping()) { |
79 if (mark_compact_collector->IsSweepingCompleted()) { | 78 incremental_marking->FinalizeSweeping(); |
80 mark_compact_collector->EnsureSweepingCompleted(); | 79 // TODO(hpayer): We can continue here if enough idle time is left. |
81 } | |
82 return kMoreWork; | 80 return kMoreWork; |
83 } | 81 } |
84 const double remaining_idle_time_in_ms = | 82 const double remaining_idle_time_in_ms = |
85 incremental_marking->AdvanceIncrementalMarking( | 83 incremental_marking->AdvanceIncrementalMarking( |
86 deadline_in_ms, IncrementalMarking::IdleStepActions()); | 84 deadline_in_ms, IncrementalMarking::IdleStepActions()); |
87 if (remaining_idle_time_in_ms > 0.0) { | 85 if (remaining_idle_time_in_ms > 0.0) { |
88 heap->TryFinalizeIdleIncrementalMarking(remaining_idle_time_in_ms); | 86 heap->TryFinalizeIdleIncrementalMarking(remaining_idle_time_in_ms); |
89 } | 87 } |
90 return incremental_marking->IsStopped() ? kDone : kMoreWork; | 88 return incremental_marking->IsStopped() ? kDone : kMoreWork; |
91 } | 89 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
140 } | 138 } |
141 // The Step() above could have finished incremental marking. | 139 // The Step() above could have finished incremental marking. |
142 if (!incremental_marking->IsStopped()) { | 140 if (!incremental_marking->IsStopped()) { |
143 job_->ScheduleDelayedTask(heap); | 141 job_->ScheduleDelayedTask(heap); |
144 } | 142 } |
145 } | 143 } |
146 } | 144 } |
147 | 145 |
148 } // namespace internal | 146 } // namespace internal |
149 } // namespace v8 | 147 } // namespace v8 |
OLD | NEW |