libv8-node 15.14.0.1-aarch64-linux → 16.10.0.0-aarch64-linux
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/ext/libv8-node/location.rb +1 -1
- data/ext/libv8-node/paths.rb +1 -1
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/{out.gn → aarch64-linux}/libv8/obj/libv8_monolith.a +0 -0
- data/vendor/v8/include/cppgc/allocation.h +104 -45
- data/vendor/v8/include/cppgc/common.h +9 -6
- data/vendor/v8/include/cppgc/cross-thread-persistent.h +384 -0
- data/vendor/v8/include/cppgc/custom-space.h +37 -2
- data/vendor/v8/include/cppgc/default-platform.h +47 -48
- data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
- data/vendor/v8/include/cppgc/explicit-management.h +82 -0
- data/vendor/v8/include/cppgc/garbage-collected.h +4 -3
- data/vendor/v8/include/cppgc/heap-consistency.h +236 -0
- data/vendor/v8/include/cppgc/heap-state.h +70 -0
- data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
- data/vendor/v8/include/cppgc/heap.h +68 -6
- data/vendor/v8/include/cppgc/internal/api-constants.h +3 -3
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +2 -1
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +2 -2
- data/vendor/v8/include/cppgc/internal/gc-info.h +44 -13
- data/vendor/v8/include/cppgc/internal/name-trait.h +111 -0
- data/vendor/v8/include/cppgc/internal/persistent-node.h +57 -1
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +69 -28
- data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +1 -1
- data/vendor/v8/include/cppgc/internal/write-barrier.h +353 -35
- data/vendor/v8/include/cppgc/liveness-broker.h +7 -1
- data/vendor/v8/include/cppgc/macros.h +2 -0
- data/vendor/v8/include/cppgc/member.h +85 -25
- data/vendor/v8/include/cppgc/name-provider.h +65 -0
- data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
- data/vendor/v8/include/cppgc/persistent.h +33 -9
- data/vendor/v8/include/cppgc/platform.h +48 -25
- data/vendor/v8/include/cppgc/prefinalizer.h +1 -1
- data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
- data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
- data/vendor/v8/include/cppgc/source-location.h +2 -1
- data/vendor/v8/include/cppgc/testing.h +99 -0
- data/vendor/v8/include/cppgc/trace-trait.h +8 -3
- data/vendor/v8/include/cppgc/type-traits.h +157 -19
- data/vendor/v8/include/cppgc/visitor.h +187 -23
- data/vendor/v8/include/libplatform/libplatform.h +11 -0
- data/vendor/v8/include/libplatform/v8-tracing.h +2 -0
- data/vendor/v8/include/v8-cppgc.h +258 -159
- data/vendor/v8/include/v8-fast-api-calls.h +562 -159
- data/vendor/v8/include/v8-inspector.h +23 -2
- data/vendor/v8/include/v8-internal.h +99 -27
- data/vendor/v8/include/v8-metrics.h +77 -8
- data/vendor/v8/include/v8-platform.h +47 -22
- data/vendor/v8/include/v8-profiler.h +75 -11
- data/vendor/v8/include/v8-unwinder-state.h +30 -0
- data/vendor/v8/include/v8-util.h +1 -1
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8.h +1192 -642
- data/vendor/v8/include/v8config.h +40 -9
- metadata +17 -5
- data/vendor/v8/include/cppgc/internal/process-heap.h +0 -34
@@ -125,6 +125,8 @@ class V8_PLATFORM_EXPORT TraceWriter {
|
|
125
125
|
static TraceWriter* CreateJSONTraceWriter(std::ostream& stream,
|
126
126
|
const std::string& tag);
|
127
127
|
|
128
|
+
static TraceWriter* CreateSystemInstrumentationTraceWriter();
|
129
|
+
|
128
130
|
private:
|
129
131
|
// Disallow copy and assign
|
130
132
|
TraceWriter(const TraceWriter&) = delete;
|
@@ -5,209 +5,308 @@
|
|
5
5
|
#ifndef INCLUDE_V8_CPPGC_H_
|
6
6
|
#define INCLUDE_V8_CPPGC_H_
|
7
7
|
|
8
|
+
#include <cstdint>
|
9
|
+
#include <memory>
|
10
|
+
#include <vector>
|
11
|
+
|
12
|
+
#include "cppgc/common.h"
|
13
|
+
#include "cppgc/custom-space.h"
|
14
|
+
#include "cppgc/heap-statistics.h"
|
15
|
+
#include "cppgc/internal/write-barrier.h"
|
8
16
|
#include "cppgc/visitor.h"
|
9
17
|
#include "v8-internal.h" // NOLINT(build/include_directory)
|
10
|
-
#include "v8.h"
|
18
|
+
#include "v8.h" // NOLINT(build/include_directory)
|
11
19
|
|
12
|
-
namespace
|
20
|
+
namespace cppgc {
|
21
|
+
class AllocationHandle;
|
22
|
+
class HeapHandle;
|
23
|
+
} // namespace cppgc
|
13
24
|
|
14
|
-
|
15
|
-
template <typename T>
|
16
|
-
class JSMember;
|
25
|
+
namespace v8 {
|
17
26
|
|
18
27
|
namespace internal {
|
28
|
+
class CppHeap;
|
29
|
+
} // namespace internal
|
19
30
|
|
20
|
-
class
|
31
|
+
class CustomSpaceStatisticsReceiver;
|
21
32
|
|
22
|
-
|
23
|
-
|
33
|
+
/**
|
34
|
+
* Describes how V8 wrapper objects maintain references to garbage-collected C++
|
35
|
+
* objects.
|
36
|
+
*/
|
37
|
+
struct WrapperDescriptor final {
|
24
38
|
/**
|
25
|
-
*
|
26
|
-
* object
|
39
|
+
* The index used on `v8::Ojbect::SetAlignedPointerFromInternalField()` and
|
40
|
+
* related APIs to add additional data to an object which is used to identify
|
41
|
+
* JS->C++ references.
|
27
42
|
*/
|
28
|
-
|
43
|
+
using InternalFieldIndex = int;
|
29
44
|
|
30
45
|
/**
|
31
|
-
*
|
46
|
+
* Unknown embedder id. The value is reserved for internal usages and must not
|
47
|
+
* be used with `CppHeap`.
|
32
48
|
*/
|
33
|
-
|
34
|
-
|
35
|
-
private:
|
36
|
-
static internal::Address* New(v8::Isolate* isolate,
|
37
|
-
internal::Address* object_slot,
|
38
|
-
internal::Address** this_slot);
|
39
|
-
static void Delete(internal::Address* object);
|
40
|
-
static void Copy(const internal::Address* const* from_slot,
|
41
|
-
internal::Address** to_slot);
|
42
|
-
static void Move(internal::Address** from_slot, internal::Address** to_slot);
|
49
|
+
static constexpr uint16_t kUnknownEmbedderId = UINT16_MAX;
|
43
50
|
|
44
|
-
|
51
|
+
constexpr WrapperDescriptor(InternalFieldIndex wrappable_type_index,
|
52
|
+
InternalFieldIndex wrappable_instance_index,
|
53
|
+
uint16_t embedder_id_for_garbage_collected)
|
54
|
+
: wrappable_type_index(wrappable_type_index),
|
55
|
+
wrappable_instance_index(wrappable_instance_index),
|
56
|
+
embedder_id_for_garbage_collected(embedder_id_for_garbage_collected) {}
|
45
57
|
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
inline JSMemberBase& MoveImpl(JSMemberBase&& other);
|
58
|
+
/**
|
59
|
+
* Index of the wrappable type.
|
60
|
+
*/
|
61
|
+
InternalFieldIndex wrappable_type_index;
|
51
62
|
|
52
|
-
|
53
|
-
|
63
|
+
/**
|
64
|
+
* Index of the wrappable instance.
|
65
|
+
*/
|
66
|
+
InternalFieldIndex wrappable_instance_index;
|
54
67
|
|
55
|
-
|
56
|
-
|
57
|
-
|
68
|
+
/**
|
69
|
+
* Embedder id identifying instances of garbage-collected objects. It is
|
70
|
+
* expected that the first field of the wrappable type is a uint16_t holding
|
71
|
+
* the id. Only references to instances of wrappables types with an id of
|
72
|
+
* `embedder_id_for_garbage_collected` will be considered by CppHeap.
|
73
|
+
*/
|
74
|
+
uint16_t embedder_id_for_garbage_collected;
|
58
75
|
};
|
59
76
|
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
if (!other.IsEmpty()) {
|
64
|
-
Copy(&other.val_, &val_);
|
65
|
-
}
|
66
|
-
}
|
67
|
-
return *this;
|
68
|
-
}
|
69
|
-
|
70
|
-
JSMemberBase& JSMemberBase::MoveImpl(JSMemberBase&& other) {
|
71
|
-
if (this != &other) {
|
72
|
-
// No call to Reset() as Move() will conditionally reset itself when needed,
|
73
|
-
// and otherwise reuse the internal meta data.
|
74
|
-
Move(&other.val_, &val_);
|
75
|
-
}
|
76
|
-
return *this;
|
77
|
-
}
|
78
|
-
|
79
|
-
void JSMemberBase::Reset() {
|
80
|
-
if (IsEmpty()) return;
|
81
|
-
Delete(val_);
|
82
|
-
val_ = nullptr;
|
83
|
-
}
|
77
|
+
struct V8_EXPORT CppHeapCreateParams {
|
78
|
+
CppHeapCreateParams(const CppHeapCreateParams&) = delete;
|
79
|
+
CppHeapCreateParams& operator=(const CppHeapCreateParams&) = delete;
|
84
80
|
|
85
|
-
|
81
|
+
std::vector<std::unique_ptr<cppgc::CustomSpaceBase>> custom_spaces;
|
82
|
+
WrapperDescriptor wrapper_descriptor;
|
83
|
+
};
|
86
84
|
|
87
85
|
/**
|
88
|
-
* A
|
89
|
-
* only be used in GarbageCollected objects and must be processed in a Trace()
|
90
|
-
* method.
|
86
|
+
* A heap for allocating managed C++ objects.
|
91
87
|
*/
|
92
|
-
|
93
|
-
class V8_EXPORT JSMember : public internal::JSMemberBase {
|
94
|
-
static_assert(std::is_base_of<v8::Value, T>::value,
|
95
|
-
"JSMember only supports references to v8::Value");
|
96
|
-
|
88
|
+
class V8_EXPORT CppHeap {
|
97
89
|
public:
|
98
|
-
|
99
|
-
|
100
|
-
template <typename U,
|
101
|
-
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
|
102
|
-
JSMember(Isolate* isolate, Local<U> that)
|
103
|
-
: internal::JSMemberBase(isolate,
|
104
|
-
reinterpret_cast<internal::Address*>(*that)) {}
|
90
|
+
static std::unique_ptr<CppHeap> Create(v8::Platform* platform,
|
91
|
+
const CppHeapCreateParams& params);
|
105
92
|
|
106
|
-
|
93
|
+
virtual ~CppHeap() = default;
|
107
94
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
JSMember(JSMember&& other) { MoveImpl(std::move(other)); }
|
95
|
+
/**
|
96
|
+
* \returns the opaque handle for allocating objects using
|
97
|
+
* `MakeGarbageCollected()`.
|
98
|
+
*/
|
99
|
+
cppgc::AllocationHandle& GetAllocationHandle();
|
115
100
|
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
101
|
+
/**
|
102
|
+
* \returns the opaque heap handle which may be used to refer to this heap in
|
103
|
+
* other APIs. Valid as long as the underlying `CppHeap` is alive.
|
104
|
+
*/
|
105
|
+
cppgc::HeapHandle& GetHeapHandle();
|
121
106
|
|
122
|
-
|
107
|
+
/**
|
108
|
+
* Terminate clears all roots and performs multiple garbage collections to
|
109
|
+
* reclaim potentially newly created objects in destructors.
|
110
|
+
*
|
111
|
+
* After this call, object allocation is prohibited.
|
112
|
+
*/
|
113
|
+
void Terminate();
|
123
114
|
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
115
|
+
/**
|
116
|
+
* \param detail_level specifies whether should return detailed
|
117
|
+
* statistics or only brief summary statistics.
|
118
|
+
* \returns current CppHeap statistics regarding memory consumption
|
119
|
+
* and utilization.
|
120
|
+
*/
|
121
|
+
cppgc::HeapStatistics CollectStatistics(
|
122
|
+
cppgc::HeapStatistics::DetailLevel detail_level);
|
129
123
|
|
130
|
-
|
124
|
+
/**
|
125
|
+
* Collects statistics for the given spaces and reports them to the receiver.
|
126
|
+
*
|
127
|
+
* \param custom_spaces a collection of custom space indicies.
|
128
|
+
* \param receiver an object that gets the results.
|
129
|
+
*/
|
130
|
+
void CollectCustomSpaceStatisticsAtLastGC(
|
131
|
+
std::vector<cppgc::CustomSpaceIndex> custom_spaces,
|
132
|
+
std::unique_ptr<CustomSpaceStatisticsReceiver> receiver);
|
131
133
|
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
134
|
+
/**
|
135
|
+
* Enables a detached mode that allows testing garbage collection using
|
136
|
+
* `cppgc::testing` APIs. Once used, the heap cannot be attached to an
|
137
|
+
* `Isolate` anymore.
|
138
|
+
*/
|
139
|
+
void EnableDetachedGarbageCollectionsForTesting();
|
137
140
|
|
138
|
-
|
139
|
-
|
141
|
+
/**
|
142
|
+
* Performs a stop-the-world garbage collection for testing purposes.
|
143
|
+
*
|
144
|
+
* \param stack_state The stack state to assume for the garbage collection.
|
145
|
+
*/
|
146
|
+
void CollectGarbageForTesting(cppgc::EmbedderStackState stack_state);
|
140
147
|
|
141
|
-
|
148
|
+
private:
|
149
|
+
CppHeap() = default;
|
142
150
|
|
143
|
-
|
144
|
-
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
|
145
|
-
void Set(v8::Isolate* isolate, Local<U> that) {
|
146
|
-
Reset();
|
147
|
-
val_ = New(isolate, reinterpret_cast<internal::Address*>(*that), &val_);
|
148
|
-
}
|
151
|
+
friend class internal::CppHeap;
|
149
152
|
};
|
150
153
|
|
151
|
-
template <typename T1, typename T2,
|
152
|
-
typename = std::enable_if_t<std::is_base_of<T2, T1>::value ||
|
153
|
-
std::is_base_of<T1, T2>::value>>
|
154
|
-
inline bool operator==(const JSMember<T1>& lhs, const JSMember<T2>& rhs) {
|
155
|
-
v8::internal::Address* a = reinterpret_cast<v8::internal::Address*>(*lhs);
|
156
|
-
v8::internal::Address* b = reinterpret_cast<v8::internal::Address*>(*rhs);
|
157
|
-
if (a == nullptr) return b == nullptr;
|
158
|
-
if (b == nullptr) return false;
|
159
|
-
return *a == *b;
|
160
|
-
}
|
161
|
-
|
162
|
-
template <typename T1, typename T2,
|
163
|
-
typename = std::enable_if_t<std::is_base_of<T2, T1>::value ||
|
164
|
-
std::is_base_of<T1, T2>::value>>
|
165
|
-
inline bool operator!=(const JSMember<T1>& lhs, const JSMember<T2>& rhs) {
|
166
|
-
return !(lhs == rhs);
|
167
|
-
}
|
168
|
-
|
169
|
-
template <typename T1, typename T2,
|
170
|
-
typename = std::enable_if_t<std::is_base_of<T2, T1>::value ||
|
171
|
-
std::is_base_of<T1, T2>::value>>
|
172
|
-
inline bool operator==(const JSMember<T1>& lhs, const Local<T2>& rhs) {
|
173
|
-
v8::internal::Address* a = reinterpret_cast<v8::internal::Address*>(*lhs);
|
174
|
-
v8::internal::Address* b = reinterpret_cast<v8::internal::Address*>(*rhs);
|
175
|
-
if (a == nullptr) return b == nullptr;
|
176
|
-
if (b == nullptr) return false;
|
177
|
-
return *a == *b;
|
178
|
-
}
|
179
|
-
|
180
|
-
template <typename T1, typename T2,
|
181
|
-
typename = std::enable_if_t<std::is_base_of<T2, T1>::value ||
|
182
|
-
std::is_base_of<T1, T2>::value>>
|
183
|
-
inline bool operator==(const Local<T1>& lhs, const JSMember<T2> rhs) {
|
184
|
-
return rhs == lhs;
|
185
|
-
}
|
186
|
-
|
187
|
-
template <typename T1, typename T2>
|
188
|
-
inline bool operator!=(const JSMember<T1>& lhs, const T2& rhs) {
|
189
|
-
return !(lhs == rhs);
|
190
|
-
}
|
191
|
-
|
192
|
-
template <typename T1, typename T2>
|
193
|
-
inline bool operator!=(const T1& lhs, const JSMember<T2>& rhs) {
|
194
|
-
return !(lhs == rhs);
|
195
|
-
}
|
196
|
-
|
197
154
|
class JSVisitor : public cppgc::Visitor {
|
198
155
|
public:
|
199
156
|
explicit JSVisitor(cppgc::Visitor::Key key) : cppgc::Visitor(key) {}
|
200
157
|
|
201
|
-
|
202
|
-
|
203
|
-
if (ref.IsEmpty()) return;
|
158
|
+
void Trace(const TracedReferenceBase& ref) {
|
159
|
+
if (ref.IsEmptyThreadSafe()) return;
|
204
160
|
Visit(ref);
|
205
161
|
}
|
206
162
|
|
207
163
|
protected:
|
208
164
|
using cppgc::Visitor::Visit;
|
209
165
|
|
210
|
-
virtual void Visit(const
|
166
|
+
virtual void Visit(const TracedReferenceBase& ref) {}
|
167
|
+
};
|
168
|
+
|
169
|
+
/**
|
170
|
+
* **DO NOT USE: Use the appropriate managed types.**
|
171
|
+
*
|
172
|
+
* Consistency helpers that aid in maintaining a consistent internal state of
|
173
|
+
* the garbage collector.
|
174
|
+
*/
|
175
|
+
class V8_EXPORT JSHeapConsistency final {
|
176
|
+
public:
|
177
|
+
using WriteBarrierParams = cppgc::internal::WriteBarrier::Params;
|
178
|
+
using WriteBarrierType = cppgc::internal::WriteBarrier::Type;
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Gets the required write barrier type for a specific write.
|
182
|
+
*
|
183
|
+
* Note: Handling for C++ to JS references.
|
184
|
+
*
|
185
|
+
* \param ref The reference being written to.
|
186
|
+
* \param params Parameters that may be used for actual write barrier calls.
|
187
|
+
* Only filled if return value indicates that a write barrier is needed. The
|
188
|
+
* contents of the `params` are an implementation detail.
|
189
|
+
* \param callback Callback returning the corresponding heap handle. The
|
190
|
+
* callback is only invoked if the heap cannot otherwise be figured out. The
|
191
|
+
* callback must not allocate.
|
192
|
+
* \returns whether a write barrier is needed and which barrier to invoke.
|
193
|
+
*/
|
194
|
+
template <typename HeapHandleCallback>
|
195
|
+
static V8_INLINE WriteBarrierType
|
196
|
+
GetWriteBarrierType(const TracedReferenceBase& ref,
|
197
|
+
WriteBarrierParams& params, HeapHandleCallback callback) {
|
198
|
+
if (ref.IsEmpty()) return WriteBarrierType::kNone;
|
199
|
+
|
200
|
+
if (V8_LIKELY(!cppgc::internal::WriteBarrier::
|
201
|
+
IsAnyIncrementalOrConcurrentMarking())) {
|
202
|
+
return cppgc::internal::WriteBarrier::Type::kNone;
|
203
|
+
}
|
204
|
+
cppgc::HeapHandle& handle = callback();
|
205
|
+
if (!cppgc::subtle::HeapState::IsMarking(handle)) {
|
206
|
+
return cppgc::internal::WriteBarrier::Type::kNone;
|
207
|
+
}
|
208
|
+
params.heap = &handle;
|
209
|
+
#if V8_ENABLE_CHECKS
|
210
|
+
params.type = cppgc::internal::WriteBarrier::Type::kMarking;
|
211
|
+
#endif // !V8_ENABLE_CHECKS
|
212
|
+
return cppgc::internal::WriteBarrier::Type::kMarking;
|
213
|
+
}
|
214
|
+
|
215
|
+
/**
|
216
|
+
* Gets the required write barrier type for a specific write.
|
217
|
+
*
|
218
|
+
* Note: Handling for JS to C++ references.
|
219
|
+
*
|
220
|
+
* \param wrapper The wrapper that has been written into.
|
221
|
+
* \param wrapper_index The wrapper index in `wrapper` that has been written
|
222
|
+
* into.
|
223
|
+
* \param wrappable The value that was written.
|
224
|
+
* \param params Parameters that may be used for actual write barrier calls.
|
225
|
+
* Only filled if return value indicates that a write barrier is needed. The
|
226
|
+
* contents of the `params` are an implementation detail.
|
227
|
+
* \param callback Callback returning the corresponding heap handle. The
|
228
|
+
* callback is only invoked if the heap cannot otherwise be figured out. The
|
229
|
+
* callback must not allocate.
|
230
|
+
* \returns whether a write barrier is needed and which barrier to invoke.
|
231
|
+
*/
|
232
|
+
template <typename HeapHandleCallback>
|
233
|
+
static V8_INLINE WriteBarrierType GetWriteBarrierType(
|
234
|
+
v8::Local<v8::Object>& wrapper, int wrapper_index, const void* wrappable,
|
235
|
+
WriteBarrierParams& params, HeapHandleCallback callback) {
|
236
|
+
#if V8_ENABLE_CHECKS
|
237
|
+
CheckWrapper(wrapper, wrapper_index, wrappable);
|
238
|
+
#endif // V8_ENABLE_CHECKS
|
239
|
+
return cppgc::internal::WriteBarrier::
|
240
|
+
GetWriteBarrierTypeForExternallyReferencedObject(wrappable, params,
|
241
|
+
callback);
|
242
|
+
}
|
243
|
+
|
244
|
+
/**
|
245
|
+
* Conservative Dijkstra-style write barrier that processes an object if it
|
246
|
+
* has not yet been processed.
|
247
|
+
*
|
248
|
+
* \param params The parameters retrieved from `GetWriteBarrierType()`.
|
249
|
+
* \param ref The reference being written to.
|
250
|
+
*/
|
251
|
+
static V8_INLINE void DijkstraMarkingBarrier(const WriteBarrierParams& params,
|
252
|
+
cppgc::HeapHandle& heap_handle,
|
253
|
+
const TracedReferenceBase& ref) {
|
254
|
+
cppgc::internal::WriteBarrier::CheckParams(WriteBarrierType::kMarking,
|
255
|
+
params);
|
256
|
+
DijkstraMarkingBarrierSlow(heap_handle, ref);
|
257
|
+
}
|
258
|
+
|
259
|
+
/**
|
260
|
+
* Conservative Dijkstra-style write barrier that processes an object if it
|
261
|
+
* has not yet been processed.
|
262
|
+
*
|
263
|
+
* \param params The parameters retrieved from `GetWriteBarrierType()`.
|
264
|
+
* \param object The pointer to the object. May be an interior pointer to a
|
265
|
+
* an interface of the actual object.
|
266
|
+
*/
|
267
|
+
static V8_INLINE void DijkstraMarkingBarrier(const WriteBarrierParams& params,
|
268
|
+
cppgc::HeapHandle& heap_handle,
|
269
|
+
const void* object) {
|
270
|
+
cppgc::internal::WriteBarrier::DijkstraMarkingBarrier(params, object);
|
271
|
+
}
|
272
|
+
|
273
|
+
/**
|
274
|
+
* Generational barrier for maintaining consistency when running with multiple
|
275
|
+
* generations.
|
276
|
+
*
|
277
|
+
* \param params The parameters retrieved from `GetWriteBarrierType()`.
|
278
|
+
* \param ref The reference being written to.
|
279
|
+
*/
|
280
|
+
static V8_INLINE void GenerationalBarrier(const WriteBarrierParams& params,
|
281
|
+
const TracedReferenceBase& ref) {}
|
282
|
+
|
283
|
+
private:
|
284
|
+
JSHeapConsistency() = delete;
|
285
|
+
|
286
|
+
static void CheckWrapper(v8::Local<v8::Object>&, int, const void*);
|
287
|
+
|
288
|
+
static void DijkstraMarkingBarrierSlow(cppgc::HeapHandle&,
|
289
|
+
const TracedReferenceBase& ref);
|
290
|
+
};
|
291
|
+
|
292
|
+
/**
|
293
|
+
* Provided as input to `CppHeap::CollectCustomSpaceStatisticsAtLastGC()`.
|
294
|
+
*
|
295
|
+
* Its method is invoked with the results of the statistic collection.
|
296
|
+
*/
|
297
|
+
class CustomSpaceStatisticsReceiver {
|
298
|
+
public:
|
299
|
+
virtual ~CustomSpaceStatisticsReceiver() = default;
|
300
|
+
/**
|
301
|
+
* Reports the size of a space at the last GC. It is called for each space
|
302
|
+
* that was requested in `CollectCustomSpaceStatisticsAtLastGC()`.
|
303
|
+
*
|
304
|
+
* \param space_index The index of the space.
|
305
|
+
* \param bytes The total size of live objects in the space at the last GC.
|
306
|
+
* It is zero if there was no GC yet.
|
307
|
+
*/
|
308
|
+
virtual void AllocatedBytes(cppgc::CustomSpaceIndex space_index,
|
309
|
+
size_t bytes) = 0;
|
211
310
|
};
|
212
311
|
|
213
312
|
} // namespace v8
|
@@ -215,8 +314,8 @@ class JSVisitor : public cppgc::Visitor {
|
|
215
314
|
namespace cppgc {
|
216
315
|
|
217
316
|
template <typename T>
|
218
|
-
struct TraceTrait<v8::
|
219
|
-
static void Trace(Visitor* visitor, const v8::
|
317
|
+
struct TraceTrait<v8::TracedReference<T>> {
|
318
|
+
static void Trace(Visitor* visitor, const v8::TracedReference<T>* self) {
|
220
319
|
static_cast<v8::JSVisitor*>(visitor)->Trace(*self);
|
221
320
|
}
|
222
321
|
};
|