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" |
11 #include "src/isolate.h" | 11 #include "src/isolate.h" |
12 #include "src/v8.h" | 12 #include "src/v8.h" |
| 13 #include "src/vm-state-inl.h" |
13 | 14 |
14 namespace v8 { | 15 namespace v8 { |
15 namespace internal { | 16 namespace internal { |
16 | 17 |
17 void IncrementalMarkingJob::Start(Heap* heap) { | 18 void IncrementalMarkingJob::Start(Heap* heap) { |
18 DCHECK(!heap->incremental_marking()->IsStopped()); | 19 DCHECK(!heap->incremental_marking()->IsStopped()); |
19 ScheduleTask(heap); | 20 ScheduleTask(heap); |
20 } | 21 } |
21 | 22 |
22 void IncrementalMarkingJob::NotifyTask() { task_pending_ = false; } | 23 void IncrementalMarkingJob::NotifyTask() { task_pending_ = false; } |
(...skipping 12 matching lines...) Expand all Loading... |
35 double deadline = | 36 double deadline = |
36 heap->MonotonicallyIncreasingTimeInMs() + kIncrementalMarkingDelayMs; | 37 heap->MonotonicallyIncreasingTimeInMs() + kIncrementalMarkingDelayMs; |
37 heap->incremental_marking()->AdvanceIncrementalMarking( | 38 heap->incremental_marking()->AdvanceIncrementalMarking( |
38 deadline, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 39 deadline, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
39 i::IncrementalMarking::FORCE_COMPLETION, i::StepOrigin::kTask); | 40 i::IncrementalMarking::FORCE_COMPLETION, i::StepOrigin::kTask); |
40 heap->FinalizeIncrementalMarkingIfComplete( | 41 heap->FinalizeIncrementalMarkingIfComplete( |
41 GarbageCollectionReason::kFinalizeMarkingViaTask); | 42 GarbageCollectionReason::kFinalizeMarkingViaTask); |
42 } | 43 } |
43 | 44 |
44 void IncrementalMarkingJob::Task::RunInternal() { | 45 void IncrementalMarkingJob::Task::RunInternal() { |
| 46 VMState<GC> state(isolate()); |
| 47 RuntimeCallTimerScope(isolate(), &RuntimeCallStats::GC_IncrementalMarkingJob); |
| 48 |
45 Heap* heap = isolate()->heap(); | 49 Heap* heap = isolate()->heap(); |
46 job_->NotifyTask(); | 50 job_->NotifyTask(); |
47 IncrementalMarking* incremental_marking = heap->incremental_marking(); | 51 IncrementalMarking* incremental_marking = heap->incremental_marking(); |
48 if (incremental_marking->IsStopped()) { | 52 if (incremental_marking->IsStopped()) { |
49 if (heap->IncrementalMarkingLimitReached() != | 53 if (heap->IncrementalMarkingLimitReached() != |
50 Heap::IncrementalMarkingLimit::kNoLimit) { | 54 Heap::IncrementalMarkingLimit::kNoLimit) { |
51 heap->StartIncrementalMarking(Heap::kNoGCFlags, | 55 heap->StartIncrementalMarking(Heap::kNoGCFlags, |
52 GarbageCollectionReason::kIdleTask, | 56 GarbageCollectionReason::kIdleTask, |
53 kNoGCCallbackFlags); | 57 kNoGCCallbackFlags); |
54 } | 58 } |
55 } | 59 } |
56 if (!incremental_marking->IsStopped()) { | 60 if (!incremental_marking->IsStopped()) { |
57 Step(heap); | 61 Step(heap); |
58 if (!incremental_marking->IsStopped()) { | 62 if (!incremental_marking->IsStopped()) { |
59 job_->ScheduleTask(heap); | 63 job_->ScheduleTask(heap); |
60 } | 64 } |
61 } | 65 } |
62 } | 66 } |
63 | 67 |
64 } // namespace internal | 68 } // namespace internal |
65 } // namespace v8 | 69 } // namespace v8 |
OLD | NEW |