v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
unified-heap-marking-visitor.h
Go to the documentation of this file.
1// Copyright 2020 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_VISITOR_H_
6#define V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_VISITOR_H_
7
9#include "include/v8-cppgc.h"
10#include "src/base/macros.h"
13
14namespace cppgc {
15
16namespace internal {
17class ConcurrentMarkingState;
18class BasicMarkingState;
19class MutatorMarkingState;
20} // namespace internal
21} // namespace cppgc
22
23namespace v8 {
24
25class SourceLocation;
26
27namespace internal {
28
34
35class UnifiedHeapMarker;
36
38 public:
41 ~UnifiedHeapMarkingVisitorBase() override = default;
42
43 protected:
44 // C++ handling.
45 void Visit(const void*, TraceDescriptor) final;
46 void VisitMultipleUncompressedMember(const void*, size_t,
48#if defined(CPPGC_POINTER_COMPRESSION)
49 void VisitMultipleCompressedMember(const void*, size_t,
51#endif // defined(CPPGC_POINTER_COMPRESSION)
52 void VisitWeak(const void*, TraceDescriptor, WeakCallback, const void*) final;
53 void VisitEphemeron(const void*, const void*, TraceDescriptor) final;
54 void VisitWeakContainer(const void* self, TraceDescriptor strong_desc,
56 const void* data) final;
57 void RegisterWeakCallback(WeakCallback, const void*) final;
58 void HandleMovableReference(const void**) final;
59
60 // JS handling.
61 void Visit(const TracedReferenceBase& ref) override;
62
65
66 friend class UnifiedHeapMarker;
67};
68
76
79 public:
84
85 protected:
86 bool DeferTraceToMutatorThreadIfConcurrent(const void*, cppgc::TraceCallback,
87 size_t) final;
88
89 private:
90 // Visitor owns the local worklist. All remaining items are published on
91 // destruction of the visitor. This is good enough as concurrent visitation
92 // ends before computing the rest of the transitive closure on the main
93 // thread. Dynamically allocated as it is only present when the heaps are
94 // attached.
95 std::unique_ptr<MarkingWorklists::Local> local_marking_worklist_;
97
98#ifdef V8_COMPRESS_POINTERS_IN_MULTIPLE_CAGES
99 IsolateGroup* saved_isolate_group_ = nullptr;
100#endif
101};
102
103} // namespace internal
104} // namespace v8
105
106#endif // V8_HEAP_CPPGC_JS_UNIFIED_HEAP_MARKING_VISITOR_H_
std::unique_ptr< MarkingWorklists::Local > local_marking_worklist_
cppgc::internal::BasicMarkingState & marking_state_
TNode< Object > callback
v8::SourceLocation SourceLocation
void(*)(const LivenessBroker &, const void *) WeakCallback
Definition visitor.h:37
TraceDescriptor(*)(const void *address) TraceDescriptorCallback
Definition trace-trait.h:62
void(*)(Visitor *visitor, const void *object) TraceCallback
Definition trace-trait.h:38
#define V8_EXPORT_PRIVATE
Definition macros.h:460