libv8-node 15.14.0.1-aarch64-linux-musl → 16.17.0.0-aarch64-linux-musl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libv8-node/location.rb +1 -1
  3. data/ext/libv8-node/paths.rb +5 -1
  4. data/lib/libv8/node/version.rb +3 -3
  5. data/vendor/v8/{out.gn → aarch64-linux-musl}/libv8/obj/libv8_monolith.a +0 -0
  6. data/vendor/v8/include/cppgc/allocation.h +105 -45
  7. data/vendor/v8/include/cppgc/common.h +9 -6
  8. data/vendor/v8/include/cppgc/cross-thread-persistent.h +413 -0
  9. data/vendor/v8/include/cppgc/custom-space.h +37 -2
  10. data/vendor/v8/include/cppgc/default-platform.h +47 -48
  11. data/vendor/v8/include/cppgc/ephemeron-pair.h +30 -0
  12. data/vendor/v8/include/cppgc/explicit-management.h +82 -0
  13. data/vendor/v8/include/cppgc/garbage-collected.h +4 -3
  14. data/vendor/v8/include/cppgc/heap-consistency.h +253 -0
  15. data/vendor/v8/include/cppgc/heap-state.h +70 -0
  16. data/vendor/v8/include/cppgc/heap-statistics.h +120 -0
  17. data/vendor/v8/include/cppgc/heap.h +68 -6
  18. data/vendor/v8/include/cppgc/internal/api-constants.h +3 -3
  19. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +2 -1
  20. data/vendor/v8/include/cppgc/internal/compiler-specific.h +2 -2
  21. data/vendor/v8/include/cppgc/internal/gc-info.h +44 -13
  22. data/vendor/v8/include/cppgc/internal/name-trait.h +111 -0
  23. data/vendor/v8/include/cppgc/internal/persistent-node.h +58 -2
  24. data/vendor/v8/include/cppgc/internal/pointer-policies.h +69 -28
  25. data/vendor/v8/include/cppgc/internal/prefinalizer-handler.h +1 -1
  26. data/vendor/v8/include/cppgc/internal/write-barrier.h +390 -35
  27. data/vendor/v8/include/cppgc/liveness-broker.h +11 -2
  28. data/vendor/v8/include/cppgc/macros.h +2 -0
  29. data/vendor/v8/include/cppgc/member.h +87 -25
  30. data/vendor/v8/include/cppgc/name-provider.h +65 -0
  31. data/vendor/v8/include/cppgc/object-size-trait.h +58 -0
  32. data/vendor/v8/include/cppgc/persistent.h +40 -10
  33. data/vendor/v8/include/cppgc/platform.h +49 -25
  34. data/vendor/v8/include/cppgc/prefinalizer.h +1 -1
  35. data/vendor/v8/include/cppgc/process-heap-statistics.h +36 -0
  36. data/vendor/v8/include/cppgc/sentinel-pointer.h +32 -0
  37. data/vendor/v8/include/cppgc/source-location.h +2 -1
  38. data/vendor/v8/include/cppgc/testing.h +99 -0
  39. data/vendor/v8/include/cppgc/trace-trait.h +8 -3
  40. data/vendor/v8/include/cppgc/type-traits.h +157 -19
  41. data/vendor/v8/include/cppgc/visitor.h +194 -28
  42. data/vendor/v8/include/libplatform/libplatform.h +11 -0
  43. data/vendor/v8/include/libplatform/v8-tracing.h +2 -0
  44. data/vendor/v8/include/v8-cppgc.h +258 -159
  45. data/vendor/v8/include/v8-fast-api-calls.h +603 -155
  46. data/vendor/v8/include/v8-inspector.h +22 -4
  47. data/vendor/v8/include/v8-internal.h +111 -27
  48. data/vendor/v8/include/v8-metrics.h +77 -8
  49. data/vendor/v8/include/v8-platform.h +47 -22
  50. data/vendor/v8/include/v8-profiler.h +75 -11
  51. data/vendor/v8/include/v8-unwinder-state.h +30 -0
  52. data/vendor/v8/include/v8-util.h +1 -1
  53. data/vendor/v8/include/v8-version.h +4 -4
  54. data/vendor/v8/include/v8.h +1196 -642
  55. data/vendor/v8/include/v8config.h +87 -11
  56. metadata +17 -5
  57. data/vendor/v8/include/cppgc/internal/process-heap.h +0 -34
@@ -5,24 +5,30 @@
5
5
  #ifndef INCLUDE_CPPGC_VISITOR_H_
6
6
  #define INCLUDE_CPPGC_VISITOR_H_
7
7
 
8
+ #include "cppgc/custom-space.h"
9
+ #include "cppgc/ephemeron-pair.h"
8
10
  #include "cppgc/garbage-collected.h"
9
11
  #include "cppgc/internal/logging.h"
10
12
  #include "cppgc/internal/pointer-policies.h"
11
13
  #include "cppgc/liveness-broker.h"
12
14
  #include "cppgc/member.h"
15
+ #include "cppgc/sentinel-pointer.h"
13
16
  #include "cppgc/source-location.h"
14
17
  #include "cppgc/trace-trait.h"
18
+ #include "cppgc/type-traits.h"
15
19
 
16
20
  namespace cppgc {
17
21
 
18
22
  namespace internal {
23
+ template <typename T, typename WeaknessPolicy, typename LocationPolicy,
24
+ typename CheckingPolicy>
25
+ class BasicCrossThreadPersistent;
19
26
  template <typename T, typename WeaknessPolicy, typename LocationPolicy,
20
27
  typename CheckingPolicy>
21
28
  class BasicPersistent;
22
29
  class ConservativeTracingVisitor;
23
30
  class VisitorBase;
24
31
  class VisitorFactory;
25
-
26
32
  } // namespace internal
27
33
 
28
34
  using WeakCallback = void (*)(const LivenessBroker&, const void*);
@@ -44,7 +50,7 @@ using WeakCallback = void (*)(const LivenessBroker&, const void*);
44
50
  * };
45
51
  * \endcode
46
52
  */
47
- class Visitor {
53
+ class V8_EXPORT Visitor {
48
54
  public:
49
55
  class Key {
50
56
  private:
@@ -56,6 +62,22 @@ class Visitor {
56
62
 
57
63
  virtual ~Visitor() = default;
58
64
 
65
+ /**
66
+ * Trace method for raw pointers. Prefer the versions for managed pointers.
67
+ *
68
+ * \param member Reference retaining an object.
69
+ */
70
+ template <typename T>
71
+ void Trace(const T* t) {
72
+ static_assert(sizeof(T), "Pointee type must be fully defined.");
73
+ static_assert(internal::IsGarbageCollectedOrMixinType<T>::value,
74
+ "T must be GarbageCollected or GarbageCollectedMixin type");
75
+ if (!t) {
76
+ return;
77
+ }
78
+ Visit(t, TraceTrait<T>::GetTraceDescriptor(t));
79
+ }
80
+
59
81
  /**
60
82
  * Trace method for Member.
61
83
  *
@@ -76,8 +98,10 @@ class Visitor {
76
98
  template <typename T>
77
99
  void Trace(const WeakMember<T>& weak_member) {
78
100
  static_assert(sizeof(T), "Pointee type must be fully defined.");
79
- static_assert(internal::IsGarbageCollectedType<T>::value,
101
+ static_assert(internal::IsGarbageCollectedOrMixinType<T>::value,
80
102
  "T must be GarbageCollected or GarbageCollectedMixin type");
103
+ static_assert(!internal::IsAllocatedOnCompactableSpace<T>::value,
104
+ "Weak references to compactable objects are not allowed");
81
105
 
82
106
  const T* value = weak_member.GetRawAtomic();
83
107
 
@@ -86,8 +110,7 @@ class Visitor {
86
110
  return;
87
111
  }
88
112
 
89
- // TODO(chromium:1056170): DCHECK (or similar) for deleted values as they
90
- // should come in at a different path.
113
+ CPPGC_DCHECK(value != kSentinelPointer);
91
114
  VisitWeak(value, TraceTrait<T>::GetTraceDescriptor(value),
92
115
  &HandleWeak<WeakMember<T>>, &weak_member);
93
116
  }
@@ -121,6 +144,128 @@ class Visitor {
121
144
  RegisterWeakCallback(&WeakCallbackMethodDelegate<T, method>, object);
122
145
  }
123
146
 
147
+ /**
148
+ * Trace method for EphemeronPair.
149
+ *
150
+ * \param ephemeron_pair EphemeronPair reference weakly retaining a key object
151
+ * and strongly retaining a value object in case the key object is alive.
152
+ */
153
+ template <typename K, typename V>
154
+ void Trace(const EphemeronPair<K, V>& ephemeron_pair) {
155
+ TraceEphemeron(ephemeron_pair.key, &ephemeron_pair.value);
156
+ RegisterWeakCallbackMethod<EphemeronPair<K, V>,
157
+ &EphemeronPair<K, V>::ClearValueIfKeyIsDead>(
158
+ &ephemeron_pair);
159
+ }
160
+
161
+ /**
162
+ * Trace method for a single ephemeron. Used for tracing a raw ephemeron in
163
+ * which the `key` and `value` are kept separately.
164
+ *
165
+ * \param weak_member_key WeakMember reference weakly retaining a key object.
166
+ * \param member_value Member reference with ephemeron semantics.
167
+ */
168
+ template <typename KeyType, typename ValueType>
169
+ void TraceEphemeron(const WeakMember<KeyType>& weak_member_key,
170
+ const Member<ValueType>* member_value) {
171
+ const KeyType* key = weak_member_key.GetRawAtomic();
172
+ if (!key) return;
173
+
174
+ // `value` must always be non-null.
175
+ CPPGC_DCHECK(member_value);
176
+ const ValueType* value = member_value->GetRawAtomic();
177
+ if (!value) return;
178
+
179
+ // KeyType and ValueType may refer to GarbageCollectedMixin.
180
+ TraceDescriptor value_desc =
181
+ TraceTrait<ValueType>::GetTraceDescriptor(value);
182
+ CPPGC_DCHECK(value_desc.base_object_payload);
183
+ const void* key_base_object_payload =
184
+ TraceTrait<KeyType>::GetTraceDescriptor(key).base_object_payload;
185
+ CPPGC_DCHECK(key_base_object_payload);
186
+
187
+ VisitEphemeron(key_base_object_payload, value, value_desc);
188
+ }
189
+
190
+ /**
191
+ * Trace method for a single ephemeron. Used for tracing a raw ephemeron in
192
+ * which the `key` and `value` are kept separately. Note that this overload
193
+ * is for non-GarbageCollected `value`s that can be traced though.
194
+ *
195
+ * \param key `WeakMember` reference weakly retaining a key object.
196
+ * \param value Reference weakly retaining a value object. Note that
197
+ * `ValueType` here should not be `Member`. It is expected that
198
+ * `TraceTrait<ValueType>::GetTraceDescriptor(value)` returns a
199
+ * `TraceDescriptor` with a null base pointer but a valid trace method.
200
+ */
201
+ template <typename KeyType, typename ValueType>
202
+ void TraceEphemeron(const WeakMember<KeyType>& weak_member_key,
203
+ const ValueType* value) {
204
+ static_assert(!IsGarbageCollectedOrMixinTypeV<ValueType>,
205
+ "garbage-collected types must use WeakMember and Member");
206
+ const KeyType* key = weak_member_key.GetRawAtomic();
207
+ if (!key) return;
208
+
209
+ // `value` must always be non-null.
210
+ CPPGC_DCHECK(value);
211
+ TraceDescriptor value_desc =
212
+ TraceTrait<ValueType>::GetTraceDescriptor(value);
213
+ // `value_desc.base_object_payload` must be null as this override is only
214
+ // taken for non-garbage-collected values.
215
+ CPPGC_DCHECK(!value_desc.base_object_payload);
216
+
217
+ // KeyType might be a GarbageCollectedMixin.
218
+ const void* key_base_object_payload =
219
+ TraceTrait<KeyType>::GetTraceDescriptor(key).base_object_payload;
220
+ CPPGC_DCHECK(key_base_object_payload);
221
+
222
+ VisitEphemeron(key_base_object_payload, value, value_desc);
223
+ }
224
+
225
+ /**
226
+ * Trace method that strongifies a WeakMember.
227
+ *
228
+ * \param weak_member WeakMember reference retaining an object.
229
+ */
230
+ template <typename T>
231
+ void TraceStrongly(const WeakMember<T>& weak_member) {
232
+ const T* value = weak_member.GetRawAtomic();
233
+ CPPGC_DCHECK(value != kSentinelPointer);
234
+ Trace(value);
235
+ }
236
+
237
+ /**
238
+ * Trace method for weak containers.
239
+ *
240
+ * \param object reference of the weak container.
241
+ * \param callback to be invoked.
242
+ * \param data custom data that is passed to the callback.
243
+ */
244
+ template <typename T>
245
+ void TraceWeakContainer(const T* object, WeakCallback callback,
246
+ const void* data) {
247
+ if (!object) return;
248
+ VisitWeakContainer(object, TraceTrait<T>::GetTraceDescriptor(object),
249
+ TraceTrait<T>::GetWeakTraceDescriptor(object), callback,
250
+ data);
251
+ }
252
+
253
+ /**
254
+ * Registers a slot containing a reference to an object allocated on a
255
+ * compactable space. Such references maybe be arbitrarily moved by the GC.
256
+ *
257
+ * \param slot location of reference to object that might be moved by the GC.
258
+ */
259
+ template <typename T>
260
+ void RegisterMovableReference(const T** slot) {
261
+ static_assert(internal::IsAllocatedOnCompactableSpace<T>::value,
262
+ "Only references to objects allocated on compactable spaces "
263
+ "should be registered as movable slots.");
264
+ static_assert(!IsGarbageCollectedMixinTypeV<T>,
265
+ "Mixin types do not support compaction.");
266
+ HandleMovableReference(reinterpret_cast<const void**>(slot));
267
+ }
268
+
124
269
  /**
125
270
  * Registers a weak callback that is invoked during garbage collection.
126
271
  *
@@ -129,13 +274,38 @@ class Visitor {
129
274
  */
130
275
  virtual void RegisterWeakCallback(WeakCallback callback, const void* data) {}
131
276
 
277
+ /**
278
+ * Defers tracing an object from a concurrent thread to the mutator thread.
279
+ * Should be called by Trace methods of types that are not safe to trace
280
+ * concurrently.
281
+ *
282
+ * \param parameter tells the trace callback which object was deferred.
283
+ * \param callback to be invoked for tracing on the mutator thread.
284
+ * \param deferred_size size of deferred object.
285
+ *
286
+ * \returns false if the object does not need to be deferred (i.e. currently
287
+ * traced on the mutator thread) and true otherwise (i.e. currently traced on
288
+ * a concurrent thread).
289
+ */
290
+ virtual V8_WARN_UNUSED_RESULT bool DeferTraceToMutatorThreadIfConcurrent(
291
+ const void* parameter, TraceCallback callback, size_t deferred_size) {
292
+ // By default tracing is not deferred.
293
+ return false;
294
+ }
295
+
132
296
  protected:
133
297
  virtual void Visit(const void* self, TraceDescriptor) {}
134
298
  virtual void VisitWeak(const void* self, TraceDescriptor, WeakCallback,
135
299
  const void* weak_member) {}
136
- virtual void VisitRoot(const void*, TraceDescriptor) {}
300
+ virtual void VisitRoot(const void*, TraceDescriptor, const SourceLocation&) {}
137
301
  virtual void VisitWeakRoot(const void* self, TraceDescriptor, WeakCallback,
138
- const void* weak_root) {}
302
+ const void* weak_root, const SourceLocation&) {}
303
+ virtual void VisitEphemeron(const void* key, const void* value,
304
+ TraceDescriptor value_desc) {}
305
+ virtual void VisitWeakContainer(const void* self, TraceDescriptor strong_desc,
306
+ TraceDescriptor weak_desc,
307
+ WeakCallback callback, const void* data) {}
308
+ virtual void HandleMovableReference(const void**) {}
139
309
 
140
310
  private:
141
311
  template <typename T, void (T::*method)(const LivenessBroker&)>
@@ -149,10 +319,10 @@ class Visitor {
149
319
  template <typename PointerType>
150
320
  static void HandleWeak(const LivenessBroker& info, const void* object) {
151
321
  const PointerType* weak = static_cast<const PointerType*>(object);
322
+ auto* raw_ptr = weak->GetFromGC();
152
323
  // Sentinel values are preserved for weak pointers.
153
- if (*weak == kSentinelPointer) return;
154
- const auto* raw = weak->Get();
155
- if (!info.IsHeapObjectAlive(raw)) {
324
+ if (raw_ptr == kSentinelPointer) return;
325
+ if (!info.IsHeapObjectAlive(raw_ptr)) {
156
326
  weak->ClearFromGC();
157
327
  }
158
328
  }
@@ -163,13 +333,14 @@ class Visitor {
163
333
  using PointeeType = typename Persistent::PointeeType;
164
334
  static_assert(sizeof(PointeeType),
165
335
  "Persistent's pointee type must be fully defined");
166
- static_assert(internal::IsGarbageCollectedType<PointeeType>::value,
336
+ static_assert(internal::IsGarbageCollectedOrMixinType<PointeeType>::value,
167
337
  "Persistent's pointee type must be GarbageCollected or "
168
338
  "GarbageCollectedMixin");
169
- if (!p.Get()) {
339
+ auto* ptr = p.GetFromGC();
340
+ if (!ptr) {
170
341
  return;
171
342
  }
172
- VisitRoot(p.Get(), TraceTrait<PointeeType>::GetTraceDescriptor(p.Get()));
343
+ VisitRoot(ptr, TraceTrait<PointeeType>::GetTraceDescriptor(ptr), loc);
173
344
  }
174
345
 
175
346
  template <
@@ -179,28 +350,23 @@ class Visitor {
179
350
  using PointeeType = typename WeakPersistent::PointeeType;
180
351
  static_assert(sizeof(PointeeType),
181
352
  "Persistent's pointee type must be fully defined");
182
- static_assert(internal::IsGarbageCollectedType<PointeeType>::value,
353
+ static_assert(internal::IsGarbageCollectedOrMixinType<PointeeType>::value,
183
354
  "Persistent's pointee type must be GarbageCollected or "
184
355
  "GarbageCollectedMixin");
185
- VisitWeakRoot(p.Get(), TraceTrait<PointeeType>::GetTraceDescriptor(p.Get()),
186
- &HandleWeak<WeakPersistent>, &p);
187
- }
188
-
189
- template <typename T>
190
- void Trace(const T* t) {
191
- static_assert(sizeof(T), "Pointee type must be fully defined.");
192
- static_assert(internal::IsGarbageCollectedType<T>::value,
193
- "T must be GarbageCollected or GarbageCollectedMixin type");
194
- if (!t) {
195
- return;
196
- }
197
- Visit(t, TraceTrait<T>::GetTraceDescriptor(t));
356
+ static_assert(!internal::IsAllocatedOnCompactableSpace<PointeeType>::value,
357
+ "Weak references to compactable objects are not allowed");
358
+ auto* ptr = p.GetFromGC();
359
+ VisitWeakRoot(ptr, TraceTrait<PointeeType>::GetTraceDescriptor(ptr),
360
+ &HandleWeak<WeakPersistent>, &p, loc);
198
361
  }
199
362
 
200
363
  #if V8_ENABLE_CHECKS
201
- V8_EXPORT void CheckObjectNotInConstruction(const void* address);
364
+ void CheckObjectNotInConstruction(const void* address);
202
365
  #endif // V8_ENABLE_CHECKS
203
366
 
367
+ template <typename T, typename WeaknessPolicy, typename LocationPolicy,
368
+ typename CheckingPolicy>
369
+ friend class internal::BasicCrossThreadPersistent;
204
370
  template <typename T, typename WeaknessPolicy, typename LocationPolicy,
205
371
  typename CheckingPolicy>
206
372
  friend class internal::BasicPersistent;
@@ -43,6 +43,17 @@ V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform> NewDefaultPlatform(
43
43
  InProcessStackDumping::kDisabled,
44
44
  std::unique_ptr<v8::TracingController> tracing_controller = {});
45
45
 
46
+ /**
47
+ * The same as NewDefaultPlatform but disables the worker thread pool.
48
+ * It must be used with the --single-threaded V8 flag.
49
+ */
50
+ V8_PLATFORM_EXPORT std::unique_ptr<v8::Platform>
51
+ NewSingleThreadedDefaultPlatform(
52
+ IdleTaskSupport idle_task_support = IdleTaskSupport::kDisabled,
53
+ InProcessStackDumping in_process_stack_dumping =
54
+ InProcessStackDumping::kDisabled,
55
+ std::unique_ptr<v8::TracingController> tracing_controller = {});
56
+
46
57
  /**
47
58
  * Returns a new instance of the default v8::JobHandle implementation.
48
59
  *
@@ -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;