libv8-node 20.12.1.0-arm64-darwin → 22.5.1.0-arm64-darwin

Sign up to get free protection for your applications and to get access to all the features.
Files changed (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +3 -3
  3. data/vendor/v8/arm64-darwin/libv8/obj/libv8_monolith.a +0 -0
  4. data/vendor/v8/include/cppgc/internal/api-constants.h +24 -5
  5. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +16 -6
  6. data/vendor/v8/include/cppgc/internal/caged-heap.h +12 -5
  7. data/vendor/v8/include/cppgc/internal/gc-info.h +82 -91
  8. data/vendor/v8/include/cppgc/internal/member-storage.h +16 -8
  9. data/vendor/v8/include/cppgc/member.h +25 -0
  10. data/vendor/v8/include/cppgc/persistent.h +4 -0
  11. data/vendor/v8/include/cppgc/platform.h +6 -1
  12. data/vendor/v8/include/cppgc/sentinel-pointer.h +7 -0
  13. data/vendor/v8/include/cppgc/source-location.h +2 -78
  14. data/vendor/v8/include/cppgc/trace-trait.h +8 -0
  15. data/vendor/v8/include/cppgc/type-traits.h +25 -4
  16. data/vendor/v8/include/cppgc/visitor.h +82 -4
  17. data/vendor/v8/include/libplatform/libplatform.h +7 -1
  18. data/vendor/v8/include/v8-array-buffer.h +6 -0
  19. data/vendor/v8/include/v8-callbacks.h +57 -19
  20. data/vendor/v8/include/v8-container.h +54 -0
  21. data/vendor/v8/include/v8-context.h +58 -32
  22. data/vendor/v8/include/v8-embedder-heap.h +31 -3
  23. data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
  24. data/vendor/v8/include/v8-exception.h +15 -9
  25. data/vendor/v8/include/v8-fast-api-calls.h +58 -31
  26. data/vendor/v8/include/v8-forward.h +1 -0
  27. data/vendor/v8/include/v8-function-callback.h +135 -30
  28. data/vendor/v8/include/v8-function.h +6 -0
  29. data/vendor/v8/include/v8-handle-base.h +137 -0
  30. data/vendor/v8/include/v8-inspector.h +35 -13
  31. data/vendor/v8/include/v8-internal.h +510 -71
  32. data/vendor/v8/include/v8-isolate.h +176 -100
  33. data/vendor/v8/include/v8-local-handle.h +383 -112
  34. data/vendor/v8/include/v8-memory-span.h +157 -2
  35. data/vendor/v8/include/v8-message.h +22 -3
  36. data/vendor/v8/include/v8-metrics.h +1 -0
  37. data/vendor/v8/include/v8-object.h +98 -77
  38. data/vendor/v8/include/v8-persistent-handle.h +68 -90
  39. data/vendor/v8/include/v8-platform.h +191 -23
  40. data/vendor/v8/include/v8-primitive.h +12 -8
  41. data/vendor/v8/include/v8-profiler.h +16 -2
  42. data/vendor/v8/include/v8-script.h +88 -14
  43. data/vendor/v8/include/v8-snapshot.h +96 -22
  44. data/vendor/v8/include/v8-source-location.h +92 -0
  45. data/vendor/v8/include/v8-statistics.h +31 -10
  46. data/vendor/v8/include/v8-template.h +410 -131
  47. data/vendor/v8/include/v8-traced-handle.h +108 -90
  48. data/vendor/v8/include/v8-typed-array.h +115 -7
  49. data/vendor/v8/include/v8-unwinder.h +1 -1
  50. data/vendor/v8/include/v8-util.h +23 -20
  51. data/vendor/v8/include/v8-value-serializer.h +14 -0
  52. data/vendor/v8/include/v8-value.h +105 -3
  53. data/vendor/v8/include/v8-version.h +4 -4
  54. data/vendor/v8/include/v8config.h +54 -20
  55. metadata +5 -3
@@ -182,7 +182,7 @@ class PersistentValueMapBase {
182
182
  */
183
183
  Local<V> Get(const K& key) {
184
184
  V* p = FromVal(Traits::Get(&impl_, key));
185
- #ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
185
+ #ifdef V8_ENABLE_DIRECT_LOCAL
186
186
  if (p == nullptr) return Local<V>();
187
187
  #endif
188
188
  return Local<V>::New(isolate_, p);
@@ -240,8 +240,9 @@ class PersistentValueMapBase {
240
240
  : value_(other.value_) { }
241
241
 
242
242
  Local<V> NewLocal(Isolate* isolate) const {
243
- return Local<V>::New(
244
- isolate, internal::ValueHelper::SlotAsValue<V>(FromVal(value_)));
243
+ return Local<V>::New(isolate,
244
+ internal::ValueHelper::SlotAsValue<V>(
245
+ reinterpret_cast<internal::Address*>(value_)));
245
246
  }
246
247
  bool IsEmpty() const {
247
248
  return value_ == kPersistentContainerNotFound;
@@ -298,17 +299,18 @@ class PersistentValueMapBase {
298
299
  typename Traits::Impl* impl() { return &impl_; }
299
300
 
300
301
  static V* FromVal(PersistentContainerValue v) {
301
- return reinterpret_cast<V*>(v);
302
+ return internal::ValueHelper::SlotAsValue<V>(
303
+ reinterpret_cast<internal::Address*>(v));
302
304
  }
303
305
 
304
306
  static PersistentContainerValue ClearAndLeak(Global<V>* persistent) {
305
- V* v = persistent->val_;
306
- persistent->val_ = nullptr;
307
- return reinterpret_cast<PersistentContainerValue>(v);
307
+ internal::Address* address = persistent->slot();
308
+ persistent->Clear();
309
+ return reinterpret_cast<PersistentContainerValue>(address);
308
310
  }
309
311
 
310
312
  static PersistentContainerValue Leak(Global<V>* persistent) {
311
- return reinterpret_cast<PersistentContainerValue>(persistent->val_);
313
+ return reinterpret_cast<PersistentContainerValue>(persistent->slot());
312
314
  }
313
315
 
314
316
  /**
@@ -318,7 +320,7 @@ class PersistentValueMapBase {
318
320
  */
319
321
  static Global<V> Release(PersistentContainerValue v) {
320
322
  Global<V> p;
321
- p.val_ = FromVal(v);
323
+ p.slot() = reinterpret_cast<internal::Address*>(v);
322
324
  if (Traits::kCallbackType != kNotWeak && p.IsWeak()) {
323
325
  Traits::DisposeCallbackData(
324
326
  p.template ClearWeak<typename Traits::WeakCallbackDataType>());
@@ -328,7 +330,8 @@ class PersistentValueMapBase {
328
330
 
329
331
  void RemoveWeak(const K& key) {
330
332
  Global<V> p;
331
- p.val_ = FromVal(Traits::Remove(&impl_, key));
333
+ p.slot() =
334
+ reinterpret_cast<internal::Address*>(Traits::Remove(&impl_, key));
332
335
  p.Reset();
333
336
  }
334
337
 
@@ -344,8 +347,7 @@ class PersistentValueMapBase {
344
347
  PersistentContainerValue value) {
345
348
  bool hasValue = value != kPersistentContainerNotFound;
346
349
  if (hasValue) {
347
- returnValue->SetInternal(
348
- *reinterpret_cast<internal::Address*>(FromVal(value)));
350
+ returnValue->SetInternal(*reinterpret_cast<internal::Address*>(value));
349
351
  }
350
352
  return hasValue;
351
353
  }
@@ -396,7 +398,7 @@ class PersistentValueMap : public PersistentValueMapBase<K, V, Traits> {
396
398
  Traits::kCallbackType == kWeakWithInternalFields
397
399
  ? WeakCallbackType::kInternalFields
398
400
  : WeakCallbackType::kParameter;
399
- Local<V> value(Local<V>::New(this->isolate(), *persistent));
401
+ auto value = Local<V>::New(this->isolate(), *persistent);
400
402
  persistent->template SetWeak<typename Traits::WeakCallbackDataType>(
401
403
  Traits::WeakCallbackParameter(this, key, value), WeakCallback,
402
404
  callback_type);
@@ -472,7 +474,7 @@ class GlobalValueMap : public PersistentValueMapBase<K, V, Traits> {
472
474
  Traits::kCallbackType == kWeakWithInternalFields
473
475
  ? WeakCallbackType::kInternalFields
474
476
  : WeakCallbackType::kParameter;
475
- Local<V> value(Local<V>::New(this->isolate(), *persistent));
477
+ auto value = Local<V>::New(this->isolate(), *persistent);
476
478
  persistent->template SetWeak<typename Traits::WeakCallbackDataType>(
477
479
  Traits::WeakCallbackParameter(this, key, value), OnWeakCallback,
478
480
  callback_type);
@@ -619,7 +621,7 @@ class V8_DEPRECATE_SOON("Use std::vector<Global<V>>.") PersistentValueVector {
619
621
  */
620
622
  Local<V> Get(size_t index) const {
621
623
  return Local<V>::New(isolate_, internal::ValueHelper::SlotAsValue<V>(
622
- FromVal(Traits::Get(&impl_, index))));
624
+ Traits::Get(&impl_, index)));
623
625
  }
624
626
 
625
627
  /**
@@ -629,7 +631,7 @@ class V8_DEPRECATE_SOON("Use std::vector<Global<V>>.") PersistentValueVector {
629
631
  size_t length = Traits::Size(&impl_);
630
632
  for (size_t i = 0; i < length; i++) {
631
633
  Global<V> p;
632
- p.val_ = FromVal(Traits::Get(&impl_, i));
634
+ p.slot() = reinterpret_cast<internal::Address>(Traits::Get(&impl_, i));
633
635
  }
634
636
  Traits::Clear(&impl_);
635
637
  }
@@ -644,13 +646,14 @@ class V8_DEPRECATE_SOON("Use std::vector<Global<V>>.") PersistentValueVector {
644
646
 
645
647
  private:
646
648
  static PersistentContainerValue ClearAndLeak(Global<V>* persistent) {
647
- V* v = persistent->val_;
648
- persistent->val_ = nullptr;
649
- return reinterpret_cast<PersistentContainerValue>(v);
649
+ auto slot = persistent->slot();
650
+ persistent->Clear();
651
+ return reinterpret_cast<PersistentContainerValue>(slot);
650
652
  }
651
653
 
652
654
  static V* FromVal(PersistentContainerValue v) {
653
- return reinterpret_cast<V*>(v);
655
+ return internal::ValueHelper::SlotAsValue<V>(
656
+ reinterpret_cast<internal::Address*>(v));
654
657
  }
655
658
 
656
659
  Isolate* isolate_;
@@ -75,6 +75,20 @@ class V8_EXPORT ValueSerializer {
75
75
  */
76
76
  virtual void ThrowDataCloneError(Local<String> message) = 0;
77
77
 
78
+ /**
79
+ * The embedder overrides this method to enable custom host object filter
80
+ * with Delegate::IsHostObject.
81
+ *
82
+ * This method is called at most once per serializer.
83
+ */
84
+ virtual bool HasCustomHostObject(Isolate* isolate);
85
+
86
+ /**
87
+ * The embedder overrides this method to determine if an JS object is a
88
+ * host object and needs to be serialized by the host.
89
+ */
90
+ virtual Maybe<bool> IsHostObject(Isolate* isolate, Local<Object> object);
91
+
78
92
  /**
79
93
  * The embedder overrides this method to write some kind of host object, if
80
94
  * possible. If not, a suitable exception should be thrown and
@@ -16,6 +16,8 @@
16
16
  */
17
17
  namespace v8 {
18
18
 
19
+ class Primitive;
20
+ class Numeric;
19
21
  class BigInt;
20
22
  class Int32;
21
23
  class Integer;
@@ -61,7 +63,7 @@ class V8_EXPORT Value : public Data {
61
63
  * conversion to boolean, i.e. the result of `Boolean(value)` in JS, whereas
62
64
  * this checks `value === true`.
63
65
  */
64
- bool IsTrue() const;
66
+ V8_INLINE bool IsTrue() const;
65
67
 
66
68
  /**
67
69
  * Returns true if this value is false.
@@ -70,7 +72,7 @@ class V8_EXPORT Value : public Data {
70
72
  * conversion to boolean, i.e. the result of `!Boolean(value)` in JS, whereas
71
73
  * this checks `value === false`.
72
74
  */
73
- bool IsFalse() const;
75
+ V8_INLINE bool IsFalse() const;
74
76
 
75
77
  /**
76
78
  * Returns true if this value is a symbol or a string.
@@ -299,6 +301,11 @@ class V8_EXPORT Value : public Data {
299
301
  */
300
302
  bool IsInt32Array() const;
301
303
 
304
+ /**
305
+ * Returns true if this value is a Float16Array.
306
+ */
307
+ bool IsFloat16Array() const;
308
+
302
309
  /**
303
310
  * Returns true if this value is a Float32Array.
304
311
  */
@@ -354,6 +361,18 @@ class V8_EXPORT Value : public Data {
354
361
  */
355
362
  bool IsModuleNamespaceObject() const;
356
363
 
364
+ /**
365
+ * Perform `ToPrimitive(value)` as specified in:
366
+ * https://tc39.es/ecma262/#sec-toprimitive.
367
+ */
368
+ V8_WARN_UNUSED_RESULT MaybeLocal<Primitive> ToPrimitive(
369
+ Local<Context> context) const;
370
+ /**
371
+ * Perform `ToNumeric(value)` as specified in:
372
+ * https://tc39.es/ecma262/#sec-tonumeric.
373
+ */
374
+ V8_WARN_UNUSED_RESULT MaybeLocal<Numeric> ToNumeric(
375
+ Local<Context> context) const;
357
376
  /**
358
377
  * Perform the equivalent of `BigInt(value)` in JS.
359
378
  */
@@ -377,7 +396,7 @@ class V8_EXPORT Value : public Data {
377
396
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToDetailString(
378
397
  Local<Context> context) const;
379
398
  /**
380
- * Perform the equivalent of `Object(value)` in JS.
399
+ * Perform the equivalent of `Tagged<Object>(value)` in JS.
381
400
  */
382
401
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
383
402
  Local<Context> context) const;
@@ -447,14 +466,55 @@ class V8_EXPORT Value : public Data {
447
466
  V8_INLINE bool QuickIsUndefined() const;
448
467
  V8_INLINE bool QuickIsNull() const;
449
468
  V8_INLINE bool QuickIsNullOrUndefined() const;
469
+ #if V8_STATIC_ROOTS_BOOL
470
+ V8_INLINE bool QuickIsTrue() const;
471
+ V8_INLINE bool QuickIsFalse() const;
472
+ #endif // V8_STATIC_ROOTS_BOOL
450
473
  V8_INLINE bool QuickIsString() const;
451
474
  bool FullIsUndefined() const;
452
475
  bool FullIsNull() const;
476
+ bool FullIsTrue() const;
477
+ bool FullIsFalse() const;
453
478
  bool FullIsString() const;
454
479
 
455
480
  static void CheckCast(Data* that);
456
481
  };
457
482
 
483
+ /**
484
+ * Can be used to avoid repeated expensive type checks for groups of objects
485
+ * that are expected to be similar (e.g. when Blink converts a bunch of
486
+ * JavaScript objects to "ScriptWrappable" after a "HasInstance" check) by
487
+ * making use of V8-internal "hidden classes". An object that has passed the
488
+ * full check can be remembered via {Update}; further objects can be queried
489
+ * using {Matches}.
490
+ * Note that the answer will be conservative/"best-effort": when {Matches}
491
+ * returns true, then the {candidate} can be relied upon to have the same
492
+ * shape/constructor/prototype/etc. as the {baseline}. Otherwise, no reliable
493
+ * statement can be made (the objects might still have indistinguishable shapes
494
+ * for all intents and purposes, but this mechanism, being optimized for speed,
495
+ * couldn't determine that quickly).
496
+ */
497
+ class V8_EXPORT TypecheckWitness {
498
+ public:
499
+ explicit TypecheckWitness(Isolate* isolate);
500
+
501
+ /**
502
+ * Checks whether {candidate} can cheaply be identified as being "similar"
503
+ * to the {baseline} that was passed to {Update} earlier.
504
+ * It's safe to call this on an uninitialized {TypecheckWitness} instance:
505
+ * it will then return {false} for any input.
506
+ */
507
+ V8_INLINE bool Matches(Local<Value> candidate) const;
508
+
509
+ /**
510
+ * Remembers a new baseline for future {Matches} queries.
511
+ */
512
+ void Update(Local<Value> baseline);
513
+
514
+ private:
515
+ Local<Data> cached_map_;
516
+ };
517
+
458
518
  template <>
459
519
  V8_INLINE Value* Value::Cast(Data* value) {
460
520
  #ifdef V8_ENABLE_CHECKS
@@ -527,6 +587,40 @@ bool Value::QuickIsNullOrUndefined() const {
527
587
  #endif // V8_STATIC_ROOTS_BOOL
528
588
  }
529
589
 
590
+ bool Value::IsTrue() const {
591
+ #if V8_STATIC_ROOTS_BOOL && !defined(V8_ENABLE_CHECKS)
592
+ return QuickIsTrue();
593
+ #else
594
+ return FullIsTrue();
595
+ #endif
596
+ }
597
+
598
+ #if V8_STATIC_ROOTS_BOOL
599
+ bool Value::QuickIsTrue() const {
600
+ using A = internal::Address;
601
+ using I = internal::Internals;
602
+ A obj = internal::ValueHelper::ValueAsAddress(this);
603
+ return I::is_identical(obj, I::StaticReadOnlyRoot::kTrueValue);
604
+ }
605
+ #endif // V8_STATIC_ROOTS_BOOL
606
+
607
+ bool Value::IsFalse() const {
608
+ #if V8_STATIC_ROOTS_BOOL && !defined(V8_ENABLE_CHECKS)
609
+ return QuickIsFalse();
610
+ #else
611
+ return FullIsFalse();
612
+ #endif
613
+ }
614
+
615
+ #if V8_STATIC_ROOTS_BOOL
616
+ bool Value::QuickIsFalse() const {
617
+ using A = internal::Address;
618
+ using I = internal::Internals;
619
+ A obj = internal::ValueHelper::ValueAsAddress(this);
620
+ return I::is_identical(obj, I::StaticReadOnlyRoot::kFalseValue);
621
+ }
622
+ #endif // V8_STATIC_ROOTS_BOOL
623
+
530
624
  bool Value::IsString() const {
531
625
  #ifdef V8_ENABLE_CHECKS
532
626
  return FullIsString();
@@ -548,6 +642,14 @@ bool Value::QuickIsString() const {
548
642
  #endif // V8_STATIC_ROOTS_BOOL
549
643
  }
550
644
 
645
+ bool TypecheckWitness::Matches(Local<Value> candidate) const {
646
+ internal::Address obj = internal::ValueHelper::ValueAsAddress(*candidate);
647
+ internal::Address obj_map = internal::Internals::LoadMap(obj);
648
+ internal::Address cached =
649
+ internal::ValueHelper::ValueAsAddress(*cached_map_);
650
+ return obj_map == cached;
651
+ }
652
+
551
653
  } // namespace v8
552
654
 
553
655
  #endif // INCLUDE_V8_VALUE_H_
@@ -8,10 +8,10 @@
8
8
  // These macros define the version number for the current version.
9
9
  // NOTE these macros are used by some of the tool scripts and the build
10
10
  // system so their names cannot be changed without changing the scripts.
11
- #define V8_MAJOR_VERSION 11
12
- #define V8_MINOR_VERSION 3
13
- #define V8_BUILD_NUMBER 244
14
- #define V8_PATCH_LEVEL 8
11
+ #define V8_MAJOR_VERSION 12
12
+ #define V8_MINOR_VERSION 4
13
+ #define V8_BUILD_NUMBER 254
14
+ #define V8_PATCH_LEVEL 21
15
15
 
16
16
  // Use 1 for candidates and 0 otherwise.
17
17
  // (Boolean macro values are not supported by all preprocessors.)
@@ -13,6 +13,7 @@ path. Add it with -I<path> to the command line
13
13
  #include "v8-gn.h" // NOLINT(build/include_directory)
14
14
  #endif
15
15
 
16
+ #include <memory>
16
17
  // clang-format off
17
18
 
18
19
  // Platform headers for feature detection below.
@@ -297,12 +298,16 @@ path. Add it with -I<path> to the command line
297
298
  // V8_HAS_ATTRIBUTE_NONNULL - __attribute__((nonnull)) supported
298
299
  // V8_HAS_ATTRIBUTE_NOINLINE - __attribute__((noinline)) supported
299
300
  // V8_HAS_ATTRIBUTE_UNUSED - __attribute__((unused)) supported
301
+ // V8_HAS_ATTRIBUTE_USED - __attribute__((used)) supported
302
+ // V8_HAS_ATTRIBUTE_RETAIN - __attribute__((retain)) supported
300
303
  // V8_HAS_ATTRIBUTE_VISIBILITY - __attribute__((visibility)) supported
301
304
  // V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT - __attribute__((warn_unused_result))
302
305
  // supported
303
306
  // V8_HAS_CPP_ATTRIBUTE_NODISCARD - [[nodiscard]] supported
304
307
  // V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS
305
308
  // - [[no_unique_address]] supported
309
+ // V8_HAS_BUILTIN_ADD_OVERFLOW - __builtin_add_overflow() supported
310
+ // V8_HAS_BUILTIN_BIT_CAST - __builtin_bit_cast() supported
306
311
  // V8_HAS_BUILTIN_BSWAP16 - __builtin_bswap16() supported
307
312
  // V8_HAS_BUILTIN_BSWAP32 - __builtin_bswap32() supported
308
313
  // V8_HAS_BUILTIN_BSWAP64 - __builtin_bswap64() supported
@@ -310,14 +315,13 @@ path. Add it with -I<path> to the command line
310
315
  // V8_HAS_BUILTIN_CTZ - __builtin_ctz() supported
311
316
  // V8_HAS_BUILTIN_EXPECT - __builtin_expect() supported
312
317
  // V8_HAS_BUILTIN_FRAME_ADDRESS - __builtin_frame_address() supported
313
- // V8_HAS_BUILTIN_POPCOUNT - __builtin_popcount() supported
314
- // V8_HAS_BUILTIN_ADD_OVERFLOW - __builtin_add_overflow() supported
315
- // V8_HAS_BUILTIN_SUB_OVERFLOW - __builtin_sub_overflow() supported
316
318
  // V8_HAS_BUILTIN_MUL_OVERFLOW - __builtin_mul_overflow() supported
319
+ // V8_HAS_BUILTIN_POPCOUNT - __builtin_popcount() supported
317
320
  // V8_HAS_BUILTIN_SADD_OVERFLOW - __builtin_sadd_overflow() supported
321
+ // V8_HAS_BUILTIN_SMUL_OVERFLOW - __builtin_smul_overflow() supported
318
322
  // V8_HAS_BUILTIN_SSUB_OVERFLOW - __builtin_ssub_overflow() supported
323
+ // V8_HAS_BUILTIN_SUB_OVERFLOW - __builtin_sub_overflow() supported
319
324
  // V8_HAS_BUILTIN_UADD_OVERFLOW - __builtin_uadd_overflow() supported
320
- // V8_HAS_BUILTIN_SMUL_OVERFLOW - __builtin_smul_overflow() supported
321
325
  // V8_HAS_COMPUTED_GOTO - computed goto/labels as values
322
326
  // supported
323
327
  // V8_HAS_DECLSPEC_NOINLINE - __declspec(noinline) supported
@@ -349,6 +353,8 @@ path. Add it with -I<path> to the command line
349
353
  # define V8_HAS_ATTRIBUTE_NONNULL (__has_attribute(nonnull))
350
354
  # define V8_HAS_ATTRIBUTE_NOINLINE (__has_attribute(noinline))
351
355
  # define V8_HAS_ATTRIBUTE_UNUSED (__has_attribute(unused))
356
+ # define V8_HAS_ATTRIBUTE_USED (__has_attribute(used))
357
+ # define V8_HAS_ATTRIBUTE_RETAIN (__has_attribute(retain))
352
358
  // Support for the "preserve_most" attribute is limited:
353
359
  // - 32-bit platforms do not implement it,
354
360
  // - component builds fail because _dl_runtime_resolve clobbers registers,
@@ -367,13 +373,16 @@ path. Add it with -I<path> to the command line
367
373
  # define V8_HAS_ATTRIBUTE_VISIBILITY (__has_attribute(visibility))
368
374
  # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT \
369
375
  (__has_attribute(warn_unused_result))
376
+ # define V8_HAS_ATTRIBUTE_WEAK (__has_attribute(weak))
370
377
 
371
378
  # define V8_HAS_CPP_ATTRIBUTE_NODISCARD (V8_HAS_CPP_ATTRIBUTE(nodiscard))
372
379
  # define V8_HAS_CPP_ATTRIBUTE_NO_UNIQUE_ADDRESS \
373
380
  (V8_HAS_CPP_ATTRIBUTE(no_unique_address))
374
381
 
382
+ # define V8_HAS_BUILTIN_ADD_OVERFLOW (__has_builtin(__builtin_add_overflow))
375
383
  # define V8_HAS_BUILTIN_ASSUME (__has_builtin(__builtin_assume))
376
384
  # define V8_HAS_BUILTIN_ASSUME_ALIGNED (__has_builtin(__builtin_assume_aligned))
385
+ # define V8_HAS_BUILTIN_BIT_CAST (__has_builtin(__builtin_bit_cast))
377
386
  # define V8_HAS_BUILTIN_BSWAP16 (__has_builtin(__builtin_bswap16))
378
387
  # define V8_HAS_BUILTIN_BSWAP32 (__has_builtin(__builtin_bswap32))
379
388
  # define V8_HAS_BUILTIN_BSWAP64 (__has_builtin(__builtin_bswap64))
@@ -381,14 +390,13 @@ path. Add it with -I<path> to the command line
381
390
  # define V8_HAS_BUILTIN_CTZ (__has_builtin(__builtin_ctz))
382
391
  # define V8_HAS_BUILTIN_EXPECT (__has_builtin(__builtin_expect))
383
392
  # define V8_HAS_BUILTIN_FRAME_ADDRESS (__has_builtin(__builtin_frame_address))
384
- # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
385
- # define V8_HAS_BUILTIN_ADD_OVERFLOW (__has_builtin(__builtin_add_overflow))
386
- # define V8_HAS_BUILTIN_SUB_OVERFLOW (__has_builtin(__builtin_sub_overflow))
387
393
  # define V8_HAS_BUILTIN_MUL_OVERFLOW (__has_builtin(__builtin_mul_overflow))
394
+ # define V8_HAS_BUILTIN_POPCOUNT (__has_builtin(__builtin_popcount))
388
395
  # define V8_HAS_BUILTIN_SADD_OVERFLOW (__has_builtin(__builtin_sadd_overflow))
396
+ # define V8_HAS_BUILTIN_SMUL_OVERFLOW (__has_builtin(__builtin_smul_overflow))
389
397
  # define V8_HAS_BUILTIN_SSUB_OVERFLOW (__has_builtin(__builtin_ssub_overflow))
398
+ # define V8_HAS_BUILTIN_SUB_OVERFLOW (__has_builtin(__builtin_sub_overflow))
390
399
  # define V8_HAS_BUILTIN_UADD_OVERFLOW (__has_builtin(__builtin_uadd_overflow))
391
- # define V8_HAS_BUILTIN_SMUL_OVERFLOW (__has_builtin(__builtin_smul_overflow))
392
400
  # define V8_HAS_BUILTIN_UNREACHABLE (__has_builtin(__builtin_unreachable))
393
401
 
394
402
  // Clang has no __has_feature for computed gotos.
@@ -409,6 +417,11 @@ path. Add it with -I<path> to the command line
409
417
  # endif
410
418
  # define V8_CC_MINGW (V8_CC_MINGW32 || V8_CC_MINGW64)
411
419
 
420
+ // FYI: __has_builtin is only available with GCC 10 and later, so explicitly
421
+ // check GCC version numbers to enable features. TODO(leszeks): Merge feature
422
+ // enabling for GCC 10 and later into the Clang section above, and leave this
423
+ // section for GCC 9 and earlier.
424
+
412
425
  // always_inline is available in gcc 4.0 but not very reliable until 4.4.
413
426
  // Works around "sorry, unimplemented: inlining failed" build errors with
414
427
  // older compilers.
@@ -417,12 +430,16 @@ path. Add it with -I<path> to the command line
417
430
  # define V8_HAS_ATTRIBUTE_UNUSED 1
418
431
  # define V8_HAS_ATTRIBUTE_VISIBILITY 1
419
432
  # define V8_HAS_ATTRIBUTE_WARN_UNUSED_RESULT (!V8_CC_INTEL)
433
+ # define V8_HAS_ATTRIBUTE_WEAK 1
420
434
 
421
435
  // [[nodiscard]] does not work together with with
422
436
  // __attribute__((visibility(""))) on GCC 7.4 which is why there is no define
423
437
  // for V8_HAS_CPP_ATTRIBUTE_NODISCARD. See https://crbug.com/v8/11707.
424
438
 
425
439
  # define V8_HAS_BUILTIN_ASSUME_ALIGNED 1
440
+ # if __GNUC__ >= 11
441
+ # define V8_HAS_BUILTIN_BIT_CAST 1
442
+ # endif
426
443
  # define V8_HAS_BUILTIN_CLZ 1
427
444
  # define V8_HAS_BUILTIN_CTZ 1
428
445
  # define V8_HAS_BUILTIN_EXPECT 1
@@ -462,24 +479,29 @@ path. Add it with -I<path> to the command line
462
479
 
463
480
  #ifdef DEBUG
464
481
  // In debug mode, check assumptions instead of actually adding annotations.
465
- # define V8_ASSUME(condition) DCHECK(condition)
482
+ # define V8_ASSUME DCHECK
466
483
  #elif V8_HAS_BUILTIN_ASSUME
467
- # define V8_ASSUME(condition) __builtin_assume(condition)
484
+ # define V8_ASSUME __builtin_assume
468
485
  #elif V8_HAS_BUILTIN_UNREACHABLE
469
- # define V8_ASSUME(condition) \
470
- do { if (!(condition)) __builtin_unreachable(); } while (false)
486
+ # define V8_ASSUME(condition) \
487
+ do { \
488
+ if (!(condition)) __builtin_unreachable(); \
489
+ } while (false)
471
490
  #else
472
- # define V8_ASSUME(condition)
491
+ # define V8_ASSUME USE
473
492
  #endif
474
493
 
475
- #if V8_HAS_BUILTIN_ASSUME_ALIGNED
494
+ // Prefer c++20 std::assume_aligned
495
+ #if __cplusplus >= 202002L && defined(__cpp_lib_assume_aligned)
496
+ # define V8_ASSUME_ALIGNED(ptr, alignment) \
497
+ std::assume_aligned<(alignment)>(ptr)
498
+ #elif V8_HAS_BUILTIN_ASSUME_ALIGNED
476
499
  # define V8_ASSUME_ALIGNED(ptr, alignment) \
477
500
  __builtin_assume_aligned((ptr), (alignment))
478
501
  #else
479
502
  # define V8_ASSUME_ALIGNED(ptr, alignment) (ptr)
480
503
  #endif
481
504
 
482
-
483
505
  // A macro to mark functions whose values don't change (e.g. across calls)
484
506
  // and thereby compiler is free to hoist and fold multiple calls together.
485
507
  // Use like:
@@ -525,9 +547,6 @@ path. Add it with -I<path> to the command line
525
547
  // A macro used to change the calling conventions to preserve all registers (no
526
548
  // caller-saved registers). Use this for cold functions called from hot
527
549
  // functions.
528
- // Note: The attribute is considered experimental, so apply with care. Also,
529
- // "preserve_most" is currently not handling the return value correctly, so only
530
- // use it for functions returning void (see https://reviews.llvm.org/D141020).
531
550
  // Use like:
532
551
  // V8_NOINLINE V8_PRESERVE_MOST void UnlikelyMethod();
533
552
  #if V8_HAS_ATTRIBUTE_PRESERVE_MOST
@@ -610,6 +629,14 @@ path. Add it with -I<path> to the command line
610
629
  #endif
611
630
 
612
631
 
632
+ // Annotate functions/variables as weak to allow overriding the symbol.
633
+ #if V8_HAS_ATTRIBUTE_WEAK
634
+ #define V8_WEAK __attribute__((weak))
635
+ #else
636
+ #define V8_WEAK /* NOT SUPPORTED */
637
+ #endif
638
+
639
+
613
640
  // Annotate a class or constructor indicating the caller must assign the
614
641
  // constructed instances.
615
642
  // Apply to the whole class like:
@@ -669,10 +696,12 @@ path. Add it with -I<path> to the command line
669
696
  #if defined(__clang__) && defined(__has_attribute)
670
697
  #if __has_attribute(trivial_abi)
671
698
  #define V8_TRIVIAL_ABI [[clang::trivial_abi]]
699
+ #define V8_HAS_ATTRIBUTE_TRIVIAL_ABI 1
672
700
  #endif // __has_attribute(trivial_abi)
673
701
  #endif // defined(__clang__) && defined(__has_attribute)
674
702
  #if !defined(V8_TRIVIAL_ABI)
675
703
  #define V8_TRIVIAL_ABI
704
+ #define V8_HAS_ATTRIBUTE_TRIVIAL_ABI 0
676
705
  #endif //!defined(V8_TRIVIAL_ABI)
677
706
 
678
707
  // Helper macro to define no_sanitize attributes only with clang.
@@ -685,6 +714,11 @@ path. Add it with -I<path> to the command line
685
714
  #define V8_CLANG_NO_SANITIZE(what)
686
715
  #endif
687
716
 
717
+ // Exposing private symbols requires exposing public symbols too.
718
+ #ifdef BUILDING_V8_SHARED_PRIVATE
719
+ #define BUILDING_V8_SHARED
720
+ #endif
721
+
688
722
  #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
689
723
  #error Inconsistent build configuration: To build the V8 shared library \
690
724
  set BUILDING_V8_SHARED, to include its headers for linking against the \
@@ -749,7 +783,7 @@ V8 shared library set USING_V8_SHARED.
749
783
  #elif defined(__mips64)
750
784
  #define V8_HOST_ARCH_MIPS64 1
751
785
  #define V8_HOST_ARCH_64_BIT 1
752
- #elif defined(__loongarch64)
786
+ #elif defined(__loongarch_lp64)
753
787
  #define V8_HOST_ARCH_LOONG64 1
754
788
  #define V8_HOST_ARCH_64_BIT 1
755
789
  #elif defined(__PPC64__) || defined(_ARCH_PPC64)
@@ -799,7 +833,7 @@ V8 shared library set USING_V8_SHARED.
799
833
  #define V8_TARGET_ARCH_ARM 1
800
834
  #elif defined(__mips64)
801
835
  #define V8_TARGET_ARCH_MIPS64 1
802
- #elif defined(__loongarch64)
836
+ #elif defined(__loongarch_lp64)
803
837
  #define V8_TARGET_ARCH_LOONG64 1
804
838
  #elif defined(_ARCH_PPC64)
805
839
  #define V8_TARGET_ARCH_PPC64 1
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: libv8-node
3
3
  version: !ruby/object:Gem::Version
4
- version: 20.12.1.0
4
+ version: 22.5.1.0
5
5
  platform: arm64-darwin
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-04-05 00:00:00.000000000 Z
11
+ date: 2024-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
@@ -114,6 +114,7 @@ files:
114
114
  - vendor/v8/include/v8-forward.h
115
115
  - vendor/v8/include/v8-function-callback.h
116
116
  - vendor/v8/include/v8-function.h
117
+ - vendor/v8/include/v8-handle-base.h
117
118
  - vendor/v8/include/v8-initialization.h
118
119
  - vendor/v8/include/v8-inspector-protocol.h
119
120
  - vendor/v8/include/v8-inspector.h
@@ -139,6 +140,7 @@ files:
139
140
  - vendor/v8/include/v8-regexp.h
140
141
  - vendor/v8/include/v8-script.h
141
142
  - vendor/v8/include/v8-snapshot.h
143
+ - vendor/v8/include/v8-source-location.h
142
144
  - vendor/v8/include/v8-statistics.h
143
145
  - vendor/v8/include/v8-template.h
144
146
  - vendor/v8/include/v8-traced-handle.h
@@ -177,7 +179,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
177
179
  - !ruby/object:Gem::Version
178
180
  version: '0'
179
181
  requirements: []
180
- rubygems_version: 3.4.22
182
+ rubygems_version: 3.5.9
181
183
  signing_key:
182
184
  specification_version: 4
183
185
  summary: Node.JS's V8 JavaScript engine