OLD | NEW |
1 // Copyright 2017 the V8 project authors. All rights reserved. | 1 // Copyright 2017 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 #ifndef V8_HEAP_CONCURRENT_MARKING_ | 5 #ifndef V8_HEAP_CONCURRENT_MARKING_ |
6 #define V8_HEAP_CONCURRENT_MARKING_ | 6 #define V8_HEAP_CONCURRENT_MARKING_ |
7 | 7 |
8 #include <vector> | |
9 | |
10 #include "src/allocation.h" | 8 #include "src/allocation.h" |
11 #include "src/cancelable-task.h" | 9 #include "src/cancelable-task.h" |
12 #include "src/utils.h" | 10 #include "src/utils.h" |
13 #include "src/v8.h" | 11 #include "src/v8.h" |
14 | 12 |
15 namespace v8 { | 13 namespace v8 { |
16 namespace internal { | 14 namespace internal { |
17 | 15 |
| 16 class ConcurrentMarkingDeque; |
| 17 class ConcurrentMarkingVisitor; |
18 class Heap; | 18 class Heap; |
19 class Isolate; | 19 class Isolate; |
20 | 20 |
21 class ConcurrentMarking { | 21 class ConcurrentMarking { |
22 public: | 22 public: |
23 explicit ConcurrentMarking(Heap* heap); | 23 ConcurrentMarking(Heap* heap, ConcurrentMarkingDeque* deque_); |
24 ~ConcurrentMarking(); | 24 ~ConcurrentMarking(); |
25 | 25 |
26 void AddRoot(HeapObject* object); | |
27 | |
28 void StartTask(); | 26 void StartTask(); |
29 void WaitForTaskToComplete(); | 27 void WaitForTaskToComplete(); |
30 bool IsTaskPending() { return is_task_pending_; } | 28 bool IsTaskPending() { return is_task_pending_; } |
31 void EnsureTaskCompleted(); | 29 void EnsureTaskCompleted(); |
32 | 30 |
33 private: | 31 private: |
34 class Task; | 32 class Task; |
| 33 void Run(); |
35 Heap* heap_; | 34 Heap* heap_; |
36 base::Semaphore pending_task_semaphore_; | 35 base::Semaphore pending_task_semaphore_; |
| 36 ConcurrentMarkingDeque* deque_; |
| 37 ConcurrentMarkingVisitor* visitor_; |
37 bool is_task_pending_; | 38 bool is_task_pending_; |
38 std::vector<HeapObject*> root_set_; | |
39 }; | 39 }; |
40 | 40 |
41 } // namespace internal | 41 } // namespace internal |
42 } // namespace v8 | 42 } // namespace v8 |
43 | 43 |
44 #endif // V8_HEAP_PAGE_PARALLEL_JOB_ | 44 #endif // V8_HEAP_PAGE_PARALLEL_JOB_ |
OLD | NEW |