libv8-node 22.7.0.4-x86_64-linux → 24.1.0.0-x86_64-linux
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/include/cppgc/allocation.h +11 -13
- data/vendor/v8/include/cppgc/default-platform.h +3 -2
- data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
- data/vendor/v8/include/cppgc/heap-consistency.h +1 -1
- data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +2 -14
- data/vendor/v8/include/cppgc/internal/base-page-handle.h +2 -4
- data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +0 -4
- data/vendor/v8/include/cppgc/internal/caged-heap.h +0 -4
- data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
- data/vendor/v8/include/cppgc/internal/conditional-stack-allocated.h +41 -0
- data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
- data/vendor/v8/include/cppgc/internal/logging.h +3 -3
- data/vendor/v8/include/cppgc/internal/member-storage.h +69 -20
- data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
- data/vendor/v8/include/cppgc/internal/persistent-node.h +8 -3
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +48 -11
- data/vendor/v8/include/cppgc/macros.h +21 -0
- data/vendor/v8/include/cppgc/member.h +70 -36
- data/vendor/v8/include/cppgc/name-provider.h +10 -0
- data/vendor/v8/include/cppgc/platform.h +11 -0
- data/vendor/v8/include/cppgc/type-traits.h +1 -0
- data/vendor/v8/include/cppgc/visitor.h +25 -1
- data/vendor/v8/include/libplatform/libplatform-export.h +2 -2
- data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
- data/vendor/v8/include/v8-array-buffer.h +143 -46
- data/vendor/v8/include/v8-callbacks.h +94 -31
- data/vendor/v8/include/v8-context.h +48 -15
- data/vendor/v8/include/v8-cppgc.h +5 -56
- data/vendor/v8/include/v8-data.h +5 -0
- data/vendor/v8/include/v8-date.h +9 -0
- data/vendor/v8/include/v8-debug.h +11 -0
- data/vendor/v8/include/v8-embedder-heap.h +1 -29
- data/vendor/v8/include/v8-exception.h +72 -0
- data/vendor/v8/include/v8-external-memory-accounter.h +60 -0
- data/vendor/v8/include/v8-fast-api-calls.h +41 -206
- data/vendor/v8/include/v8-function-callback.h +190 -78
- data/vendor/v8/include/v8-function.h +11 -3
- data/vendor/v8/include/v8-handle-base.h +20 -2
- data/vendor/v8/include/v8-initialization.h +26 -1
- data/vendor/v8/include/v8-inspector.h +10 -3
- data/vendor/v8/include/v8-internal.h +638 -315
- data/vendor/v8/include/v8-isolate.h +275 -189
- data/vendor/v8/include/v8-local-handle.h +69 -42
- data/vendor/v8/include/v8-maybe.h +2 -1
- data/vendor/v8/include/v8-memory-span.h +149 -24
- data/vendor/v8/include/v8-message.h +9 -22
- data/vendor/v8/include/v8-metrics.h +14 -0
- data/vendor/v8/include/v8-microtask-queue.h +0 -5
- data/vendor/v8/include/v8-object.h +291 -37
- data/vendor/v8/include/v8-persistent-handle.h +17 -36
- data/vendor/v8/include/v8-platform.h +66 -45
- data/vendor/v8/include/v8-primitive.h +221 -5
- data/vendor/v8/include/v8-profiler.h +51 -2
- data/vendor/v8/include/v8-promise.h +2 -2
- data/vendor/v8/include/v8-proxy.h +0 -1
- data/vendor/v8/include/v8-regexp.h +0 -1
- data/vendor/v8/include/v8-sandbox.h +173 -0
- data/vendor/v8/include/v8-script.h +65 -17
- data/vendor/v8/include/v8-snapshot.h +38 -2
- data/vendor/v8/include/v8-source-location.h +6 -1
- data/vendor/v8/include/v8-template.h +111 -263
- data/vendor/v8/include/v8-trace-categories.h +23 -0
- data/vendor/v8/include/v8-traced-handle.h +20 -32
- data/vendor/v8/include/v8-typed-array.h +6 -10
- data/vendor/v8/include/v8-unwinder-state.h +2 -3
- data/vendor/v8/include/v8-unwinder.h +2 -1
- data/vendor/v8/include/v8-util.h +1 -117
- data/vendor/v8/include/v8-value-serializer-version.h +3 -3
- data/vendor/v8/include/v8-value.h +21 -2
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +27 -0
- data/vendor/v8/include/v8-weak-callback-info.h +20 -12
- data/vendor/v8/include/v8.h +3 -3
- data/vendor/v8/include/v8config.h +83 -45
- data/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a +0 -0
- metadata +6 -3
- data/vendor/v8/include/cppgc/ephemeron-pair.h +0 -30
@@ -11,10 +11,18 @@
|
|
11
11
|
|
12
12
|
namespace cppgc {
|
13
13
|
|
14
|
+
#define CPPGC_DISALLOW_NEW() \
|
15
|
+
public: \
|
16
|
+
using IsDisallowNewMarker CPPGC_UNUSED = int; \
|
17
|
+
void* operator new(size_t, void* location) { return location; } \
|
18
|
+
void* operator new(size_t) = delete; \
|
19
|
+
static_assert(true, "Force semicolon.")
|
20
|
+
|
14
21
|
// Use CPPGC_STACK_ALLOCATED if the object is only stack allocated.
|
15
22
|
// Add the CPPGC_STACK_ALLOCATED_IGNORE annotation on a case-by-case basis when
|
16
23
|
// enforcement of CPPGC_STACK_ALLOCATED should be suppressed.
|
17
24
|
#if defined(__clang__)
|
25
|
+
|
18
26
|
#define CPPGC_STACK_ALLOCATED() \
|
19
27
|
public: \
|
20
28
|
using IsStackAllocatedTypeMarker CPPGC_UNUSED = int; \
|
@@ -23,13 +31,26 @@ namespace cppgc {
|
|
23
31
|
void* operator new(size_t) = delete; \
|
24
32
|
void* operator new(size_t, void*) = delete; \
|
25
33
|
static_assert(true, "Force semicolon.")
|
34
|
+
|
26
35
|
#define CPPGC_STACK_ALLOCATED_IGNORE(bug_or_reason) \
|
27
36
|
__attribute__((annotate("stack_allocated_ignore")))
|
37
|
+
|
38
|
+
#define CPPGC_PLUGIN_IGNORE(bug_or_reason) \
|
39
|
+
__attribute__((annotate("blink_gc_plugin_ignore"), \
|
40
|
+
annotate("stack_allocated_ignore")))
|
41
|
+
|
28
42
|
#else // !defined(__clang__)
|
43
|
+
|
29
44
|
#define CPPGC_STACK_ALLOCATED() static_assert(true, "Force semicolon.")
|
30
45
|
#define CPPGC_STACK_ALLOCATED_IGNORE(bug_or_reason)
|
46
|
+
#define CPPGC_PLUGIN_IGNORE(bug_or_reason)
|
47
|
+
|
31
48
|
#endif // !defined(__clang__)
|
32
49
|
|
50
|
+
template <typename T>
|
51
|
+
concept IsStackAllocatedType =
|
52
|
+
requires { typename T::IsStackAllocatedTypeMarker; };
|
53
|
+
|
33
54
|
} // namespace cppgc
|
34
55
|
|
35
56
|
#endif // INCLUDE_CPPGC_MACROS_H_
|
@@ -38,9 +38,8 @@ class V8_TRIVIAL_ABI MemberBase {
|
|
38
38
|
|
39
39
|
V8_INLINE MemberBase() = default;
|
40
40
|
V8_INLINE explicit MemberBase(const void* value) : raw_(value) {}
|
41
|
-
V8_INLINE MemberBase(const void* value, AtomicInitializerTag)
|
42
|
-
|
43
|
-
}
|
41
|
+
V8_INLINE MemberBase(const void* value, AtomicInitializerTag)
|
42
|
+
: raw_(value, typename RawStorage::AtomicInitializerTag{}) {}
|
44
43
|
|
45
44
|
V8_INLINE explicit MemberBase(RawStorage raw) : raw_(raw) {}
|
46
45
|
V8_INLINE explicit MemberBase(std::nullptr_t) : raw_(nullptr) {}
|
@@ -87,7 +86,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
87
86
|
V8_INLINE BasicMember(SentinelPointer s) : Base(s) {} // NOLINT
|
88
87
|
V8_INLINE BasicMember(T* raw) : Base(raw) { // NOLINT
|
89
88
|
InitializingWriteBarrier(raw);
|
90
|
-
|
89
|
+
CheckPointer(raw);
|
91
90
|
}
|
92
91
|
V8_INLINE BasicMember(T& raw) // NOLINT
|
93
92
|
: BasicMember(&raw) {}
|
@@ -103,7 +102,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
103
102
|
V8_INLINE BasicMember(T* raw, AtomicInitializerTag atomic)
|
104
103
|
: Base(raw, atomic) {
|
105
104
|
InitializingWriteBarrier(raw);
|
106
|
-
|
105
|
+
CheckPointer(raw);
|
107
106
|
}
|
108
107
|
V8_INLINE BasicMember(T& raw, AtomicInitializerTag atomic)
|
109
108
|
: BasicMember(&raw, atomic) {}
|
@@ -117,7 +116,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
117
116
|
// need to be adjusted.
|
118
117
|
template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
|
119
118
|
typename OtherCheckingPolicy,
|
120
|
-
std::enable_if_t<
|
119
|
+
std::enable_if_t<IsDecayedSameV<T, U>>* = nullptr>
|
121
120
|
V8_INLINE BasicMember( // NOLINT
|
122
121
|
const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
123
122
|
OtherCheckingPolicy, StorageType>& other)
|
@@ -125,7 +124,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
125
124
|
|
126
125
|
template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
|
127
126
|
typename OtherCheckingPolicy,
|
128
|
-
std::enable_if_t<
|
127
|
+
std::enable_if_t<IsStrictlyBaseOfV<T, U>>* = nullptr>
|
129
128
|
V8_INLINE BasicMember( // NOLINT
|
130
129
|
const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
131
130
|
OtherCheckingPolicy, StorageType>& other)
|
@@ -142,7 +141,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
142
141
|
// need to be adjusted.
|
143
142
|
template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
|
144
143
|
typename OtherCheckingPolicy,
|
145
|
-
std::enable_if_t<
|
144
|
+
std::enable_if_t<IsDecayedSameV<T, U>>* = nullptr>
|
146
145
|
V8_INLINE BasicMember(
|
147
146
|
BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy,
|
148
147
|
StorageType>&& other) noexcept
|
@@ -152,7 +151,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
152
151
|
|
153
152
|
template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
|
154
153
|
typename OtherCheckingPolicy,
|
155
|
-
std::enable_if_t<
|
154
|
+
std::enable_if_t<IsStrictlyBaseOfV<T, U>>* = nullptr>
|
156
155
|
V8_INLINE BasicMember(
|
157
156
|
BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy,
|
158
157
|
StorageType>&& other) noexcept
|
@@ -183,10 +182,10 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
183
182
|
V8_INLINE BasicMember& operator=(
|
184
183
|
const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
185
184
|
OtherCheckingPolicy, StorageType>& other) {
|
186
|
-
if constexpr (
|
185
|
+
if constexpr (IsDecayedSameV<T, U>) {
|
187
186
|
return operator=(other.GetRawStorage());
|
188
187
|
} else {
|
189
|
-
static_assert(
|
188
|
+
static_assert(IsStrictlyBaseOfV<T, U>);
|
190
189
|
return operator=(other.Get());
|
191
190
|
}
|
192
191
|
}
|
@@ -206,10 +205,10 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
206
205
|
V8_INLINE BasicMember& operator=(
|
207
206
|
BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy,
|
208
207
|
StorageType>&& other) noexcept {
|
209
|
-
if constexpr (
|
208
|
+
if constexpr (IsDecayedSameV<T, U>) {
|
210
209
|
operator=(other.GetRawStorage());
|
211
210
|
} else {
|
212
|
-
static_assert(
|
211
|
+
static_assert(IsStrictlyBaseOfV<T, U>);
|
213
212
|
operator=(other.Get());
|
214
213
|
}
|
215
214
|
other.Clear();
|
@@ -231,7 +230,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
231
230
|
V8_INLINE BasicMember& operator=(T* other) {
|
232
231
|
Base::SetRawAtomic(other);
|
233
232
|
AssigningWriteBarrier(other);
|
234
|
-
|
233
|
+
CheckPointer(other);
|
235
234
|
return *this;
|
236
235
|
}
|
237
236
|
|
@@ -270,9 +269,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
270
269
|
return static_cast<T*>(const_cast<void*>(Base::GetRaw()));
|
271
270
|
}
|
272
271
|
|
273
|
-
V8_INLINE void Clear() {
|
274
|
-
Base::SetRawStorageAtomic(RawStorage{});
|
275
|
-
}
|
272
|
+
V8_INLINE void Clear() { Base::SetRawStorageAtomic(RawStorage{}); }
|
276
273
|
|
277
274
|
V8_INLINE T* Release() {
|
278
275
|
T* result = Get();
|
@@ -284,20 +281,18 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
284
281
|
return reinterpret_cast<const T**>(Base::GetRawSlot());
|
285
282
|
}
|
286
283
|
|
287
|
-
V8_INLINE RawStorage GetRawStorage() const {
|
288
|
-
return Base::GetRawStorage();
|
289
|
-
}
|
284
|
+
V8_INLINE RawStorage GetRawStorage() const { return Base::GetRawStorage(); }
|
290
285
|
|
291
286
|
private:
|
292
287
|
V8_INLINE explicit BasicMember(RawStorage raw) : Base(raw) {
|
293
|
-
InitializingWriteBarrier(
|
294
|
-
|
288
|
+
InitializingWriteBarrier();
|
289
|
+
CheckPointer();
|
295
290
|
}
|
296
291
|
|
297
292
|
V8_INLINE BasicMember& operator=(RawStorage other) {
|
298
293
|
Base::SetRawStorageAtomic(other);
|
299
294
|
AssigningWriteBarrier();
|
300
|
-
|
295
|
+
CheckPointer();
|
301
296
|
return *this;
|
302
297
|
}
|
303
298
|
|
@@ -308,6 +303,10 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
308
303
|
V8_INLINE void InitializingWriteBarrier(T* value) const {
|
309
304
|
WriteBarrierPolicy::InitializingBarrier(Base::GetRawSlot(), value);
|
310
305
|
}
|
306
|
+
V8_INLINE void InitializingWriteBarrier() const {
|
307
|
+
WriteBarrierPolicy::InitializingBarrier(Base::GetRawSlot(),
|
308
|
+
Base::GetRawStorage());
|
309
|
+
}
|
311
310
|
V8_INLINE void AssigningWriteBarrier(T* value) const {
|
312
311
|
WriteBarrierPolicy::template AssigningBarrier<
|
313
312
|
StorageType::kWriteBarrierSlotType>(Base::GetRawSlot(), value);
|
@@ -317,6 +316,12 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
|
317
316
|
StorageType::kWriteBarrierSlotType>(Base::GetRawSlot(),
|
318
317
|
Base::GetRawStorage());
|
319
318
|
}
|
319
|
+
V8_INLINE void CheckPointer(T* value) {
|
320
|
+
CheckingPolicy::template CheckPointer<T>(value);
|
321
|
+
}
|
322
|
+
V8_INLINE void CheckPointer() {
|
323
|
+
CheckingPolicy::template CheckPointer<T>(Base::GetRawStorage());
|
324
|
+
}
|
320
325
|
|
321
326
|
V8_INLINE void ClearFromGC() const { Base::ClearFromGC(); }
|
322
327
|
|
@@ -341,12 +346,11 @@ V8_INLINE bool operator==(
|
|
341
346
|
StorageType>& member1,
|
342
347
|
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
343
348
|
StorageType>& member2) {
|
344
|
-
if constexpr (
|
349
|
+
if constexpr (IsDecayedSameV<T1, T2>) {
|
345
350
|
// Check compressed pointers if types are the same.
|
346
351
|
return member1.GetRawStorage() == member2.GetRawStorage();
|
347
352
|
} else {
|
348
|
-
static_assert(
|
349
|
-
internal::IsStrictlyBaseOfV<T2, T1>);
|
353
|
+
static_assert(IsStrictlyBaseOfV<T1, T2> || IsStrictlyBaseOfV<T2, T1>);
|
350
354
|
// Otherwise, check decompressed pointers.
|
351
355
|
return member1.Get() == member2.Get();
|
352
356
|
}
|
@@ -372,12 +376,12 @@ V8_INLINE bool operator==(
|
|
372
376
|
StorageType>& member,
|
373
377
|
U* raw) {
|
374
378
|
// Never allow comparison with erased pointers.
|
375
|
-
static_assert(!
|
379
|
+
static_assert(!IsDecayedSameV<void, U>);
|
376
380
|
|
377
|
-
if constexpr (
|
381
|
+
if constexpr (IsDecayedSameV<T, U>) {
|
378
382
|
// Check compressed pointers if types are the same.
|
379
383
|
return member.GetRawStorage() == StorageType(raw);
|
380
|
-
} else if constexpr (
|
384
|
+
} else if constexpr (IsStrictlyBaseOfV<T, U>) {
|
381
385
|
// Cast the raw pointer to T, which may adjust the pointer.
|
382
386
|
return member.GetRawStorage() == StorageType(static_cast<T*>(raw));
|
383
387
|
} else {
|
@@ -494,7 +498,7 @@ V8_INLINE bool operator<(
|
|
494
498
|
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
495
499
|
StorageType>& member2) {
|
496
500
|
static_assert(
|
497
|
-
|
501
|
+
IsDecayedSameV<T1, T2>,
|
498
502
|
"Comparison works only for same pointer type modulo cv-qualifiers");
|
499
503
|
return member1.GetRawStorage() < member2.GetRawStorage();
|
500
504
|
}
|
@@ -509,7 +513,7 @@ V8_INLINE bool operator<=(
|
|
509
513
|
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
510
514
|
StorageType>& member2) {
|
511
515
|
static_assert(
|
512
|
-
|
516
|
+
IsDecayedSameV<T1, T2>,
|
513
517
|
"Comparison works only for same pointer type modulo cv-qualifiers");
|
514
518
|
return member1.GetRawStorage() <= member2.GetRawStorage();
|
515
519
|
}
|
@@ -524,7 +528,7 @@ V8_INLINE bool operator>(
|
|
524
528
|
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
525
529
|
StorageType>& member2) {
|
526
530
|
static_assert(
|
527
|
-
|
531
|
+
IsDecayedSameV<T1, T2>,
|
528
532
|
"Comparison works only for same pointer type modulo cv-qualifiers");
|
529
533
|
return member1.GetRawStorage() > member2.GetRawStorage();
|
530
534
|
}
|
@@ -539,16 +543,15 @@ V8_INLINE bool operator>=(
|
|
539
543
|
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
540
544
|
StorageType>& member2) {
|
541
545
|
static_assert(
|
542
|
-
|
546
|
+
IsDecayedSameV<T1, T2>,
|
543
547
|
"Comparison works only for same pointer type modulo cv-qualifiers");
|
544
548
|
return member1.GetRawStorage() >= member2.GetRawStorage();
|
545
549
|
}
|
546
550
|
|
547
551
|
template <typename T, typename WriteBarrierPolicy, typename CheckingPolicy,
|
548
552
|
typename StorageType>
|
549
|
-
struct IsWeak<
|
550
|
-
|
551
|
-
: std::true_type {};
|
553
|
+
struct IsWeak<BasicMember<T, WeakMemberTag, WriteBarrierPolicy, CheckingPolicy,
|
554
|
+
StorageType>> : std::true_type {};
|
552
555
|
|
553
556
|
} // namespace internal
|
554
557
|
|
@@ -626,4 +629,35 @@ static constexpr size_t kSizeofCompressedMember =
|
|
626
629
|
|
627
630
|
} // namespace cppgc
|
628
631
|
|
632
|
+
// Mark `BasicMember<T>` and `T*` as having a common reference type of `T*` (the
|
633
|
+
// type to which both can be converted or bound). This makes them satisfy
|
634
|
+
// `std::equality_comparable`, which allows usage like the following:
|
635
|
+
// ```
|
636
|
+
// HeapVector<Member<T>> v;
|
637
|
+
// T* e;
|
638
|
+
// auto it = std::ranges::find(v, e);
|
639
|
+
// ```
|
640
|
+
// Without this, the `find()` call above would fail to compile with an error
|
641
|
+
// about being unable to invoke `std::ranges::equal_to()`.
|
642
|
+
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
643
|
+
typename CheckingPolicy, typename StorageType,
|
644
|
+
template <typename> typename TQ, template <typename> typename UQ>
|
645
|
+
struct std::basic_common_reference<
|
646
|
+
cppgc::internal::BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
647
|
+
CheckingPolicy, StorageType>,
|
648
|
+
T*, TQ, UQ> {
|
649
|
+
using type = T*;
|
650
|
+
};
|
651
|
+
|
652
|
+
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
653
|
+
typename CheckingPolicy, typename StorageType,
|
654
|
+
template <typename> typename TQ, template <typename> typename UQ>
|
655
|
+
struct std::basic_common_reference<
|
656
|
+
T*,
|
657
|
+
cppgc::internal::BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
658
|
+
CheckingPolicy, StorageType>,
|
659
|
+
TQ, UQ> {
|
660
|
+
using type = T*;
|
661
|
+
};
|
662
|
+
|
629
663
|
#endif // INCLUDE_CPPGC_MEMBER_H_
|
@@ -55,6 +55,16 @@ class V8_EXPORT NameProvider {
|
|
55
55
|
* Specifies a name for the garbage-collected object. Such names will never
|
56
56
|
* be hidden, as they are explicitly specified by the user of this API.
|
57
57
|
*
|
58
|
+
* Implementations of this function must not allocate garbage-collected
|
59
|
+
* objects or otherwise modify the cppgc heap.
|
60
|
+
*
|
61
|
+
* V8 may call this function while generating a heap snapshot or at other
|
62
|
+
* times. If V8 is currently generating a heap snapshot (according to
|
63
|
+
* HeapProfiler::IsTakingSnapshot), then the returned string must stay alive
|
64
|
+
* until the snapshot generation has completed. Otherwise, the returned string
|
65
|
+
* must stay alive forever. If you need a place to store a temporary string
|
66
|
+
* during snapshot generation, use HeapProfiler::CopyNameForHeapSnapshot.
|
67
|
+
*
|
58
68
|
* @returns a human readable name for the object.
|
59
69
|
*/
|
60
70
|
virtual const char* GetHumanReadableName() const = 0;
|
@@ -52,6 +52,15 @@ class V8_EXPORT Platform {
|
|
52
52
|
* Foreground task runner that should be used by a Heap.
|
53
53
|
*/
|
54
54
|
virtual std::shared_ptr<TaskRunner> GetForegroundTaskRunner() {
|
55
|
+
return GetForegroundTaskRunner(TaskPriority::kUserBlocking);
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Returns a TaskRunner with a specific |priority| which can be used to post a
|
60
|
+
* task on the foreground thread.
|
61
|
+
*/
|
62
|
+
virtual std::shared_ptr<TaskRunner> GetForegroundTaskRunner(
|
63
|
+
TaskPriority priority) {
|
55
64
|
return nullptr;
|
56
65
|
}
|
57
66
|
|
@@ -127,6 +136,8 @@ class V8_EXPORT Platform {
|
|
127
136
|
virtual TracingController* GetTracingController();
|
128
137
|
};
|
129
138
|
|
139
|
+
V8_EXPORT bool IsInitialized();
|
140
|
+
|
130
141
|
/**
|
131
142
|
* Process-global initialization of the garbage collector. Must be called before
|
132
143
|
* creating a Heap.
|
@@ -8,12 +8,12 @@
|
|
8
8
|
#include <type_traits>
|
9
9
|
|
10
10
|
#include "cppgc/custom-space.h"
|
11
|
-
#include "cppgc/ephemeron-pair.h"
|
12
11
|
#include "cppgc/garbage-collected.h"
|
13
12
|
#include "cppgc/internal/logging.h"
|
14
13
|
#include "cppgc/internal/member-storage.h"
|
15
14
|
#include "cppgc/internal/pointer-policies.h"
|
16
15
|
#include "cppgc/liveness-broker.h"
|
16
|
+
#include "cppgc/macros.h"
|
17
17
|
#include "cppgc/member.h"
|
18
18
|
#include "cppgc/sentinel-pointer.h"
|
19
19
|
#include "cppgc/source-location.h"
|
@@ -36,6 +36,25 @@ class VisitorFactory;
|
|
36
36
|
|
37
37
|
using WeakCallback = void (*)(const LivenessBroker&, const void*);
|
38
38
|
|
39
|
+
/**
|
40
|
+
* An ephemeron pair is used to conditionally retain an object.
|
41
|
+
* The `value` will be kept alive only if the `key` is alive.
|
42
|
+
*/
|
43
|
+
template <typename K, typename V>
|
44
|
+
struct EphemeronPair {
|
45
|
+
CPPGC_DISALLOW_NEW();
|
46
|
+
|
47
|
+
EphemeronPair(K* k, V* v) : key(k), value(v) {}
|
48
|
+
WeakMember<K> key;
|
49
|
+
Member<V> value;
|
50
|
+
|
51
|
+
void ClearValueIfKeyIsDead(const LivenessBroker& broker) {
|
52
|
+
if (!broker.IsHeapObjectAlive(key)) value = nullptr;
|
53
|
+
}
|
54
|
+
|
55
|
+
void Trace(Visitor* visitor) const;
|
56
|
+
};
|
57
|
+
|
39
58
|
/**
|
40
59
|
* Visitor passed to trace methods. All managed pointers must have called the
|
41
60
|
* Visitor's trace method on them.
|
@@ -436,6 +455,11 @@ class V8_EXPORT Visitor {
|
|
436
455
|
friend class internal::VisitorBase;
|
437
456
|
};
|
438
457
|
|
458
|
+
template <typename K, typename V>
|
459
|
+
void EphemeronPair<K, V>::Trace(Visitor* visitor) const {
|
460
|
+
visitor->TraceEphemeron(key, value);
|
461
|
+
}
|
462
|
+
|
439
463
|
namespace internal {
|
440
464
|
|
441
465
|
class V8_EXPORT RootVisitor {
|
@@ -18,11 +18,11 @@
|
|
18
18
|
#else // defined(_WIN32)
|
19
19
|
|
20
20
|
// Setup for Linux shared library export.
|
21
|
-
#
|
21
|
+
#if defined(BUILDING_V8_PLATFORM_SHARED) || USING_V8_PLATFORM_SHARED
|
22
22
|
#define V8_PLATFORM_EXPORT __attribute__((visibility("default")))
|
23
23
|
#else
|
24
24
|
#define V8_PLATFORM_EXPORT
|
25
|
-
#endif
|
25
|
+
#endif // defined(BUILDING_V8_PLATFORM_SHARED) || ...
|
26
26
|
|
27
27
|
#endif // defined(_WIN32)
|
28
28
|
|