libv8-node 19.9.0.0-x86_64-darwin → 20.12.1.0-x86_64-darwin
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/libv8/node/version.rb +3 -3
- data/vendor/v8/include/cppgc/cross-thread-persistent.h +4 -2
- data/vendor/v8/include/cppgc/heap-consistency.h +2 -2
- data/vendor/v8/include/cppgc/heap-handle.h +5 -0
- data/vendor/v8/include/cppgc/internal/api-constants.h +4 -1
- data/vendor/v8/include/cppgc/internal/gc-info.h +35 -33
- data/vendor/v8/include/cppgc/internal/member-storage.h +19 -7
- data/vendor/v8/include/cppgc/internal/pointer-policies.h +38 -2
- data/vendor/v8/include/cppgc/internal/write-barrier.h +15 -5
- data/vendor/v8/include/cppgc/macros.h +10 -1
- data/vendor/v8/include/cppgc/member.h +167 -129
- data/vendor/v8/include/cppgc/persistent.h +22 -15
- data/vendor/v8/include/cppgc/platform.h +6 -4
- data/vendor/v8/include/cppgc/type-traits.h +4 -3
- data/vendor/v8/include/cppgc/visitor.h +16 -1
- data/vendor/v8/include/libplatform/v8-tracing.h +2 -2
- data/vendor/v8/include/v8-array-buffer.h +59 -0
- data/vendor/v8/include/v8-callbacks.h +14 -1
- data/vendor/v8/include/v8-context.h +50 -3
- data/vendor/v8/include/v8-cppgc.h +15 -0
- data/vendor/v8/include/v8-data.h +1 -1
- data/vendor/v8/include/v8-embedder-heap.h +0 -169
- data/vendor/v8/include/v8-fast-api-calls.h +7 -3
- data/vendor/v8/include/v8-function-callback.h +69 -42
- data/vendor/v8/include/v8-function.h +1 -0
- data/vendor/v8/include/v8-inspector.h +20 -5
- data/vendor/v8/include/v8-internal.h +242 -150
- data/vendor/v8/include/v8-isolate.h +30 -40
- data/vendor/v8/include/v8-local-handle.h +81 -48
- data/vendor/v8/include/v8-metrics.h +28 -2
- data/vendor/v8/include/v8-microtask-queue.h +5 -0
- data/vendor/v8/include/v8-object.h +38 -3
- data/vendor/v8/include/v8-persistent-handle.h +25 -16
- data/vendor/v8/include/v8-platform.h +79 -10
- data/vendor/v8/include/v8-primitive.h +19 -12
- data/vendor/v8/include/v8-profiler.h +59 -31
- data/vendor/v8/include/v8-script.h +32 -5
- data/vendor/v8/include/v8-snapshot.h +4 -8
- data/vendor/v8/include/v8-template.h +3 -1
- data/vendor/v8/include/v8-traced-handle.h +22 -28
- data/vendor/v8/include/v8-util.h +9 -3
- data/vendor/v8/include/v8-value.h +31 -4
- data/vendor/v8/include/v8-version.h +4 -4
- data/vendor/v8/include/v8-wasm.h +2 -1
- data/vendor/v8/include/v8config.h +73 -2
- data/vendor/v8/x86_64-darwin/libv8/obj/libv8_monolith.a +0 -0
- metadata +3 -3
@@ -28,13 +28,11 @@ namespace internal {
|
|
28
28
|
|
29
29
|
// MemberBase always refers to the object as const object and defers to
|
30
30
|
// BasicMember on casting to the right type as needed.
|
31
|
+
template <typename StorageType>
|
31
32
|
class V8_TRIVIAL_ABI MemberBase {
|
32
33
|
public:
|
33
|
-
|
34
|
-
|
35
|
-
#else // !defined(CPPGC_POINTER_COMPRESSION)
|
36
|
-
using RawStorage = RawPointer;
|
37
|
-
#endif // !defined(CPPGC_POINTER_COMPRESSION)
|
34
|
+
using RawStorage = StorageType;
|
35
|
+
|
38
36
|
protected:
|
39
37
|
struct AtomicInitializerTag {};
|
40
38
|
|
@@ -75,16 +73,19 @@ class V8_TRIVIAL_ABI MemberBase {
|
|
75
73
|
|
76
74
|
// The basic class from which all Member classes are 'generated'.
|
77
75
|
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
78
|
-
typename CheckingPolicy>
|
79
|
-
class V8_TRIVIAL_ABI BasicMember final : private MemberBase
|
76
|
+
typename CheckingPolicy, typename StorageType>
|
77
|
+
class V8_TRIVIAL_ABI BasicMember final : private MemberBase<StorageType>,
|
80
78
|
private CheckingPolicy {
|
79
|
+
using Base = MemberBase<StorageType>;
|
80
|
+
|
81
81
|
public:
|
82
82
|
using PointeeType = T;
|
83
|
+
using RawStorage = typename Base::RawStorage;
|
83
84
|
|
84
85
|
V8_INLINE constexpr BasicMember() = default;
|
85
|
-
V8_INLINE constexpr BasicMember(std::nullptr_t) {}
|
86
|
-
V8_INLINE BasicMember(SentinelPointer s) :
|
87
|
-
V8_INLINE BasicMember(T* raw) :
|
86
|
+
V8_INLINE constexpr BasicMember(std::nullptr_t) {} // NOLINT
|
87
|
+
V8_INLINE BasicMember(SentinelPointer s) : Base(s) {} // NOLINT
|
88
|
+
V8_INLINE BasicMember(T* raw) : Base(raw) { // NOLINT
|
88
89
|
InitializingWriteBarrier(raw);
|
89
90
|
this->CheckPointer(Get());
|
90
91
|
}
|
@@ -94,13 +95,13 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
94
95
|
// Atomic ctor. Using the AtomicInitializerTag forces BasicMember to
|
95
96
|
// initialize using atomic assignments. This is required for preventing
|
96
97
|
// data races with concurrent marking.
|
97
|
-
using AtomicInitializerTag =
|
98
|
+
using AtomicInitializerTag = typename Base::AtomicInitializerTag;
|
98
99
|
V8_INLINE BasicMember(std::nullptr_t, AtomicInitializerTag atomic)
|
99
|
-
:
|
100
|
+
: Base(nullptr, atomic) {}
|
100
101
|
V8_INLINE BasicMember(SentinelPointer s, AtomicInitializerTag atomic)
|
101
|
-
:
|
102
|
+
: Base(s, atomic) {}
|
102
103
|
V8_INLINE BasicMember(T* raw, AtomicInitializerTag atomic)
|
103
|
-
:
|
104
|
+
: Base(raw, atomic) {
|
104
105
|
InitializingWriteBarrier(raw);
|
105
106
|
this->CheckPointer(Get());
|
106
107
|
}
|
@@ -119,7 +120,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
119
120
|
std::enable_if_t<internal::IsDecayedSameV<T, U>>* = nullptr>
|
120
121
|
V8_INLINE BasicMember( // NOLINT
|
121
122
|
const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
122
|
-
OtherCheckingPolicy>& other)
|
123
|
+
OtherCheckingPolicy, StorageType>& other)
|
123
124
|
: BasicMember(other.GetRawStorage()) {}
|
124
125
|
|
125
126
|
template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
|
@@ -127,7 +128,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
127
128
|
std::enable_if_t<internal::IsStrictlyBaseOfV<T, U>>* = nullptr>
|
128
129
|
V8_INLINE BasicMember( // NOLINT
|
129
130
|
const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
130
|
-
OtherCheckingPolicy>& other)
|
131
|
+
OtherCheckingPolicy, StorageType>& other)
|
131
132
|
: BasicMember(other.Get()) {}
|
132
133
|
|
133
134
|
// Move ctor.
|
@@ -142,8 +143,9 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
142
143
|
template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
|
143
144
|
typename OtherCheckingPolicy,
|
144
145
|
std::enable_if_t<internal::IsDecayedSameV<T, U>>* = nullptr>
|
145
|
-
V8_INLINE BasicMember(
|
146
|
-
|
146
|
+
V8_INLINE BasicMember(
|
147
|
+
BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy,
|
148
|
+
StorageType>&& other) noexcept
|
147
149
|
: BasicMember(other.GetRawStorage()) {
|
148
150
|
other.Clear();
|
149
151
|
}
|
@@ -151,8 +153,9 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
151
153
|
template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
|
152
154
|
typename OtherCheckingPolicy,
|
153
155
|
std::enable_if_t<internal::IsStrictlyBaseOfV<T, U>>* = nullptr>
|
154
|
-
V8_INLINE BasicMember(
|
155
|
-
|
156
|
+
V8_INLINE BasicMember(
|
157
|
+
BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy,
|
158
|
+
StorageType>&& other) noexcept
|
156
159
|
: BasicMember(other.Get()) {
|
157
160
|
other.Clear();
|
158
161
|
}
|
@@ -179,7 +182,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
179
182
|
typename OtherCheckingPolicy>
|
180
183
|
V8_INLINE BasicMember& operator=(
|
181
184
|
const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
182
|
-
OtherCheckingPolicy>& other) {
|
185
|
+
OtherCheckingPolicy, StorageType>& other) {
|
183
186
|
if constexpr (internal::IsDecayedSameV<T, U>) {
|
184
187
|
return operator=(other.GetRawStorage());
|
185
188
|
} else {
|
@@ -201,8 +204,8 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
201
204
|
template <typename U, typename OtherWeaknessTag, typename OtherBarrierPolicy,
|
202
205
|
typename OtherCheckingPolicy>
|
203
206
|
V8_INLINE BasicMember& operator=(
|
204
|
-
BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
|
205
|
-
|
207
|
+
BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy, OtherCheckingPolicy,
|
208
|
+
StorageType>&& other) noexcept {
|
206
209
|
if constexpr (internal::IsDecayedSameV<T, U>) {
|
207
210
|
operator=(other.GetRawStorage());
|
208
211
|
} else {
|
@@ -226,7 +229,7 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
226
229
|
}
|
227
230
|
|
228
231
|
V8_INLINE BasicMember& operator=(T* other) {
|
229
|
-
SetRawAtomic(other);
|
232
|
+
Base::SetRawAtomic(other);
|
230
233
|
AssigningWriteBarrier(other);
|
231
234
|
this->CheckPointer(Get());
|
232
235
|
return *this;
|
@@ -237,20 +240,20 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
237
240
|
return *this;
|
238
241
|
}
|
239
242
|
V8_INLINE BasicMember& operator=(SentinelPointer s) {
|
240
|
-
SetRawAtomic(s);
|
243
|
+
Base::SetRawAtomic(s);
|
241
244
|
return *this;
|
242
245
|
}
|
243
246
|
|
244
247
|
template <typename OtherWeaknessTag, typename OtherBarrierPolicy,
|
245
248
|
typename OtherCheckingPolicy>
|
246
249
|
V8_INLINE void Swap(BasicMember<T, OtherWeaknessTag, OtherBarrierPolicy,
|
247
|
-
OtherCheckingPolicy>& other) {
|
250
|
+
OtherCheckingPolicy, StorageType>& other) {
|
248
251
|
auto tmp = GetRawStorage();
|
249
252
|
*this = other;
|
250
253
|
other = tmp;
|
251
254
|
}
|
252
255
|
|
253
|
-
V8_INLINE explicit operator bool() const { return !IsCleared(); }
|
256
|
+
V8_INLINE explicit operator bool() const { return !Base::IsCleared(); }
|
254
257
|
V8_INLINE operator T*() const { return Get(); }
|
255
258
|
V8_INLINE T* operator->() const { return Get(); }
|
256
259
|
V8_INLINE T& operator*() const { return *Get(); }
|
@@ -264,10 +267,12 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
264
267
|
// The const_cast below removes the constness from MemberBase storage. The
|
265
268
|
// following static_cast re-adds any constness if specified through the
|
266
269
|
// user-visible template parameter T.
|
267
|
-
return static_cast<T*>(const_cast<void*>(
|
270
|
+
return static_cast<T*>(const_cast<void*>(Base::GetRaw()));
|
268
271
|
}
|
269
272
|
|
270
|
-
V8_INLINE void Clear() {
|
273
|
+
V8_INLINE void Clear() {
|
274
|
+
Base::SetRawStorageAtomic(RawStorage{});
|
275
|
+
}
|
271
276
|
|
272
277
|
V8_INLINE T* Release() {
|
273
278
|
T* result = Get();
|
@@ -276,41 +281,44 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
276
281
|
}
|
277
282
|
|
278
283
|
V8_INLINE const T** GetSlotForTesting() const {
|
279
|
-
return reinterpret_cast<const T**>(GetRawSlot());
|
284
|
+
return reinterpret_cast<const T**>(Base::GetRawSlot());
|
280
285
|
}
|
281
286
|
|
282
287
|
V8_INLINE RawStorage GetRawStorage() const {
|
283
|
-
return
|
288
|
+
return Base::GetRawStorage();
|
284
289
|
}
|
285
290
|
|
286
291
|
private:
|
287
|
-
V8_INLINE explicit BasicMember(RawStorage raw) :
|
292
|
+
V8_INLINE explicit BasicMember(RawStorage raw) : Base(raw) {
|
288
293
|
InitializingWriteBarrier(Get());
|
289
294
|
this->CheckPointer(Get());
|
290
295
|
}
|
291
296
|
|
292
297
|
V8_INLINE BasicMember& operator=(RawStorage other) {
|
293
|
-
SetRawStorageAtomic(other);
|
298
|
+
Base::SetRawStorageAtomic(other);
|
294
299
|
AssigningWriteBarrier();
|
295
300
|
this->CheckPointer(Get());
|
296
301
|
return *this;
|
297
302
|
}
|
298
303
|
|
299
304
|
V8_INLINE const T* GetRawAtomic() const {
|
300
|
-
return static_cast<const T*>(
|
305
|
+
return static_cast<const T*>(Base::GetRawAtomic());
|
301
306
|
}
|
302
307
|
|
303
308
|
V8_INLINE void InitializingWriteBarrier(T* value) const {
|
304
|
-
WriteBarrierPolicy::InitializingBarrier(GetRawSlot(), value);
|
309
|
+
WriteBarrierPolicy::InitializingBarrier(Base::GetRawSlot(), value);
|
305
310
|
}
|
306
311
|
V8_INLINE void AssigningWriteBarrier(T* value) const {
|
307
|
-
WriteBarrierPolicy::AssigningBarrier
|
312
|
+
WriteBarrierPolicy::template AssigningBarrier<
|
313
|
+
StorageType::kWriteBarrierSlotType>(Base::GetRawSlot(), value);
|
308
314
|
}
|
309
315
|
V8_INLINE void AssigningWriteBarrier() const {
|
310
|
-
WriteBarrierPolicy::AssigningBarrier
|
316
|
+
WriteBarrierPolicy::template AssigningBarrier<
|
317
|
+
StorageType::kWriteBarrierSlotType>(Base::GetRawSlot(),
|
318
|
+
Base::GetRawStorage());
|
311
319
|
}
|
312
320
|
|
313
|
-
V8_INLINE void ClearFromGC() const {
|
321
|
+
V8_INLINE void ClearFromGC() const { Base::ClearFromGC(); }
|
314
322
|
|
315
323
|
V8_INLINE T* GetFromGC() const { return Get(); }
|
316
324
|
|
@@ -319,19 +327,20 @@ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
|
|
319
327
|
template <typename U>
|
320
328
|
friend struct cppgc::TraceTrait;
|
321
329
|
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
322
|
-
typename CheckingPolicy1>
|
330
|
+
typename CheckingPolicy1, typename StorageType1>
|
323
331
|
friend class BasicMember;
|
324
332
|
};
|
325
333
|
|
326
334
|
// Member equality operators.
|
327
335
|
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
328
336
|
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
329
|
-
typename WriteBarrierPolicy2, typename CheckingPolicy2
|
337
|
+
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
338
|
+
typename StorageType>
|
330
339
|
V8_INLINE bool operator==(
|
331
|
-
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1
|
332
|
-
|
333
|
-
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2
|
334
|
-
|
340
|
+
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
341
|
+
StorageType>& member1,
|
342
|
+
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
343
|
+
StorageType>& member2) {
|
335
344
|
if constexpr (internal::IsDecayedSameV<T1, T2>) {
|
336
345
|
// Check compressed pointers if types are the same.
|
337
346
|
return member1.GetRawStorage() == member2.GetRawStorage();
|
@@ -345,31 +354,32 @@ V8_INLINE bool operator==(
|
|
345
354
|
|
346
355
|
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
347
356
|
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
348
|
-
typename WriteBarrierPolicy2, typename CheckingPolicy2
|
357
|
+
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
358
|
+
typename StorageType>
|
349
359
|
V8_INLINE bool operator!=(
|
350
|
-
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1
|
351
|
-
|
352
|
-
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2
|
353
|
-
|
360
|
+
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
361
|
+
StorageType>& member1,
|
362
|
+
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
363
|
+
StorageType>& member2) {
|
354
364
|
return !(member1 == member2);
|
355
365
|
}
|
356
366
|
|
357
367
|
// Equality with raw pointers.
|
358
368
|
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
359
|
-
typename CheckingPolicy, typename U>
|
360
|
-
V8_INLINE bool operator==(
|
361
|
-
|
362
|
-
|
369
|
+
typename CheckingPolicy, typename StorageType, typename U>
|
370
|
+
V8_INLINE bool operator==(
|
371
|
+
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
372
|
+
StorageType>& member,
|
373
|
+
U* raw) {
|
363
374
|
// Never allow comparison with erased pointers.
|
364
375
|
static_assert(!internal::IsDecayedSameV<void, U>);
|
365
376
|
|
366
377
|
if constexpr (internal::IsDecayedSameV<T, U>) {
|
367
378
|
// Check compressed pointers if types are the same.
|
368
|
-
return member.GetRawStorage() ==
|
379
|
+
return member.GetRawStorage() == StorageType(raw);
|
369
380
|
} else if constexpr (internal::IsStrictlyBaseOfV<T, U>) {
|
370
381
|
// Cast the raw pointer to T, which may adjust the pointer.
|
371
|
-
return member.GetRawStorage() ==
|
372
|
-
MemberBase::RawStorage(static_cast<T*>(raw));
|
382
|
+
return member.GetRawStorage() == StorageType(static_cast<T*>(raw));
|
373
383
|
} else {
|
374
384
|
// Otherwise, decompressed the member.
|
375
385
|
return member.Get() == raw;
|
@@ -377,104 +387,112 @@ V8_INLINE bool operator==(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
|
377
387
|
}
|
378
388
|
|
379
389
|
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
380
|
-
typename CheckingPolicy, typename U>
|
381
|
-
V8_INLINE bool operator!=(
|
382
|
-
|
383
|
-
|
390
|
+
typename CheckingPolicy, typename StorageType, typename U>
|
391
|
+
V8_INLINE bool operator!=(
|
392
|
+
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
393
|
+
StorageType>& member,
|
394
|
+
U* raw) {
|
384
395
|
return !(member == raw);
|
385
396
|
}
|
386
397
|
|
387
398
|
template <typename T, typename U, typename WeaknessTag,
|
388
|
-
typename WriteBarrierPolicy, typename CheckingPolicy
|
389
|
-
|
390
|
-
|
391
|
-
|
399
|
+
typename WriteBarrierPolicy, typename CheckingPolicy,
|
400
|
+
typename StorageType>
|
401
|
+
V8_INLINE bool operator==(
|
402
|
+
T* raw, const BasicMember<U, WeaknessTag, WriteBarrierPolicy,
|
403
|
+
CheckingPolicy, StorageType>& member) {
|
392
404
|
return member == raw;
|
393
405
|
}
|
394
406
|
|
395
407
|
template <typename T, typename U, typename WeaknessTag,
|
396
|
-
typename WriteBarrierPolicy, typename CheckingPolicy
|
397
|
-
|
398
|
-
|
399
|
-
|
408
|
+
typename WriteBarrierPolicy, typename CheckingPolicy,
|
409
|
+
typename StorageType>
|
410
|
+
V8_INLINE bool operator!=(
|
411
|
+
T* raw, const BasicMember<U, WeaknessTag, WriteBarrierPolicy,
|
412
|
+
CheckingPolicy, StorageType>& member) {
|
400
413
|
return !(raw == member);
|
401
414
|
}
|
402
415
|
|
403
416
|
// Equality with sentinel.
|
404
417
|
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
405
|
-
typename CheckingPolicy>
|
406
|
-
V8_INLINE bool operator==(
|
407
|
-
|
408
|
-
|
418
|
+
typename CheckingPolicy, typename StorageType>
|
419
|
+
V8_INLINE bool operator==(
|
420
|
+
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
421
|
+
StorageType>& member,
|
422
|
+
SentinelPointer) {
|
409
423
|
return member.GetRawStorage().IsSentinel();
|
410
424
|
}
|
411
425
|
|
412
426
|
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
413
|
-
typename CheckingPolicy>
|
414
|
-
V8_INLINE bool operator!=(
|
415
|
-
|
416
|
-
|
427
|
+
typename CheckingPolicy, typename StorageType>
|
428
|
+
V8_INLINE bool operator!=(
|
429
|
+
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
430
|
+
StorageType>& member,
|
431
|
+
SentinelPointer s) {
|
417
432
|
return !(member == s);
|
418
433
|
}
|
419
434
|
|
420
435
|
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
421
|
-
typename CheckingPolicy>
|
422
|
-
V8_INLINE bool operator==(
|
423
|
-
|
424
|
-
|
436
|
+
typename CheckingPolicy, typename StorageType>
|
437
|
+
V8_INLINE bool operator==(
|
438
|
+
SentinelPointer s, const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
439
|
+
CheckingPolicy, StorageType>& member) {
|
425
440
|
return member == s;
|
426
441
|
}
|
427
442
|
|
428
443
|
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
429
|
-
typename CheckingPolicy>
|
430
|
-
V8_INLINE bool operator!=(
|
431
|
-
|
432
|
-
|
444
|
+
typename CheckingPolicy, typename StorageType>
|
445
|
+
V8_INLINE bool operator!=(
|
446
|
+
SentinelPointer s, const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
447
|
+
CheckingPolicy, StorageType>& member) {
|
433
448
|
return !(s == member);
|
434
449
|
}
|
435
450
|
|
436
451
|
// Equality with nullptr.
|
437
452
|
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
438
|
-
typename CheckingPolicy>
|
439
|
-
V8_INLINE bool operator==(
|
440
|
-
|
441
|
-
|
453
|
+
typename CheckingPolicy, typename StorageType>
|
454
|
+
V8_INLINE bool operator==(
|
455
|
+
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
456
|
+
StorageType>& member,
|
457
|
+
std::nullptr_t) {
|
442
458
|
return !static_cast<bool>(member);
|
443
459
|
}
|
444
460
|
|
445
461
|
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
446
|
-
typename CheckingPolicy>
|
447
|
-
V8_INLINE bool operator!=(
|
448
|
-
|
449
|
-
|
462
|
+
typename CheckingPolicy, typename StorageType>
|
463
|
+
V8_INLINE bool operator!=(
|
464
|
+
const BasicMember<T, WeaknessTag, WriteBarrierPolicy, CheckingPolicy,
|
465
|
+
StorageType>& member,
|
466
|
+
std::nullptr_t n) {
|
450
467
|
return !(member == n);
|
451
468
|
}
|
452
469
|
|
453
470
|
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
454
|
-
typename CheckingPolicy>
|
455
|
-
V8_INLINE bool operator==(
|
456
|
-
|
457
|
-
|
471
|
+
typename CheckingPolicy, typename StorageType>
|
472
|
+
V8_INLINE bool operator==(
|
473
|
+
std::nullptr_t n, const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
474
|
+
CheckingPolicy, StorageType>& member) {
|
458
475
|
return member == n;
|
459
476
|
}
|
460
477
|
|
461
478
|
template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
|
462
|
-
typename CheckingPolicy>
|
463
|
-
V8_INLINE bool operator!=(
|
464
|
-
|
465
|
-
|
479
|
+
typename CheckingPolicy, typename StorageType>
|
480
|
+
V8_INLINE bool operator!=(
|
481
|
+
std::nullptr_t n, const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
|
482
|
+
CheckingPolicy, StorageType>& member) {
|
466
483
|
return !(n == member);
|
467
484
|
}
|
468
485
|
|
469
486
|
// Relational operators.
|
470
487
|
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
471
488
|
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
472
|
-
typename WriteBarrierPolicy2, typename CheckingPolicy2
|
489
|
+
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
490
|
+
typename StorageType>
|
473
491
|
V8_INLINE bool operator<(
|
474
|
-
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1
|
475
|
-
|
476
|
-
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2
|
477
|
-
|
492
|
+
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
493
|
+
StorageType>& member1,
|
494
|
+
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
495
|
+
StorageType>& member2) {
|
478
496
|
static_assert(
|
479
497
|
internal::IsDecayedSameV<T1, T2>,
|
480
498
|
"Comparison works only for same pointer type modulo cv-qualifiers");
|
@@ -483,12 +501,13 @@ V8_INLINE bool operator<(
|
|
483
501
|
|
484
502
|
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
485
503
|
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
486
|
-
typename WriteBarrierPolicy2, typename CheckingPolicy2
|
504
|
+
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
505
|
+
typename StorageType>
|
487
506
|
V8_INLINE bool operator<=(
|
488
|
-
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1
|
489
|
-
|
490
|
-
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2
|
491
|
-
|
507
|
+
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
508
|
+
StorageType>& member1,
|
509
|
+
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
510
|
+
StorageType>& member2) {
|
492
511
|
static_assert(
|
493
512
|
internal::IsDecayedSameV<T1, T2>,
|
494
513
|
"Comparison works only for same pointer type modulo cv-qualifiers");
|
@@ -497,12 +516,13 @@ V8_INLINE bool operator<=(
|
|
497
516
|
|
498
517
|
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
499
518
|
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
500
|
-
typename WriteBarrierPolicy2, typename CheckingPolicy2
|
519
|
+
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
520
|
+
typename StorageType>
|
501
521
|
V8_INLINE bool operator>(
|
502
|
-
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1
|
503
|
-
|
504
|
-
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2
|
505
|
-
|
522
|
+
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
523
|
+
StorageType>& member1,
|
524
|
+
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
525
|
+
StorageType>& member2) {
|
506
526
|
static_assert(
|
507
527
|
internal::IsDecayedSameV<T1, T2>,
|
508
528
|
"Comparison works only for same pointer type modulo cv-qualifiers");
|
@@ -511,21 +531,23 @@ V8_INLINE bool operator>(
|
|
511
531
|
|
512
532
|
template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
|
513
533
|
typename CheckingPolicy1, typename T2, typename WeaknessTag2,
|
514
|
-
typename WriteBarrierPolicy2, typename CheckingPolicy2
|
534
|
+
typename WriteBarrierPolicy2, typename CheckingPolicy2,
|
535
|
+
typename StorageType>
|
515
536
|
V8_INLINE bool operator>=(
|
516
|
-
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1
|
517
|
-
|
518
|
-
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2
|
519
|
-
|
537
|
+
const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1,
|
538
|
+
StorageType>& member1,
|
539
|
+
const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2,
|
540
|
+
StorageType>& member2) {
|
520
541
|
static_assert(
|
521
542
|
internal::IsDecayedSameV<T1, T2>,
|
522
543
|
"Comparison works only for same pointer type modulo cv-qualifiers");
|
523
544
|
return member1.GetRawStorage() >= member2.GetRawStorage();
|
524
545
|
}
|
525
546
|
|
526
|
-
template <typename T, typename WriteBarrierPolicy, typename CheckingPolicy
|
527
|
-
|
528
|
-
|
547
|
+
template <typename T, typename WriteBarrierPolicy, typename CheckingPolicy,
|
548
|
+
typename StorageType>
|
549
|
+
struct IsWeak<internal::BasicMember<T, WeakMemberTag, WriteBarrierPolicy,
|
550
|
+
CheckingPolicy, StorageType>>
|
529
551
|
: std::true_type {};
|
530
552
|
|
531
553
|
} // namespace internal
|
@@ -536,8 +558,9 @@ struct IsWeak<
|
|
536
558
|
* trace method.
|
537
559
|
*/
|
538
560
|
template <typename T>
|
539
|
-
using Member = internal::BasicMember<
|
540
|
-
|
561
|
+
using Member = internal::BasicMember<
|
562
|
+
T, internal::StrongMemberTag, internal::DijkstraWriteBarrierPolicy,
|
563
|
+
internal::DefaultMemberCheckingPolicy, internal::DefaultMemberStorage>;
|
541
564
|
|
542
565
|
/**
|
543
566
|
* WeakMember is similar to Member in that it is used to point to other garbage
|
@@ -548,8 +571,9 @@ using Member = internal::BasicMember<T, internal::StrongMemberTag,
|
|
548
571
|
* will automatically be set to null.
|
549
572
|
*/
|
550
573
|
template <typename T>
|
551
|
-
using WeakMember = internal::BasicMember<
|
552
|
-
|
574
|
+
using WeakMember = internal::BasicMember<
|
575
|
+
T, internal::WeakMemberTag, internal::DijkstraWriteBarrierPolicy,
|
576
|
+
internal::DefaultMemberCheckingPolicy, internal::DefaultMemberStorage>;
|
553
577
|
|
554
578
|
/**
|
555
579
|
* UntracedMember is a pointer to an on-heap object that is not traced for some
|
@@ -558,8 +582,22 @@ using WeakMember = internal::BasicMember<T, internal::WeakMemberTag,
|
|
558
582
|
* must be kept alive through other means.
|
559
583
|
*/
|
560
584
|
template <typename T>
|
561
|
-
using UntracedMember = internal::BasicMember<
|
562
|
-
|
585
|
+
using UntracedMember = internal::BasicMember<
|
586
|
+
T, internal::UntracedMemberTag, internal::NoWriteBarrierPolicy,
|
587
|
+
internal::DefaultMemberCheckingPolicy, internal::DefaultMemberStorage>;
|
588
|
+
|
589
|
+
namespace subtle {
|
590
|
+
|
591
|
+
/**
|
592
|
+
* UncompressedMember. Use with care in hot paths that would otherwise cause
|
593
|
+
* many decompression cycles.
|
594
|
+
*/
|
595
|
+
template <typename T>
|
596
|
+
using UncompressedMember = internal::BasicMember<
|
597
|
+
T, internal::StrongMemberTag, internal::DijkstraWriteBarrierPolicy,
|
598
|
+
internal::DefaultMemberCheckingPolicy, internal::RawPointer>;
|
599
|
+
|
600
|
+
} // namespace subtle
|
563
601
|
|
564
602
|
} // namespace cppgc
|
565
603
|
|
@@ -114,11 +114,12 @@ class BasicPersistent final : public PersistentBase,
|
|
114
114
|
// Constructor from member.
|
115
115
|
template <typename U, typename MemberBarrierPolicy,
|
116
116
|
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
117
|
+
typename MemberStorageType,
|
117
118
|
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
|
118
|
-
BasicPersistent(
|
119
|
-
|
120
|
-
|
121
|
-
|
119
|
+
BasicPersistent(const internal::BasicMember<
|
120
|
+
U, MemberBarrierPolicy, MemberWeaknessTag,
|
121
|
+
MemberCheckingPolicy, MemberStorageType>& member,
|
122
|
+
const SourceLocation& loc = SourceLocation::Current())
|
122
123
|
: BasicPersistent(member.Get(), loc) {}
|
123
124
|
|
124
125
|
~BasicPersistent() { Clear(); }
|
@@ -154,10 +155,12 @@ class BasicPersistent final : public PersistentBase,
|
|
154
155
|
// Assignment from member.
|
155
156
|
template <typename U, typename MemberBarrierPolicy,
|
156
157
|
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
158
|
+
typename MemberStorageType,
|
157
159
|
typename = std::enable_if_t<std::is_base_of<T, U>::value>>
|
158
160
|
BasicPersistent& operator=(
|
159
161
|
const internal::BasicMember<U, MemberBarrierPolicy, MemberWeaknessTag,
|
160
|
-
MemberCheckingPolicy>&
|
162
|
+
MemberCheckingPolicy, MemberStorageType>&
|
163
|
+
member) {
|
161
164
|
return operator=(member.Get());
|
162
165
|
}
|
163
166
|
|
@@ -286,36 +289,39 @@ bool operator!=(const BasicPersistent<T1, WeaknessPolicy1, LocationPolicy1,
|
|
286
289
|
template <typename T1, typename PersistentWeaknessPolicy,
|
287
290
|
typename PersistentLocationPolicy, typename PersistentCheckingPolicy,
|
288
291
|
typename T2, typename MemberWriteBarrierPolicy,
|
289
|
-
typename MemberWeaknessTag, typename MemberCheckingPolicy
|
292
|
+
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
293
|
+
typename MemberStorageType>
|
290
294
|
bool operator==(
|
291
295
|
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
292
296
|
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
293
297
|
p,
|
294
298
|
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
295
|
-
MemberCheckingPolicy>& m) {
|
299
|
+
MemberCheckingPolicy, MemberStorageType>& m) {
|
296
300
|
return p.Get() == m.Get();
|
297
301
|
}
|
298
302
|
|
299
303
|
template <typename T1, typename PersistentWeaknessPolicy,
|
300
304
|
typename PersistentLocationPolicy, typename PersistentCheckingPolicy,
|
301
305
|
typename T2, typename MemberWriteBarrierPolicy,
|
302
|
-
typename MemberWeaknessTag, typename MemberCheckingPolicy
|
306
|
+
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
307
|
+
typename MemberStorageType>
|
303
308
|
bool operator!=(
|
304
309
|
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
305
310
|
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
306
311
|
p,
|
307
312
|
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
308
|
-
MemberCheckingPolicy>& m) {
|
313
|
+
MemberCheckingPolicy, MemberStorageType>& m) {
|
309
314
|
return !(p == m);
|
310
315
|
}
|
311
316
|
|
312
317
|
template <typename T1, typename MemberWriteBarrierPolicy,
|
313
318
|
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
314
|
-
typename
|
315
|
-
typename
|
319
|
+
typename MemberStorageType, typename T2,
|
320
|
+
typename PersistentWeaknessPolicy, typename PersistentLocationPolicy,
|
321
|
+
typename PersistentCheckingPolicy>
|
316
322
|
bool operator==(
|
317
323
|
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
318
|
-
MemberCheckingPolicy>& m,
|
324
|
+
MemberCheckingPolicy, MemberStorageType>& m,
|
319
325
|
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
320
326
|
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
321
327
|
p) {
|
@@ -324,11 +330,12 @@ bool operator==(
|
|
324
330
|
|
325
331
|
template <typename T1, typename MemberWriteBarrierPolicy,
|
326
332
|
typename MemberWeaknessTag, typename MemberCheckingPolicy,
|
327
|
-
typename
|
328
|
-
typename
|
333
|
+
typename MemberStorageType, typename T2,
|
334
|
+
typename PersistentWeaknessPolicy, typename PersistentLocationPolicy,
|
335
|
+
typename PersistentCheckingPolicy>
|
329
336
|
bool operator!=(
|
330
337
|
const BasicMember<T2, MemberWeaknessTag, MemberWriteBarrierPolicy,
|
331
|
-
MemberCheckingPolicy>& m,
|
338
|
+
MemberCheckingPolicy, MemberStorageType>& m,
|
332
339
|
const BasicPersistent<T1, PersistentWeaknessPolicy,
|
333
340
|
PersistentLocationPolicy, PersistentCheckingPolicy>&
|
334
341
|
p) {
|