libv8-node 18.13.0.0-aarch64-linux-musl → 19.9.0.0-aarch64-linux-musl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libv8-node/location.rb +1 -1
  3. data/lib/libv8/node/version.rb +3 -3
  4. data/vendor/v8/aarch64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
  5. data/vendor/v8/include/cppgc/common.h +0 -1
  6. data/vendor/v8/include/cppgc/cross-thread-persistent.h +7 -8
  7. data/vendor/v8/include/cppgc/heap-consistency.h +46 -3
  8. data/vendor/v8/include/cppgc/heap-handle.h +43 -0
  9. data/vendor/v8/include/cppgc/heap-statistics.h +2 -2
  10. data/vendor/v8/include/cppgc/heap.h +3 -7
  11. data/vendor/v8/include/cppgc/internal/api-constants.h +11 -1
  12. data/vendor/v8/include/cppgc/internal/base-page-handle.h +45 -0
  13. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +40 -8
  14. data/vendor/v8/include/cppgc/internal/caged-heap.h +61 -0
  15. data/vendor/v8/include/cppgc/internal/gc-info.h +0 -1
  16. data/vendor/v8/include/cppgc/internal/member-storage.h +236 -0
  17. data/vendor/v8/include/cppgc/internal/name-trait.h +21 -6
  18. data/vendor/v8/include/cppgc/internal/persistent-node.h +11 -13
  19. data/vendor/v8/include/cppgc/internal/pointer-policies.h +28 -7
  20. data/vendor/v8/include/cppgc/internal/write-barrier.h +143 -101
  21. data/vendor/v8/include/cppgc/liveness-broker.h +8 -7
  22. data/vendor/v8/include/cppgc/member.h +364 -89
  23. data/vendor/v8/include/cppgc/name-provider.h +4 -4
  24. data/vendor/v8/include/cppgc/persistent.h +5 -9
  25. data/vendor/v8/include/cppgc/platform.h +2 -2
  26. data/vendor/v8/include/cppgc/sentinel-pointer.h +1 -1
  27. data/vendor/v8/include/cppgc/trace-trait.h +4 -0
  28. data/vendor/v8/include/cppgc/type-traits.h +9 -0
  29. data/vendor/v8/include/cppgc/visitor.h +89 -57
  30. data/vendor/v8/include/v8-callbacks.h +19 -5
  31. data/vendor/v8/include/v8-context.h +13 -8
  32. data/vendor/v8/include/v8-cppgc.h +12 -0
  33. data/vendor/v8/include/v8-date.h +5 -0
  34. data/vendor/v8/include/v8-embedder-heap.h +8 -3
  35. data/vendor/v8/include/v8-exception.h +1 -1
  36. data/vendor/v8/include/v8-fast-api-calls.h +46 -32
  37. data/vendor/v8/include/v8-function.h +8 -0
  38. data/vendor/v8/include/v8-initialization.h +23 -49
  39. data/vendor/v8/include/v8-inspector.h +13 -7
  40. data/vendor/v8/include/v8-internal.h +328 -123
  41. data/vendor/v8/include/v8-isolate.h +27 -42
  42. data/vendor/v8/include/v8-local-handle.h +5 -5
  43. data/vendor/v8/include/v8-locker.h +0 -11
  44. data/vendor/v8/include/v8-maybe.h +24 -1
  45. data/vendor/v8/include/v8-message.h +2 -4
  46. data/vendor/v8/include/v8-metrics.h +20 -38
  47. data/vendor/v8/include/v8-microtask-queue.h +1 -1
  48. data/vendor/v8/include/v8-object.h +8 -15
  49. data/vendor/v8/include/v8-persistent-handle.h +0 -2
  50. data/vendor/v8/include/v8-platform.h +54 -25
  51. data/vendor/v8/include/v8-primitive.h +8 -8
  52. data/vendor/v8/include/v8-profiler.h +84 -22
  53. data/vendor/v8/include/v8-regexp.h +2 -1
  54. data/vendor/v8/include/v8-script.h +62 -6
  55. data/vendor/v8/include/v8-template.h +13 -76
  56. data/vendor/v8/include/v8-unwinder-state.h +4 -4
  57. data/vendor/v8/include/v8-util.h +2 -4
  58. data/vendor/v8/include/v8-value-serializer.h +46 -23
  59. data/vendor/v8/include/v8-version.h +3 -3
  60. data/vendor/v8/include/v8-wasm.h +5 -62
  61. data/vendor/v8/include/v8-weak-callback-info.h +0 -7
  62. data/vendor/v8/include/v8config.h +280 -13
  63. metadata +9 -5
@@ -9,6 +9,8 @@
9
9
  #include <cstddef>
10
10
  #include <type_traits>
11
11
 
12
+ #include "cppgc/internal/api-constants.h"
13
+ #include "cppgc/internal/member-storage.h"
12
14
  #include "cppgc/internal/pointer-policies.h"
13
15
  #include "cppgc/sentinel-pointer.h"
14
16
  #include "cppgc/type-traits.h"
@@ -16,177 +18,247 @@
16
18
 
17
19
  namespace cppgc {
18
20
 
21
+ namespace subtle {
22
+ class HeapConsistency;
23
+ } // namespace subtle
24
+
19
25
  class Visitor;
20
26
 
21
27
  namespace internal {
22
28
 
23
29
  // MemberBase always refers to the object as const object and defers to
24
30
  // BasicMember on casting to the right type as needed.
25
- class MemberBase {
31
+ class V8_TRIVIAL_ABI MemberBase {
32
+ public:
33
+ #if defined(CPPGC_POINTER_COMPRESSION)
34
+ using RawStorage = CompressedPointer;
35
+ #else // !defined(CPPGC_POINTER_COMPRESSION)
36
+ using RawStorage = RawPointer;
37
+ #endif // !defined(CPPGC_POINTER_COMPRESSION)
26
38
  protected:
27
39
  struct AtomicInitializerTag {};
28
40
 
29
- MemberBase() : raw_(nullptr) {}
30
- explicit MemberBase(const void* value) : raw_(value) {}
31
- MemberBase(const void* value, AtomicInitializerTag) { SetRawAtomic(value); }
41
+ V8_INLINE MemberBase() = default;
42
+ V8_INLINE explicit MemberBase(const void* value) : raw_(value) {}
43
+ V8_INLINE MemberBase(const void* value, AtomicInitializerTag) {
44
+ SetRawAtomic(value);
45
+ }
32
46
 
33
- const void** GetRawSlot() const { return &raw_; }
34
- const void* GetRaw() const { return raw_; }
35
- void SetRaw(void* value) { raw_ = value; }
47
+ V8_INLINE explicit MemberBase(RawStorage raw) : raw_(raw) {}
48
+ V8_INLINE explicit MemberBase(std::nullptr_t) : raw_(nullptr) {}
49
+ V8_INLINE explicit MemberBase(SentinelPointer s) : raw_(s) {}
36
50
 
37
- const void* GetRawAtomic() const {
38
- return reinterpret_cast<const std::atomic<const void*>*>(&raw_)->load(
39
- std::memory_order_relaxed);
51
+ V8_INLINE const void** GetRawSlot() const {
52
+ return reinterpret_cast<const void**>(const_cast<MemberBase*>(this));
40
53
  }
41
- void SetRawAtomic(const void* value) {
42
- reinterpret_cast<std::atomic<const void*>*>(&raw_)->store(
43
- value, std::memory_order_relaxed);
54
+ V8_INLINE const void* GetRaw() const { return raw_.Load(); }
55
+ V8_INLINE void SetRaw(void* value) { raw_.Store(value); }
56
+
57
+ V8_INLINE const void* GetRawAtomic() const { return raw_.LoadAtomic(); }
58
+ V8_INLINE void SetRawAtomic(const void* value) { raw_.StoreAtomic(value); }
59
+
60
+ V8_INLINE RawStorage GetRawStorage() const { return raw_; }
61
+ V8_INLINE void SetRawStorageAtomic(RawStorage other) {
62
+ reinterpret_cast<std::atomic<RawStorage>&>(raw_).store(
63
+ other, std::memory_order_relaxed);
44
64
  }
45
65
 
46
- void ClearFromGC() const { raw_ = nullptr; }
66
+ V8_INLINE bool IsCleared() const { return raw_.IsCleared(); }
67
+
68
+ V8_INLINE void ClearFromGC() const { raw_.Clear(); }
47
69
 
48
70
  private:
49
- // All constructors initialize `raw_`. Do not add a default value here as it
50
- // results in a non-atomic write on some builds, even when the atomic version
51
- // of the constructor is used.
52
- mutable const void* raw_;
71
+ friend class MemberDebugHelper;
72
+
73
+ mutable RawStorage raw_;
53
74
  };
54
75
 
55
76
  // The basic class from which all Member classes are 'generated'.
56
77
  template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
57
78
  typename CheckingPolicy>
58
- class BasicMember final : private MemberBase, private CheckingPolicy {
79
+ class V8_TRIVIAL_ABI BasicMember final : private MemberBase,
80
+ private CheckingPolicy {
59
81
  public:
60
82
  using PointeeType = T;
61
83
 
62
- constexpr BasicMember() = default;
63
- constexpr BasicMember(std::nullptr_t) {} // NOLINT
64
- BasicMember(SentinelPointer s) : MemberBase(s) {} // NOLINT
65
- BasicMember(T* raw) : MemberBase(raw) { // NOLINT
66
- InitializingWriteBarrier();
84
+ V8_INLINE constexpr BasicMember() = default;
85
+ V8_INLINE constexpr BasicMember(std::nullptr_t) {} // NOLINT
86
+ V8_INLINE BasicMember(SentinelPointer s) : MemberBase(s) {} // NOLINT
87
+ V8_INLINE BasicMember(T* raw) : MemberBase(raw) { // NOLINT
88
+ InitializingWriteBarrier(raw);
67
89
  this->CheckPointer(Get());
68
90
  }
69
- BasicMember(T& raw) : BasicMember(&raw) {} // NOLINT
91
+ V8_INLINE BasicMember(T& raw) // NOLINT
92
+ : BasicMember(&raw) {}
93
+
70
94
  // Atomic ctor. Using the AtomicInitializerTag forces BasicMember to
71
95
  // initialize using atomic assignments. This is required for preventing
72
96
  // data races with concurrent marking.
73
97
  using AtomicInitializerTag = MemberBase::AtomicInitializerTag;
74
- BasicMember(std::nullptr_t, AtomicInitializerTag atomic)
98
+ V8_INLINE BasicMember(std::nullptr_t, AtomicInitializerTag atomic)
75
99
  : MemberBase(nullptr, atomic) {}
76
- BasicMember(SentinelPointer s, AtomicInitializerTag atomic)
100
+ V8_INLINE BasicMember(SentinelPointer s, AtomicInitializerTag atomic)
77
101
  : MemberBase(s, atomic) {}
78
- BasicMember(T* raw, AtomicInitializerTag atomic) : MemberBase(raw, atomic) {
79
- InitializingWriteBarrier();
102
+ V8_INLINE BasicMember(T* raw, AtomicInitializerTag atomic)
103
+ : MemberBase(raw, atomic) {
104
+ InitializingWriteBarrier(raw);
80
105
  this->CheckPointer(Get());
81
106
  }
82
- BasicMember(T& raw, AtomicInitializerTag atomic)
107
+ V8_INLINE BasicMember(T& raw, AtomicInitializerTag atomic)
83
108
  : BasicMember(&raw, atomic) {}
109
+
84
110
  // Copy ctor.
85
- BasicMember(const BasicMember& other) : BasicMember(other.Get()) {}
86
- // Allow heterogeneous construction.
111
+ V8_INLINE BasicMember(const BasicMember& other)
112
+ : BasicMember(other.GetRawStorage()) {}
113
+
114
+ // Heterogeneous copy constructors. When the source pointer have a different
115
+ // type, perform a compress-decompress round, because the source pointer may
116
+ // need to be adjusted.
87
117
  template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
88
118
  typename OtherCheckingPolicy,
89
- typename = std::enable_if_t<std::is_base_of<T, U>::value>>
90
- BasicMember( // NOLINT
119
+ std::enable_if_t<internal::IsDecayedSameV<T, U>>* = nullptr>
120
+ V8_INLINE BasicMember( // NOLINT
121
+ const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
122
+ OtherCheckingPolicy>& other)
123
+ : BasicMember(other.GetRawStorage()) {}
124
+
125
+ template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
126
+ typename OtherCheckingPolicy,
127
+ std::enable_if_t<internal::IsStrictlyBaseOfV<T, U>>* = nullptr>
128
+ V8_INLINE BasicMember( // NOLINT
91
129
  const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
92
130
  OtherCheckingPolicy>& other)
93
131
  : BasicMember(other.Get()) {}
132
+
94
133
  // Move ctor.
95
- BasicMember(BasicMember&& other) noexcept : BasicMember(other.Get()) {
134
+ V8_INLINE BasicMember(BasicMember&& other) noexcept
135
+ : BasicMember(other.GetRawStorage()) {
96
136
  other.Clear();
97
137
  }
98
- // Allow heterogeneous move construction.
138
+
139
+ // Heterogeneous move constructors. When the source pointer have a different
140
+ // type, perform a compress-decompress round, because the source pointer may
141
+ // need to be adjusted.
99
142
  template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
100
143
  typename OtherCheckingPolicy,
101
- typename = std::enable_if_t<std::is_base_of<T, U>::value>>
102
- BasicMember(BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
103
- OtherCheckingPolicy>&& other) noexcept
144
+ std::enable_if_t<internal::IsDecayedSameV<T, U>>* = nullptr>
145
+ V8_INLINE BasicMember(BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
146
+ OtherCheckingPolicy>&& other) noexcept
147
+ : BasicMember(other.GetRawStorage()) {
148
+ other.Clear();
149
+ }
150
+
151
+ template <typename U, typename OtherBarrierPolicy, typename OtherWeaknessTag,
152
+ typename OtherCheckingPolicy,
153
+ std::enable_if_t<internal::IsStrictlyBaseOfV<T, U>>* = nullptr>
154
+ V8_INLINE BasicMember(BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
155
+ OtherCheckingPolicy>&& other) noexcept
104
156
  : BasicMember(other.Get()) {
105
157
  other.Clear();
106
158
  }
159
+
107
160
  // Construction from Persistent.
108
161
  template <typename U, typename PersistentWeaknessPolicy,
109
162
  typename PersistentLocationPolicy,
110
163
  typename PersistentCheckingPolicy,
111
164
  typename = std::enable_if_t<std::is_base_of<T, U>::value>>
112
- BasicMember(const BasicPersistent<U, PersistentWeaknessPolicy,
113
- PersistentLocationPolicy,
114
- PersistentCheckingPolicy>& p)
165
+ V8_INLINE BasicMember(const BasicPersistent<U, PersistentWeaknessPolicy,
166
+ PersistentLocationPolicy,
167
+ PersistentCheckingPolicy>& p)
115
168
  : BasicMember(p.Get()) {}
116
169
 
117
170
  // Copy assignment.
118
- BasicMember& operator=(const BasicMember& other) {
119
- return operator=(other.Get());
171
+ V8_INLINE BasicMember& operator=(const BasicMember& other) {
172
+ return operator=(other.GetRawStorage());
120
173
  }
121
- // Allow heterogeneous copy assignment.
174
+
175
+ // Heterogeneous copy assignment. When the source pointer have a different
176
+ // type, perform a compress-decompress round, because the source pointer may
177
+ // need to be adjusted.
122
178
  template <typename U, typename OtherWeaknessTag, typename OtherBarrierPolicy,
123
- typename OtherCheckingPolicy,
124
- typename = std::enable_if_t<std::is_base_of<T, U>::value>>
125
- BasicMember& operator=(
179
+ typename OtherCheckingPolicy>
180
+ V8_INLINE BasicMember& operator=(
126
181
  const BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
127
182
  OtherCheckingPolicy>& other) {
128
- return operator=(other.Get());
183
+ if constexpr (internal::IsDecayedSameV<T, U>) {
184
+ return operator=(other.GetRawStorage());
185
+ } else {
186
+ static_assert(internal::IsStrictlyBaseOfV<T, U>);
187
+ return operator=(other.Get());
188
+ }
129
189
  }
190
+
130
191
  // Move assignment.
131
- BasicMember& operator=(BasicMember&& other) noexcept {
132
- operator=(other.Get());
192
+ V8_INLINE BasicMember& operator=(BasicMember&& other) noexcept {
193
+ operator=(other.GetRawStorage());
133
194
  other.Clear();
134
195
  return *this;
135
196
  }
136
- // Heterogeneous move assignment.
197
+
198
+ // Heterogeneous move assignment. When the source pointer have a different
199
+ // type, perform a compress-decompress round, because the source pointer may
200
+ // need to be adjusted.
137
201
  template <typename U, typename OtherWeaknessTag, typename OtherBarrierPolicy,
138
- typename OtherCheckingPolicy,
139
- typename = std::enable_if_t<std::is_base_of<T, U>::value>>
140
- BasicMember& operator=(BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
141
- OtherCheckingPolicy>&& other) noexcept {
142
- operator=(other.Get());
202
+ typename OtherCheckingPolicy>
203
+ V8_INLINE BasicMember& operator=(
204
+ BasicMember<U, OtherWeaknessTag, OtherBarrierPolicy,
205
+ OtherCheckingPolicy>&& other) noexcept {
206
+ if constexpr (internal::IsDecayedSameV<T, U>) {
207
+ operator=(other.GetRawStorage());
208
+ } else {
209
+ static_assert(internal::IsStrictlyBaseOfV<T, U>);
210
+ operator=(other.Get());
211
+ }
143
212
  other.Clear();
144
213
  return *this;
145
214
  }
215
+
146
216
  // Assignment from Persistent.
147
217
  template <typename U, typename PersistentWeaknessPolicy,
148
218
  typename PersistentLocationPolicy,
149
219
  typename PersistentCheckingPolicy,
150
220
  typename = std::enable_if_t<std::is_base_of<T, U>::value>>
151
- BasicMember& operator=(
221
+ V8_INLINE BasicMember& operator=(
152
222
  const BasicPersistent<U, PersistentWeaknessPolicy,
153
223
  PersistentLocationPolicy, PersistentCheckingPolicy>&
154
224
  other) {
155
225
  return operator=(other.Get());
156
226
  }
157
- BasicMember& operator=(T* other) {
227
+
228
+ V8_INLINE BasicMember& operator=(T* other) {
158
229
  SetRawAtomic(other);
159
- AssigningWriteBarrier();
230
+ AssigningWriteBarrier(other);
160
231
  this->CheckPointer(Get());
161
232
  return *this;
162
233
  }
163
- BasicMember& operator=(std::nullptr_t) {
234
+
235
+ V8_INLINE BasicMember& operator=(std::nullptr_t) {
164
236
  Clear();
165
237
  return *this;
166
238
  }
167
- BasicMember& operator=(SentinelPointer s) {
239
+ V8_INLINE BasicMember& operator=(SentinelPointer s) {
168
240
  SetRawAtomic(s);
169
241
  return *this;
170
242
  }
171
243
 
172
244
  template <typename OtherWeaknessTag, typename OtherBarrierPolicy,
173
245
  typename OtherCheckingPolicy>
174
- void Swap(BasicMember<T, OtherWeaknessTag, OtherBarrierPolicy,
175
- OtherCheckingPolicy>& other) {
176
- T* tmp = Get();
246
+ V8_INLINE void Swap(BasicMember<T, OtherWeaknessTag, OtherBarrierPolicy,
247
+ OtherCheckingPolicy>& other) {
248
+ auto tmp = GetRawStorage();
177
249
  *this = other;
178
250
  other = tmp;
179
251
  }
180
252
 
181
- explicit operator bool() const { return Get(); }
182
- operator T*() const { return Get(); }
183
- T* operator->() const { return Get(); }
184
- T& operator*() const { return *Get(); }
253
+ V8_INLINE explicit operator bool() const { return !IsCleared(); }
254
+ V8_INLINE operator T*() const { return Get(); }
255
+ V8_INLINE T* operator->() const { return Get(); }
256
+ V8_INLINE T& operator*() const { return *Get(); }
185
257
 
186
258
  // CFI cast exemption to allow passing SentinelPointer through T* and support
187
259
  // heterogeneous assignments between different Member and Persistent handles
188
260
  // based on their actual types.
189
- V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") T* Get() const {
261
+ V8_INLINE V8_CLANG_NO_SANITIZE("cfi-unrelated-cast") T* Get() const {
190
262
  // Executed by the mutator, hence non atomic load.
191
263
  //
192
264
  // The const_cast below removes the constness from MemberBase storage. The
@@ -195,59 +267,262 @@ class BasicMember final : private MemberBase, private CheckingPolicy {
195
267
  return static_cast<T*>(const_cast<void*>(MemberBase::GetRaw()));
196
268
  }
197
269
 
198
- void Clear() { SetRawAtomic(nullptr); }
270
+ V8_INLINE void Clear() { SetRawStorageAtomic(RawStorage{}); }
199
271
 
200
- T* Release() {
272
+ V8_INLINE T* Release() {
201
273
  T* result = Get();
202
274
  Clear();
203
275
  return result;
204
276
  }
205
277
 
206
- const T** GetSlotForTesting() const {
278
+ V8_INLINE const T** GetSlotForTesting() const {
207
279
  return reinterpret_cast<const T**>(GetRawSlot());
208
280
  }
209
281
 
282
+ V8_INLINE RawStorage GetRawStorage() const {
283
+ return MemberBase::GetRawStorage();
284
+ }
285
+
210
286
  private:
211
- const T* GetRawAtomic() const {
287
+ V8_INLINE explicit BasicMember(RawStorage raw) : MemberBase(raw) {
288
+ InitializingWriteBarrier(Get());
289
+ this->CheckPointer(Get());
290
+ }
291
+
292
+ V8_INLINE BasicMember& operator=(RawStorage other) {
293
+ SetRawStorageAtomic(other);
294
+ AssigningWriteBarrier();
295
+ this->CheckPointer(Get());
296
+ return *this;
297
+ }
298
+
299
+ V8_INLINE const T* GetRawAtomic() const {
212
300
  return static_cast<const T*>(MemberBase::GetRawAtomic());
213
301
  }
214
302
 
215
- void InitializingWriteBarrier() const {
216
- WriteBarrierPolicy::InitializingBarrier(GetRawSlot(), GetRaw());
303
+ V8_INLINE void InitializingWriteBarrier(T* value) const {
304
+ WriteBarrierPolicy::InitializingBarrier(GetRawSlot(), value);
217
305
  }
218
- void AssigningWriteBarrier() const {
219
- WriteBarrierPolicy::AssigningBarrier(GetRawSlot(), GetRaw());
306
+ V8_INLINE void AssigningWriteBarrier(T* value) const {
307
+ WriteBarrierPolicy::AssigningBarrier(GetRawSlot(), value);
308
+ }
309
+ V8_INLINE void AssigningWriteBarrier() const {
310
+ WriteBarrierPolicy::AssigningBarrier(GetRawSlot(), GetRawStorage());
220
311
  }
221
312
 
222
- void ClearFromGC() const { MemberBase::ClearFromGC(); }
313
+ V8_INLINE void ClearFromGC() const { MemberBase::ClearFromGC(); }
223
314
 
224
- T* GetFromGC() const { return Get(); }
315
+ V8_INLINE T* GetFromGC() const { return Get(); }
225
316
 
317
+ friend class cppgc::subtle::HeapConsistency;
226
318
  friend class cppgc::Visitor;
227
319
  template <typename U>
228
320
  friend struct cppgc::TraceTrait;
321
+ template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
322
+ typename CheckingPolicy1>
323
+ friend class BasicMember;
229
324
  };
230
325
 
326
+ // Member equality operators.
231
327
  template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
232
328
  typename CheckingPolicy1, typename T2, typename WeaknessTag2,
233
329
  typename WriteBarrierPolicy2, typename CheckingPolicy2>
234
- bool operator==(const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1,
235
- CheckingPolicy1>& member1,
236
- const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2,
237
- CheckingPolicy2>& member2) {
238
- return member1.Get() == member2.Get();
330
+ V8_INLINE bool operator==(
331
+ const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
332
+ member1,
333
+ const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
334
+ member2) {
335
+ if constexpr (internal::IsDecayedSameV<T1, T2>) {
336
+ // Check compressed pointers if types are the same.
337
+ return member1.GetRawStorage() == member2.GetRawStorage();
338
+ } else {
339
+ static_assert(internal::IsStrictlyBaseOfV<T1, T2> ||
340
+ internal::IsStrictlyBaseOfV<T2, T1>);
341
+ // Otherwise, check decompressed pointers.
342
+ return member1.Get() == member2.Get();
343
+ }
239
344
  }
240
345
 
241
346
  template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
242
347
  typename CheckingPolicy1, typename T2, typename WeaknessTag2,
243
348
  typename WriteBarrierPolicy2, typename CheckingPolicy2>
244
- bool operator!=(const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1,
245
- CheckingPolicy1>& member1,
246
- const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2,
247
- CheckingPolicy2>& member2) {
349
+ V8_INLINE bool operator!=(
350
+ const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
351
+ member1,
352
+ const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
353
+ member2) {
248
354
  return !(member1 == member2);
249
355
  }
250
356
 
357
+ // Equality with raw pointers.
358
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
359
+ typename CheckingPolicy, typename U>
360
+ V8_INLINE bool operator==(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
361
+ CheckingPolicy>& member,
362
+ U* raw) {
363
+ // Never allow comparison with erased pointers.
364
+ static_assert(!internal::IsDecayedSameV<void, U>);
365
+
366
+ if constexpr (internal::IsDecayedSameV<T, U>) {
367
+ // Check compressed pointers if types are the same.
368
+ return member.GetRawStorage() == MemberBase::RawStorage(raw);
369
+ } else if constexpr (internal::IsStrictlyBaseOfV<T, U>) {
370
+ // Cast the raw pointer to T, which may adjust the pointer.
371
+ return member.GetRawStorage() ==
372
+ MemberBase::RawStorage(static_cast<T*>(raw));
373
+ } else {
374
+ // Otherwise, decompressed the member.
375
+ return member.Get() == raw;
376
+ }
377
+ }
378
+
379
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
380
+ typename CheckingPolicy, typename U>
381
+ V8_INLINE bool operator!=(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
382
+ CheckingPolicy>& member,
383
+ U* raw) {
384
+ return !(member == raw);
385
+ }
386
+
387
+ template <typename T, typename U, typename WeaknessTag,
388
+ typename WriteBarrierPolicy, typename CheckingPolicy>
389
+ V8_INLINE bool operator==(T* raw,
390
+ const BasicMember<U, WeaknessTag, WriteBarrierPolicy,
391
+ CheckingPolicy>& member) {
392
+ return member == raw;
393
+ }
394
+
395
+ template <typename T, typename U, typename WeaknessTag,
396
+ typename WriteBarrierPolicy, typename CheckingPolicy>
397
+ V8_INLINE bool operator!=(T* raw,
398
+ const BasicMember<U, WeaknessTag, WriteBarrierPolicy,
399
+ CheckingPolicy>& member) {
400
+ return !(raw == member);
401
+ }
402
+
403
+ // Equality with sentinel.
404
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
405
+ typename CheckingPolicy>
406
+ V8_INLINE bool operator==(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
407
+ CheckingPolicy>& member,
408
+ SentinelPointer) {
409
+ return member.GetRawStorage().IsSentinel();
410
+ }
411
+
412
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
413
+ typename CheckingPolicy>
414
+ V8_INLINE bool operator!=(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
415
+ CheckingPolicy>& member,
416
+ SentinelPointer s) {
417
+ return !(member == s);
418
+ }
419
+
420
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
421
+ typename CheckingPolicy>
422
+ V8_INLINE bool operator==(SentinelPointer s,
423
+ const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
424
+ CheckingPolicy>& member) {
425
+ return member == s;
426
+ }
427
+
428
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
429
+ typename CheckingPolicy>
430
+ V8_INLINE bool operator!=(SentinelPointer s,
431
+ const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
432
+ CheckingPolicy>& member) {
433
+ return !(s == member);
434
+ }
435
+
436
+ // Equality with nullptr.
437
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
438
+ typename CheckingPolicy>
439
+ V8_INLINE bool operator==(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
440
+ CheckingPolicy>& member,
441
+ std::nullptr_t) {
442
+ return !static_cast<bool>(member);
443
+ }
444
+
445
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
446
+ typename CheckingPolicy>
447
+ V8_INLINE bool operator!=(const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
448
+ CheckingPolicy>& member,
449
+ std::nullptr_t n) {
450
+ return !(member == n);
451
+ }
452
+
453
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
454
+ typename CheckingPolicy>
455
+ V8_INLINE bool operator==(std::nullptr_t n,
456
+ const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
457
+ CheckingPolicy>& member) {
458
+ return member == n;
459
+ }
460
+
461
+ template <typename T, typename WeaknessTag, typename WriteBarrierPolicy,
462
+ typename CheckingPolicy>
463
+ V8_INLINE bool operator!=(std::nullptr_t n,
464
+ const BasicMember<T, WeaknessTag, WriteBarrierPolicy,
465
+ CheckingPolicy>& member) {
466
+ return !(n == member);
467
+ }
468
+
469
+ // Relational operators.
470
+ template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
471
+ typename CheckingPolicy1, typename T2, typename WeaknessTag2,
472
+ typename WriteBarrierPolicy2, typename CheckingPolicy2>
473
+ V8_INLINE bool operator<(
474
+ const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
475
+ member1,
476
+ const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
477
+ member2) {
478
+ static_assert(
479
+ internal::IsDecayedSameV<T1, T2>,
480
+ "Comparison works only for same pointer type modulo cv-qualifiers");
481
+ return member1.GetRawStorage() < member2.GetRawStorage();
482
+ }
483
+
484
+ template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
485
+ typename CheckingPolicy1, typename T2, typename WeaknessTag2,
486
+ typename WriteBarrierPolicy2, typename CheckingPolicy2>
487
+ V8_INLINE bool operator<=(
488
+ const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
489
+ member1,
490
+ const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
491
+ member2) {
492
+ static_assert(
493
+ internal::IsDecayedSameV<T1, T2>,
494
+ "Comparison works only for same pointer type modulo cv-qualifiers");
495
+ return member1.GetRawStorage() <= member2.GetRawStorage();
496
+ }
497
+
498
+ template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
499
+ typename CheckingPolicy1, typename T2, typename WeaknessTag2,
500
+ typename WriteBarrierPolicy2, typename CheckingPolicy2>
501
+ V8_INLINE bool operator>(
502
+ const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
503
+ member1,
504
+ const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
505
+ member2) {
506
+ static_assert(
507
+ internal::IsDecayedSameV<T1, T2>,
508
+ "Comparison works only for same pointer type modulo cv-qualifiers");
509
+ return member1.GetRawStorage() > member2.GetRawStorage();
510
+ }
511
+
512
+ template <typename T1, typename WeaknessTag1, typename WriteBarrierPolicy1,
513
+ typename CheckingPolicy1, typename T2, typename WeaknessTag2,
514
+ typename WriteBarrierPolicy2, typename CheckingPolicy2>
515
+ V8_INLINE bool operator>=(
516
+ const BasicMember<T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1>&
517
+ member1,
518
+ const BasicMember<T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2>&
519
+ member2) {
520
+ static_assert(
521
+ internal::IsDecayedSameV<T1, T2>,
522
+ "Comparison works only for same pointer type modulo cv-qualifiers");
523
+ return member1.GetRawStorage() >= member2.GetRawStorage();
524
+ }
525
+
251
526
  template <typename T, typename WriteBarrierPolicy, typename CheckingPolicy>
252
527
  struct IsWeak<
253
528
  internal::BasicMember<T, WeakMemberTag, WriteBarrierPolicy, CheckingPolicy>>
@@ -37,15 +37,15 @@ class V8_EXPORT NameProvider {
37
37
  static constexpr const char kNoNameDeducible[] = "<No name>";
38
38
 
39
39
  /**
40
- * Indicating whether internal names are hidden or not.
40
+ * Indicating whether the build supports extracting C++ names as object names.
41
41
  *
42
42
  * @returns true if C++ names should be hidden and represented by kHiddenName.
43
43
  */
44
- static constexpr bool HideInternalNames() {
44
+ static constexpr bool SupportsCppClassNamesAsObjectNames() {
45
45
  #if CPPGC_SUPPORTS_OBJECT_NAMES
46
- return false;
47
- #else // !CPPGC_SUPPORTS_OBJECT_NAMES
48
46
  return true;
47
+ #else // !CPPGC_SUPPORTS_OBJECT_NAMES
48
+ return false;
49
49
  #endif // !CPPGC_SUPPORTS_OBJECT_NAMES
50
50
  }
51
51
 
@@ -16,9 +16,6 @@
16
16
  #include "v8config.h" // NOLINT(build/include_directory)
17
17
 
18
18
  namespace cppgc {
19
-
20
- class Visitor;
21
-
22
19
  namespace internal {
23
20
 
24
21
  // PersistentBase always refers to the object as const object and defers to
@@ -78,7 +75,7 @@ class BasicPersistent final : public PersistentBase,
78
75
  : PersistentBase(raw), LocationPolicy(loc) {
79
76
  if (!IsValid()) return;
80
77
  SetNode(WeaknessPolicy::GetPersistentRegion(GetValue())
81
- .AllocateNode(this, &BasicPersistent::Trace));
78
+ .AllocateNode(this, &TraceAsRoot));
82
79
  this->CheckPointer(Get());
83
80
  }
84
81
 
@@ -221,9 +218,8 @@ class BasicPersistent final : public PersistentBase,
221
218
  }
222
219
 
223
220
  private:
224
- static void Trace(Visitor* v, const void* ptr) {
225
- const auto* persistent = static_cast<const BasicPersistent*>(ptr);
226
- v->TraceRoot(*persistent, persistent->Location());
221
+ static void TraceAsRoot(RootVisitor& root_visitor, const void* ptr) {
222
+ root_visitor.Trace(*static_cast<const BasicPersistent*>(ptr));
227
223
  }
228
224
 
229
225
  bool IsValid() const {
@@ -247,7 +243,7 @@ class BasicPersistent final : public PersistentBase,
247
243
  SetValue(ptr);
248
244
  if (!IsValid()) return;
249
245
  SetNode(WeaknessPolicy::GetPersistentRegion(GetValue())
250
- .AllocateNode(this, &BasicPersistent::Trace));
246
+ .AllocateNode(this, &TraceAsRoot));
251
247
  this->CheckPointer(Get());
252
248
  }
253
249
 
@@ -264,7 +260,7 @@ class BasicPersistent final : public PersistentBase,
264
260
  return static_cast<T*>(const_cast<void*>(GetValue()));
265
261
  }
266
262
 
267
- friend class cppgc::Visitor;
263
+ friend class internal::RootVisitor;
268
264
  };
269
265
 
270
266
  template <typename T1, typename WeaknessPolicy1, typename LocationPolicy1,