summaryrefslogtreecommitdiff
path: root/deps/v8/src/heap/concurrent-marking.h
blob: 134fa38f6461dee6f4e762f73b6c14e5e2e4ef62 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_HEAP_CONCURRENT_MARKING_
#define V8_HEAP_CONCURRENT_MARKING_

#include "src/allocation.h"
#include "src/cancelable-task.h"
#include "src/utils.h"
#include "src/v8.h"

namespace v8 {
namespace internal {

class ConcurrentMarkingDeque;
class ConcurrentMarkingVisitor;
class Heap;
class Isolate;

class ConcurrentMarking {
 public:
  ConcurrentMarking(Heap* heap, ConcurrentMarkingDeque* deque_);
  ~ConcurrentMarking();

  void StartTask();
  void WaitForTaskToComplete();
  bool IsTaskPending() { return is_task_pending_; }
  void EnsureTaskCompleted();

 private:
  class Task;
  void Run();
  Heap* heap_;
  base::Semaphore pending_task_semaphore_;
  ConcurrentMarkingDeque* deque_;
  ConcurrentMarkingVisitor* visitor_;
  bool is_task_pending_;
};

}  // namespace internal
}  // namespace v8

#endif  // V8_HEAP_PAGE_PARALLEL_JOB_