summaryrefslogtreecommitdiff
path: root/deps/v8/src/heap/global-handle-marking-visitor.h
blob: 9c1b1a1b340bff1c363e5f43a1deb4aad8a046c8 (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
// Copyright 2022 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_GLOBAL_HANDLE_MARKING_VISITOR_H_
#define V8_HEAP_GLOBAL_HANDLE_MARKING_VISITOR_H_

#include "src/handles/traced-handles.h"
#include "src/heap/base/stack.h"
#include "src/heap/heap.h"
#include "src/heap/mark-compact.h"

namespace v8 {
namespace internal {

// Root marking visitor for conservatively marking traced global handles.
// The visitor assumes that on-stack pointers may point into global handle nodes
// which requires them to be kept alive.
class GlobalHandleMarkingVisitor final : public ::heap::base::StackVisitor {
 public:
  GlobalHandleMarkingVisitor(Heap&, MarkingWorklists::Local&);
  ~GlobalHandleMarkingVisitor() override = default;

  void VisitPointer(const void*) override;

 private:
  Heap& heap_;
  MarkingState& marking_state_;
  MarkingWorklists::Local& local_marking_worklist_;
  const TracedHandles::NodeBounds traced_node_bounds_;
};

#endif  // V8_HEAP_GLOBAL_HANDLE_MARKING_VISITOR_H_

}  // namespace internal
}  // namespace v8