libv8-node 21.7.2.0-aarch64-linux-musl → 24.12.0.0-aarch64-linux-musl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libv8-node/location.rb +3 -5
  3. data/ext/libv8-node/paths.rb +2 -0
  4. data/lib/libv8/node/version.rb +7 -4
  5. data/lib/libv8/node.rb +2 -0
  6. data/lib/libv8-node.rb +2 -0
  7. data/vendor/v8/aarch64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
  8. data/vendor/v8/include/cppgc/allocation.h +11 -13
  9. data/vendor/v8/include/cppgc/default-platform.h +3 -2
  10. data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
  11. data/vendor/v8/include/cppgc/heap-consistency.h +1 -1
  12. data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
  13. data/vendor/v8/include/cppgc/internal/api-constants.h +2 -14
  14. data/vendor/v8/include/cppgc/internal/base-page-handle.h +2 -4
  15. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +0 -4
  16. data/vendor/v8/include/cppgc/internal/caged-heap.h +0 -4
  17. data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
  18. data/vendor/v8/include/cppgc/internal/conditional-stack-allocated.h +41 -0
  19. data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
  20. data/vendor/v8/include/cppgc/internal/logging.h +3 -3
  21. data/vendor/v8/include/cppgc/internal/member-storage.h +69 -20
  22. data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
  23. data/vendor/v8/include/cppgc/internal/persistent-node.h +8 -3
  24. data/vendor/v8/include/cppgc/internal/pointer-policies.h +48 -11
  25. data/vendor/v8/include/cppgc/macros.h +21 -0
  26. data/vendor/v8/include/cppgc/member.h +70 -36
  27. data/vendor/v8/include/cppgc/name-provider.h +10 -0
  28. data/vendor/v8/include/cppgc/platform.h +11 -0
  29. data/vendor/v8/include/cppgc/type-traits.h +26 -4
  30. data/vendor/v8/include/cppgc/visitor.h +25 -1
  31. data/vendor/v8/include/libplatform/libplatform-export.h +2 -2
  32. data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
  33. data/vendor/v8/include/v8-array-buffer.h +149 -46
  34. data/vendor/v8/include/v8-callbacks.h +100 -43
  35. data/vendor/v8/include/v8-container.h +54 -0
  36. data/vendor/v8/include/v8-context.h +92 -30
  37. data/vendor/v8/include/v8-cppgc.h +5 -56
  38. data/vendor/v8/include/v8-data.h +5 -0
  39. data/vendor/v8/include/v8-date.h +9 -0
  40. data/vendor/v8/include/v8-debug.h +11 -0
  41. data/vendor/v8/include/v8-embedder-heap.h +8 -20
  42. data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
  43. data/vendor/v8/include/v8-exception.h +87 -9
  44. data/vendor/v8/include/v8-external-memory-accounter.h +60 -0
  45. data/vendor/v8/include/v8-fast-api-calls.h +67 -223
  46. data/vendor/v8/include/v8-forward.h +1 -0
  47. data/vendor/v8/include/v8-function-callback.h +296 -75
  48. data/vendor/v8/include/v8-function.h +11 -3
  49. data/vendor/v8/include/v8-handle-base.h +52 -82
  50. data/vendor/v8/include/v8-initialization.h +26 -1
  51. data/vendor/v8/include/v8-inspector.h +26 -27
  52. data/vendor/v8/include/v8-internal.h +960 -230
  53. data/vendor/v8/include/v8-isolate.h +347 -226
  54. data/vendor/v8/include/v8-local-handle.h +307 -55
  55. data/vendor/v8/include/v8-maybe.h +2 -1
  56. data/vendor/v8/include/v8-memory-span.h +284 -4
  57. data/vendor/v8/include/v8-message.h +11 -5
  58. data/vendor/v8/include/v8-metrics.h +15 -0
  59. data/vendor/v8/include/v8-microtask-queue.h +0 -5
  60. data/vendor/v8/include/v8-object.h +314 -41
  61. data/vendor/v8/include/v8-persistent-handle.h +29 -39
  62. data/vendor/v8/include/v8-platform.h +135 -77
  63. data/vendor/v8/include/v8-primitive.h +223 -5
  64. data/vendor/v8/include/v8-profiler.h +51 -2
  65. data/vendor/v8/include/v8-promise.h +2 -2
  66. data/vendor/v8/include/v8-proxy.h +0 -1
  67. data/vendor/v8/include/v8-regexp.h +0 -1
  68. data/vendor/v8/include/v8-sandbox.h +173 -0
  69. data/vendor/v8/include/v8-script.h +125 -27
  70. data/vendor/v8/include/v8-snapshot.h +130 -23
  71. data/vendor/v8/include/v8-source-location.h +6 -1
  72. data/vendor/v8/include/v8-statistics.h +10 -24
  73. data/vendor/v8/include/v8-template.h +320 -193
  74. data/vendor/v8/include/v8-trace-categories.h +23 -0
  75. data/vendor/v8/include/v8-traced-handle.h +99 -76
  76. data/vendor/v8/include/v8-typed-array.h +111 -7
  77. data/vendor/v8/include/v8-unwinder-state.h +2 -3
  78. data/vendor/v8/include/v8-unwinder.h +2 -1
  79. data/vendor/v8/include/v8-util.h +10 -125
  80. data/vendor/v8/include/v8-value-serializer-version.h +3 -3
  81. data/vendor/v8/include/v8-value.h +113 -6
  82. data/vendor/v8/include/v8-version.h +3 -3
  83. data/vendor/v8/include/v8-wasm.h +27 -0
  84. data/vendor/v8/include/v8-weak-callback-info.h +20 -12
  85. data/vendor/v8/include/v8.h +3 -3
  86. data/vendor/v8/include/v8config.h +116 -53
  87. metadata +55 -12
  88. data/vendor/v8/include/cppgc/ephemeron-pair.h +0 -30
@@ -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_DIRECT_LOCAL
185
+ #ifdef V8_ENABLE_DIRECT_HANDLE
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,7 +299,8 @@ 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) {
@@ -318,7 +320,7 @@ class PersistentValueMapBase {
318
320
  */
319
321
  static Global<V> Release(PersistentContainerValue v) {
320
322
  Global<V> p;
321
- p.slot() = reinterpret_cast<internal::Address*>(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,8 +330,8 @@ class PersistentValueMapBase {
328
330
 
329
331
  void RemoveWeak(const K& key) {
330
332
  Global<V> p;
331
- p.slot() = reinterpret_cast<internal::Address*>(
332
- FromVal(Traits::Remove(&impl_, key)));
333
+ p.slot() =
334
+ reinterpret_cast<internal::Address*>(Traits::Remove(&impl_, key));
333
335
  p.Reset();
334
336
  }
335
337
 
@@ -345,8 +347,7 @@ class PersistentValueMapBase {
345
347
  PersistentContainerValue value) {
346
348
  bool hasValue = value != kPersistentContainerNotFound;
347
349
  if (hasValue) {
348
- returnValue->SetInternal(
349
- *reinterpret_cast<internal::Address*>(FromVal(value)));
350
+ returnValue->SetInternal(*reinterpret_cast<internal::Address*>(value));
350
351
  }
351
352
  return hasValue;
352
353
  }
@@ -543,122 +544,6 @@ class StdGlobalValueMap : public GlobalValueMap<K, V, Traits> {
543
544
  : GlobalValueMap<K, V, Traits>(isolate) {}
544
545
  };
545
546
 
546
- class DefaultPersistentValueVectorTraits {
547
- public:
548
- typedef std::vector<PersistentContainerValue> Impl;
549
-
550
- static void Append(Impl* impl, PersistentContainerValue value) {
551
- impl->push_back(value);
552
- }
553
- static bool IsEmpty(const Impl* impl) {
554
- return impl->empty();
555
- }
556
- static size_t Size(const Impl* impl) {
557
- return impl->size();
558
- }
559
- static PersistentContainerValue Get(const Impl* impl, size_t i) {
560
- return (i < impl->size()) ? impl->at(i) : kPersistentContainerNotFound;
561
- }
562
- static void ReserveCapacity(Impl* impl, size_t capacity) {
563
- impl->reserve(capacity);
564
- }
565
- static void Clear(Impl* impl) {
566
- impl->clear();
567
- }
568
- };
569
-
570
- /**
571
- * A vector wrapper that safely stores Global values.
572
- * C++11 embedders don't need this class, as they can use Global
573
- * directly in std containers.
574
- *
575
- * This class relies on a backing vector implementation, whose type and methods
576
- * are described by the Traits class. The backing map will handle values of type
577
- * PersistentContainerValue, with all conversion into and out of V8
578
- * handles being transparently handled by this class.
579
- */
580
- template <typename V, typename Traits = DefaultPersistentValueVectorTraits>
581
- class V8_DEPRECATE_SOON("Use std::vector<Global<V>>.") PersistentValueVector {
582
- public:
583
- explicit PersistentValueVector(Isolate* isolate) : isolate_(isolate) { }
584
-
585
- ~PersistentValueVector() {
586
- Clear();
587
- }
588
-
589
- /**
590
- * Append a value to the vector.
591
- */
592
- void Append(Local<V> value) {
593
- Global<V> persistent(isolate_, value);
594
- Traits::Append(&impl_, ClearAndLeak(&persistent));
595
- }
596
-
597
- /**
598
- * Append a persistent's value to the vector.
599
- */
600
- void Append(Global<V> persistent) {
601
- Traits::Append(&impl_, ClearAndLeak(&persistent));
602
- }
603
-
604
- /**
605
- * Are there any values in the vector?
606
- */
607
- bool IsEmpty() const {
608
- return Traits::IsEmpty(&impl_);
609
- }
610
-
611
- /**
612
- * How many elements are in the vector?
613
- */
614
- size_t Size() const {
615
- return Traits::Size(&impl_);
616
- }
617
-
618
- /**
619
- * Retrieve the i-th value in the vector.
620
- */
621
- Local<V> Get(size_t index) const {
622
- return Local<V>::New(isolate_, internal::ValueHelper::SlotAsValue<V>(
623
- FromVal(Traits::Get(&impl_, index))));
624
- }
625
-
626
- /**
627
- * Remove all elements from the vector.
628
- */
629
- void Clear() {
630
- size_t length = Traits::Size(&impl_);
631
- for (size_t i = 0; i < length; i++) {
632
- Global<V> p;
633
- p.slot() =
634
- reinterpret_cast<internal::Address>(FromVal(Traits::Get(&impl_, i)));
635
- }
636
- Traits::Clear(&impl_);
637
- }
638
-
639
- /**
640
- * Reserve capacity in the vector.
641
- * (Efficiency gains depend on the backing implementation.)
642
- */
643
- void ReserveCapacity(size_t capacity) {
644
- Traits::ReserveCapacity(&impl_, capacity);
645
- }
646
-
647
- private:
648
- static PersistentContainerValue ClearAndLeak(Global<V>* persistent) {
649
- auto slot = persistent->slot();
650
- persistent->Clear();
651
- return reinterpret_cast<PersistentContainerValue>(slot);
652
- }
653
-
654
- static V* FromVal(PersistentContainerValue v) {
655
- return reinterpret_cast<V*>(v);
656
- }
657
-
658
- Isolate* isolate_;
659
- typename Traits::Impl impl_;
660
- };
661
-
662
547
  } // namespace v8
663
548
 
664
549
  #endif // V8_UTIL_H
@@ -2,6 +2,9 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ #ifndef INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_
6
+ #define INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_
7
+
5
8
  /**
6
9
  * Compile-time constants.
7
10
  *
@@ -10,9 +13,6 @@
10
13
  * to V8.
11
14
  */
12
15
 
13
- #ifndef INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_
14
- #define INCLUDE_V8_VALUE_SERIALIZER_VERSION_H_
15
-
16
16
  #include <stdint.h>
17
17
 
18
18
  namespace v8 {
@@ -16,7 +16,7 @@
16
16
  */
17
17
  namespace v8 {
18
18
 
19
- class Primiitive;
19
+ class Primitive;
20
20
  class Numeric;
21
21
  class BigInt;
22
22
  class Int32;
@@ -63,7 +63,7 @@ class V8_EXPORT Value : public Data {
63
63
  * conversion to boolean, i.e. the result of `Boolean(value)` in JS, whereas
64
64
  * this checks `value === true`.
65
65
  */
66
- bool IsTrue() const;
66
+ V8_INLINE bool IsTrue() const;
67
67
 
68
68
  /**
69
69
  * Returns true if this value is false.
@@ -72,7 +72,7 @@ class V8_EXPORT Value : public Data {
72
72
  * conversion to boolean, i.e. the result of `!Boolean(value)` in JS, whereas
73
73
  * this checks `value === false`.
74
74
  */
75
- bool IsFalse() const;
75
+ V8_INLINE bool IsFalse() const;
76
76
 
77
77
  /**
78
78
  * Returns true if this value is a symbol or a string.
@@ -301,6 +301,11 @@ class V8_EXPORT Value : public Data {
301
301
  */
302
302
  bool IsInt32Array() const;
303
303
 
304
+ /**
305
+ * Returns true if this value is a Float16Array.
306
+ */
307
+ bool IsFloat16Array() const;
308
+
304
309
  /**
305
310
  * Returns true if this value is a Float32Array.
306
311
  */
@@ -341,6 +346,11 @@ class V8_EXPORT Value : public Data {
341
346
  */
342
347
  bool IsWasmMemoryObject() const;
343
348
 
349
+ /**
350
+ * Returns true if this value is a WasmMemoryMapDescriptor.
351
+ */
352
+ bool IsWasmMemoryMapDescriptor() const;
353
+
344
354
  /**
345
355
  * Returns true if this value is a WasmModuleObject.
346
356
  */
@@ -356,6 +366,11 @@ class V8_EXPORT Value : public Data {
356
366
  */
357
367
  bool IsModuleNamespaceObject() const;
358
368
 
369
+ /**
370
+ * Returns true if the value is a primitive.
371
+ */
372
+ bool IsPrimitive() const;
373
+
359
374
  /**
360
375
  * Perform `ToPrimitive(value)` as specified in:
361
376
  * https://tc39.es/ecma262/#sec-toprimitive.
@@ -391,7 +406,7 @@ class V8_EXPORT Value : public Data {
391
406
  V8_WARN_UNUSED_RESULT MaybeLocal<String> ToDetailString(
392
407
  Local<Context> context) const;
393
408
  /**
394
- * Perform the equivalent of `Object(value)` in JS.
409
+ * Perform the equivalent of `Tagged<Object>(value)` in JS.
395
410
  */
396
411
  V8_WARN_UNUSED_RESULT MaybeLocal<Object> ToObject(
397
412
  Local<Context> context) const;
@@ -457,18 +472,67 @@ class V8_EXPORT Value : public Data {
457
472
 
458
473
  Maybe<bool> InstanceOf(Local<Context> context, Local<Object> object);
459
474
 
475
+ /**
476
+ * Get the hash of this value. The hash is not guaranteed to be
477
+ * unique. For |Object| and |Name| instances the result is equal to
478
+ * |GetIdentityHash|. Hashes are not guaranteed to be stable across
479
+ * different isolates or processes.
480
+ */
481
+ uint32_t GetHash();
482
+
460
483
  private:
461
484
  V8_INLINE bool QuickIsUndefined() const;
462
485
  V8_INLINE bool QuickIsNull() const;
463
486
  V8_INLINE bool QuickIsNullOrUndefined() const;
487
+ #if V8_STATIC_ROOTS_BOOL
488
+ V8_INLINE bool QuickIsTrue() const;
489
+ V8_INLINE bool QuickIsFalse() const;
490
+ #endif // V8_STATIC_ROOTS_BOOL
464
491
  V8_INLINE bool QuickIsString() const;
465
492
  bool FullIsUndefined() const;
466
493
  bool FullIsNull() const;
494
+ bool FullIsTrue() const;
495
+ bool FullIsFalse() const;
467
496
  bool FullIsString() const;
468
497
 
469
498
  static void CheckCast(Data* that);
470
499
  };
471
500
 
501
+ /**
502
+ * Can be used to avoid repeated expensive type checks for groups of objects
503
+ * that are expected to be similar (e.g. when Blink converts a bunch of
504
+ * JavaScript objects to "ScriptWrappable" after a "HasInstance" check) by
505
+ * making use of V8-internal "hidden classes". An object that has passed the
506
+ * full check can be remembered via {Update}; further objects can be queried
507
+ * using {Matches}.
508
+ * Note that the answer will be conservative/"best-effort": when {Matches}
509
+ * returns true, then the {candidate} can be relied upon to have the same
510
+ * shape/constructor/prototype/etc. as the {baseline}. Otherwise, no reliable
511
+ * statement can be made (the objects might still have indistinguishable shapes
512
+ * for all intents and purposes, but this mechanism, being optimized for speed,
513
+ * couldn't determine that quickly).
514
+ */
515
+ class V8_EXPORT TypecheckWitness {
516
+ public:
517
+ explicit TypecheckWitness(Isolate* isolate);
518
+
519
+ /**
520
+ * Checks whether {candidate} can cheaply be identified as being "similar"
521
+ * to the {baseline} that was passed to {Update} earlier.
522
+ * It's safe to call this on an uninitialized {TypecheckWitness} instance:
523
+ * it will then return {false} for any input.
524
+ */
525
+ V8_INLINE bool Matches(Local<Value> candidate) const;
526
+
527
+ /**
528
+ * Remembers a new baseline for future {Matches} queries.
529
+ */
530
+ void Update(Local<Value> baseline);
531
+
532
+ private:
533
+ Local<Data> cached_map_;
534
+ };
535
+
472
536
  template <>
473
537
  V8_INLINE Value* Value::Cast(Data* value) {
474
538
  #ifdef V8_ENABLE_CHECKS
@@ -541,6 +605,40 @@ bool Value::QuickIsNullOrUndefined() const {
541
605
  #endif // V8_STATIC_ROOTS_BOOL
542
606
  }
543
607
 
608
+ bool Value::IsTrue() const {
609
+ #if V8_STATIC_ROOTS_BOOL && !defined(V8_ENABLE_CHECKS)
610
+ return QuickIsTrue();
611
+ #else
612
+ return FullIsTrue();
613
+ #endif
614
+ }
615
+
616
+ #if V8_STATIC_ROOTS_BOOL
617
+ bool Value::QuickIsTrue() const {
618
+ using A = internal::Address;
619
+ using I = internal::Internals;
620
+ A obj = internal::ValueHelper::ValueAsAddress(this);
621
+ return I::is_identical(obj, I::StaticReadOnlyRoot::kTrueValue);
622
+ }
623
+ #endif // V8_STATIC_ROOTS_BOOL
624
+
625
+ bool Value::IsFalse() const {
626
+ #if V8_STATIC_ROOTS_BOOL && !defined(V8_ENABLE_CHECKS)
627
+ return QuickIsFalse();
628
+ #else
629
+ return FullIsFalse();
630
+ #endif
631
+ }
632
+
633
+ #if V8_STATIC_ROOTS_BOOL
634
+ bool Value::QuickIsFalse() const {
635
+ using A = internal::Address;
636
+ using I = internal::Internals;
637
+ A obj = internal::ValueHelper::ValueAsAddress(this);
638
+ return I::is_identical(obj, I::StaticReadOnlyRoot::kFalseValue);
639
+ }
640
+ #endif // V8_STATIC_ROOTS_BOOL
641
+
544
642
  bool Value::IsString() const {
545
643
  #ifdef V8_ENABLE_CHECKS
546
644
  return FullIsString();
@@ -555,13 +653,22 @@ bool Value::QuickIsString() const {
555
653
  A obj = internal::ValueHelper::ValueAsAddress(this);
556
654
  if (!I::HasHeapObjectTag(obj)) return false;
557
655
  #if V8_STATIC_ROOTS_BOOL && !V8_MAP_PACKING
558
- return I::CheckInstanceMapRange(obj, I::StaticReadOnlyRoot::kFirstStringMap,
559
- I::StaticReadOnlyRoot::kLastStringMap);
656
+ return I::CheckInstanceMapRange(obj,
657
+ I::StaticReadOnlyRoot::kStringMapLowerBound,
658
+ I::StaticReadOnlyRoot::kStringMapUpperBound);
560
659
  #else
561
660
  return (I::GetInstanceType(obj) < I::kFirstNonstringType);
562
661
  #endif // V8_STATIC_ROOTS_BOOL
563
662
  }
564
663
 
664
+ bool TypecheckWitness::Matches(Local<Value> candidate) const {
665
+ internal::Address obj = internal::ValueHelper::ValueAsAddress(*candidate);
666
+ internal::Address obj_map = internal::Internals::LoadMap(obj);
667
+ internal::Address cached =
668
+ internal::ValueHelper::ValueAsAddress(*cached_map_);
669
+ return obj_map == cached;
670
+ }
671
+
565
672
  } // namespace v8
566
673
 
567
674
  #endif // INCLUDE_V8_VALUE_H_
@@ -8,9 +8,9 @@
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 8
13
- #define V8_BUILD_NUMBER 172
11
+ #define V8_MAJOR_VERSION 13
12
+ #define V8_MINOR_VERSION 6
13
+ #define V8_BUILD_NUMBER 233
14
14
  #define V8_PATCH_LEVEL 17
15
15
 
16
16
  // Use 1 for candidates and 0 otherwise.
@@ -9,6 +9,7 @@
9
9
  #include <memory>
10
10
  #include <string>
11
11
 
12
+ #include "v8-internal.h" // NOLINT(build/include_directory)
12
13
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
13
14
  #include "v8-memory-span.h" // NOLINT(build/include_directory)
14
15
  #include "v8-object.h" // NOLINT(build/include_directory)
@@ -129,6 +130,8 @@ class V8_EXPORT WasmModuleObject : public Object {
129
130
  */
130
131
  class V8_EXPORT WasmStreaming final {
131
132
  public:
133
+ static constexpr internal::ExternalPointerTag kManagedTag =
134
+ internal::kWasmWasmStreamingTag;
132
135
  class WasmStreamingImpl;
133
136
 
134
137
  explicit WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl);
@@ -196,6 +199,30 @@ class V8_EXPORT WasmStreaming final {
196
199
  std::unique_ptr<WasmStreamingImpl> impl_;
197
200
  };
198
201
 
202
+ /**
203
+ * The V8 interface for a WebAssembly memory map descriptor. This is an
204
+ * experimental feature that may change and be removed without further
205
+ * communication.
206
+ */
207
+ class V8_EXPORT WasmMemoryMapDescriptor : public Object {
208
+ public:
209
+ WasmMemoryMapDescriptor() = delete;
210
+
211
+ V8_INLINE static WasmMemoryMapDescriptor* Cast(Value* value) {
212
+ #ifdef V8_ENABLE_CHECKS
213
+ CheckCast(value);
214
+ #endif
215
+ return static_cast<WasmMemoryMapDescriptor*>(value);
216
+ }
217
+
218
+ using WasmFileDescriptor = int32_t;
219
+
220
+ static Local<WasmMemoryMapDescriptor> New(Isolate* isolate,
221
+ WasmFileDescriptor fd);
222
+
223
+ private:
224
+ static void CheckCast(Value* object);
225
+ };
199
226
  } // namespace v8
200
227
 
201
228
  #endif // INCLUDE_V8_WASM_H_
@@ -5,6 +5,9 @@
5
5
  #ifndef INCLUDE_V8_WEAK_CALLBACK_INFO_H_
6
6
  #define INCLUDE_V8_WEAK_CALLBACK_INFO_H_
7
7
 
8
+ #include <cstring>
9
+
10
+ #include "cppgc/internal/conditional-stack-allocated.h" // NOLINT(build/include_directory)
8
11
  #include "v8config.h" // NOLINT(build/include_directory)
9
12
 
10
13
  namespace v8 {
@@ -15,11 +18,12 @@ namespace api_internal {
15
18
  V8_EXPORT void InternalFieldOutOfBounds(int index);
16
19
  } // namespace api_internal
17
20
 
18
- static const int kInternalFieldsInWeakCallback = 2;
19
- static const int kEmbedderFieldsInWeakCallback = 2;
21
+ static constexpr int kInternalFieldsInWeakCallback = 2;
22
+ static constexpr int kEmbedderFieldsInWeakCallback = 2;
20
23
 
21
24
  template <typename T>
22
- class WeakCallbackInfo {
25
+ class WeakCallbackInfo
26
+ : public cppgc::internal::ConditionalStackAllocatedBase<T> {
23
27
  public:
24
28
  using Callback = void (*)(const WeakCallbackInfo<T>& data);
25
29
 
@@ -27,21 +31,25 @@ class WeakCallbackInfo {
27
31
  void* embedder_fields[kEmbedderFieldsInWeakCallback],
28
32
  Callback* callback)
29
33
  : isolate_(isolate), parameter_(parameter), callback_(callback) {
30
- for (int i = 0; i < kEmbedderFieldsInWeakCallback; ++i) {
31
- embedder_fields_[i] = embedder_fields[i];
32
- }
34
+ memcpy(embedder_fields_, embedder_fields,
35
+ sizeof(embedder_fields[0]) * kEmbedderFieldsInWeakCallback);
33
36
  }
34
37
 
35
38
  V8_INLINE Isolate* GetIsolate() const { return isolate_; }
36
39
  V8_INLINE T* GetParameter() const { return parameter_; }
37
40
  V8_INLINE void* GetInternalField(int index) const;
38
41
 
39
- // When first called, the embedder MUST Reset() the Global which triggered the
40
- // callback. The Global itself is unusable for anything else. No v8 other api
41
- // calls may be called in the first callback. Should additional work be
42
- // required, the embedder must set a second pass callback, which will be
43
- // called after all the initial callbacks are processed.
44
- // Calling SetSecondPassCallback on the second pass will immediately crash.
42
+ /**
43
+ * When a weak callback is first invoked the embedders _must_ Reset() the
44
+ * handle which triggered the callback. The handle itself is unusable for
45
+ * anything else. No other V8 API calls may be called in the first callback.
46
+ * Additional work requires scheduling a second invocation via
47
+ * `SetSecondPassCallback()` which will be called some time after all the
48
+ * initial callbacks are processed.
49
+ *
50
+ * The second pass callback is prohibited from executing JavaScript. Embedders
51
+ * should schedule another callback in case this is required.
52
+ */
45
53
  void SetSecondPassCallback(Callback callback) const { *callback_ = callback; }
46
54
 
47
55
  private:
@@ -2,6 +2,9 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ #ifndef INCLUDE_V8_H_
6
+ #define INCLUDE_V8_H_
7
+
5
8
  /** \mainpage V8 API Reference Guide
6
9
  *
7
10
  * V8 is Google's open source JavaScript engine.
@@ -12,9 +15,6 @@
12
15
  * For other documentation see https://v8.dev/.
13
16
  */
14
17
 
15
- #ifndef INCLUDE_V8_H_
16
- #define INCLUDE_V8_H_
17
-
18
18
  #include <stddef.h>
19
19
  #include <stdint.h>
20
20