libv8-node 22.7.0.4-x86_64-darwin → 23.6.1.0-x86_64-darwin

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 (49) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +3 -3
  3. data/vendor/v8/include/cppgc/allocation.h +10 -11
  4. data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
  5. data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
  6. data/vendor/v8/include/cppgc/internal/api-constants.h +6 -1
  7. data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
  8. data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
  9. data/vendor/v8/include/cppgc/internal/member-storage.h +6 -0
  10. data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
  11. data/vendor/v8/include/cppgc/name-provider.h +7 -0
  12. data/vendor/v8/include/v8-array-buffer.h +44 -24
  13. data/vendor/v8/include/v8-callbacks.h +10 -5
  14. data/vendor/v8/include/v8-context.h +41 -9
  15. data/vendor/v8/include/v8-cppgc.h +3 -55
  16. data/vendor/v8/include/v8-date.h +9 -0
  17. data/vendor/v8/include/v8-embedder-heap.h +4 -1
  18. data/vendor/v8/include/v8-exception.h +70 -0
  19. data/vendor/v8/include/v8-fast-api-calls.h +31 -38
  20. data/vendor/v8/include/v8-function-callback.h +203 -62
  21. data/vendor/v8/include/v8-function.h +4 -3
  22. data/vendor/v8/include/v8-handle-base.h +2 -2
  23. data/vendor/v8/include/v8-initialization.h +18 -1
  24. data/vendor/v8/include/v8-inspector.h +6 -3
  25. data/vendor/v8/include/v8-internal.h +303 -58
  26. data/vendor/v8/include/v8-isolate.h +58 -39
  27. data/vendor/v8/include/v8-local-handle.h +18 -19
  28. data/vendor/v8/include/v8-message.h +0 -21
  29. data/vendor/v8/include/v8-metrics.h +4 -0
  30. data/vendor/v8/include/v8-microtask-queue.h +0 -5
  31. data/vendor/v8/include/v8-object.h +284 -35
  32. data/vendor/v8/include/v8-persistent-handle.h +0 -19
  33. data/vendor/v8/include/v8-platform.h +21 -35
  34. data/vendor/v8/include/v8-primitive.h +92 -1
  35. data/vendor/v8/include/v8-profiler.h +38 -1
  36. data/vendor/v8/include/v8-promise.h +2 -2
  37. data/vendor/v8/include/v8-sandbox.h +173 -0
  38. data/vendor/v8/include/v8-script.h +44 -14
  39. data/vendor/v8/include/v8-snapshot.h +38 -2
  40. data/vendor/v8/include/v8-template.h +105 -263
  41. data/vendor/v8/include/v8-traced-handle.h +4 -15
  42. data/vendor/v8/include/v8-unwinder.h +2 -1
  43. data/vendor/v8/include/v8-util.h +1 -117
  44. data/vendor/v8/include/v8-value.h +3 -2
  45. data/vendor/v8/include/v8-version.h +3 -3
  46. data/vendor/v8/include/v8-wasm.h +3 -0
  47. data/vendor/v8/include/v8config.h +51 -7
  48. data/vendor/v8/x86_64-darwin/libv8/obj/libv8_monolith.a +0 -0
  49. metadata +4 -3
@@ -9,6 +9,7 @@
9
9
  #include <stdint.h>
10
10
 
11
11
  #include <memory>
12
+ #include <string>
12
13
  #include <utility>
13
14
 
14
15
  #include "cppgc/common.h"
@@ -17,6 +18,7 @@
17
18
  #include "v8-data.h" // NOLINT(build/include_directory)
18
19
  #include "v8-debug.h" // NOLINT(build/include_directory)
19
20
  #include "v8-embedder-heap.h" // NOLINT(build/include_directory)
21
+ #include "v8-exception.h" // NOLINT(build/include_directory)
20
22
  #include "v8-function-callback.h" // NOLINT(build/include_directory)
21
23
  #include "v8-internal.h" // NOLINT(build/include_directory)
22
24
  #include "v8-local-handle.h" // NOLINT(build/include_directory)
@@ -276,11 +278,6 @@ class V8_EXPORT Isolate {
276
278
  */
277
279
  bool allow_atomics_wait = true;
278
280
 
279
- /**
280
- * Termination is postponed when there is no active SafeForTerminationScope.
281
- */
282
- bool only_terminate_in_safe_scope = false;
283
-
284
281
  /**
285
282
  * The following parameters describe the offsets for addressing type info
286
283
  * for wrapped API objects and are used by the fast C API
@@ -389,21 +386,6 @@ class V8_EXPORT Isolate {
389
386
  friend class internal::ThreadLocalTop;
390
387
  };
391
388
 
392
- /**
393
- * This scope allows terminations inside direct V8 API calls and forbid them
394
- * inside any recursive API calls without explicit SafeForTerminationScope.
395
- */
396
- class V8_EXPORT V8_NODISCARD SafeForTerminationScope {
397
- public:
398
- V8_DEPRECATE_SOON("All code should be safe for termination")
399
- explicit SafeForTerminationScope(v8::Isolate* v8_isolate) {}
400
- ~SafeForTerminationScope() {}
401
-
402
- // Prevent copying of Scope objects.
403
- SafeForTerminationScope(const SafeForTerminationScope&) = delete;
404
- SafeForTerminationScope& operator=(const SafeForTerminationScope&) = delete;
405
- };
406
-
407
389
  /**
408
390
  * Types of garbage collections that can be requested via
409
391
  * RequestGarbageCollectionForTesting.
@@ -563,6 +545,9 @@ class V8_EXPORT Isolate {
563
545
  kWasmExnRef = 138,
564
546
  kWasmTypedFuncRef = 139,
565
547
  kInvalidatedStringWrapperToPrimitiveProtector = 140,
548
+ kDocumentAllLegacyCall = 141,
549
+ kDocumentAllLegacyConstruct = 142,
550
+ kConsoleContext = 143,
566
551
 
567
552
  // If you add new values here, you'll also need to update Chromium's:
568
553
  // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
@@ -580,6 +565,21 @@ class V8_EXPORT Isolate {
580
565
  kMessageWarning,
581
566
  };
582
567
 
568
+ // The different priorities that an isolate can have.
569
+ enum class Priority {
570
+ // The isolate does not relate to content that is currently important
571
+ // to the user. Lowest priority.
572
+ kBestEffort,
573
+
574
+ // The isolate contributes to content that is visible to the user, like a
575
+ // visible iframe that's not interacted directly with. High priority.
576
+ kUserVisible,
577
+
578
+ // The isolate contributes to content that is of the utmost importance to
579
+ // the user, like visible content in the focused window. Highest priority.
580
+ kUserBlocking,
581
+ };
582
+
583
583
  using UseCounterCallback = void (*)(Isolate* isolate,
584
584
  UseCounterFeature feature);
585
585
 
@@ -691,6 +691,11 @@ class V8_EXPORT Isolate {
691
691
  */
692
692
  void SetPrepareStackTraceCallback(PrepareStackTraceCallback callback);
693
693
 
694
+ /**
695
+ * Get the stackTraceLimit property of Error.
696
+ */
697
+ int GetStackTraceLimit();
698
+
694
699
  #if defined(V8_OS_WIN)
695
700
  /**
696
701
  * This specifies the callback called when an ETW tracing session starts.
@@ -932,6 +937,12 @@ class V8_EXPORT Isolate {
932
937
  */
933
938
  Local<Context> GetIncumbentContext();
934
939
 
940
+ /**
941
+ * Returns the host defined options set for currently running script or
942
+ * module, if available.
943
+ */
944
+ MaybeLocal<Data> GetCurrentHostDefinedOptions();
945
+
935
946
  /**
936
947
  * Schedules a v8::Exception::Error with the given message.
937
948
  * See ThrowException for more details. Templatized to provide compile-time
@@ -1273,6 +1284,15 @@ class V8_EXPORT Isolate {
1273
1284
  */
1274
1285
  void SetPromiseRejectCallback(PromiseRejectCallback callback);
1275
1286
 
1287
+ /**
1288
+ * This is a part of experimental Api and might be changed without further
1289
+ * notice.
1290
+ * Do not use it.
1291
+ *
1292
+ * Set callback to notify about a new exception being thrown.
1293
+ */
1294
+ void SetExceptionPropagationCallback(ExceptionPropagationCallback callback);
1295
+
1276
1296
  /**
1277
1297
  * Runs the default MicrotaskQueue until it gets empty and perform other
1278
1298
  * microtask checkpoint steps, such as calling ClearKeptObjects. Asserts that
@@ -1362,24 +1382,6 @@ class V8_EXPORT Isolate {
1362
1382
  */
1363
1383
  void SetAddCrashKeyCallback(AddCrashKeyCallback);
1364
1384
 
1365
- /**
1366
- * Optional notification that the embedder is idle.
1367
- * V8 uses the notification to perform garbage collection.
1368
- * This call can be used repeatedly if the embedder remains idle.
1369
- * Returns true if the embedder should stop calling IdleNotificationDeadline
1370
- * until real work has been done. This indicates that V8 has done
1371
- * as much cleanup as it will be able to do.
1372
- *
1373
- * The deadline_in_seconds argument specifies the deadline V8 has to finish
1374
- * garbage collection work. deadline_in_seconds is compared with
1375
- * MonotonicallyIncreasingTime() and should be based on the same timebase as
1376
- * that function. There is no guarantee that the actual work will be done
1377
- * within the time limit.
1378
- */
1379
- V8_DEPRECATE_SOON(
1380
- "Use MemoryPressureNotification() to influence the GC schedule.")
1381
- bool IdleNotificationDeadline(double deadline_in_seconds);
1382
-
1383
1385
  /**
1384
1386
  * Optional notification that the system is running low on memory.
1385
1387
  * V8 uses these notifications to attempt to free memory.
@@ -1401,14 +1403,22 @@ class V8_EXPORT Isolate {
1401
1403
  * Optional notification that the isolate switched to the foreground.
1402
1404
  * V8 uses these notifications to guide heuristics.
1403
1405
  */
1406
+ V8_DEPRECATE_SOON("Use SetPriority(Priority::kUserBlocking) instead")
1404
1407
  void IsolateInForegroundNotification();
1405
1408
 
1406
1409
  /**
1407
1410
  * Optional notification that the isolate switched to the background.
1408
1411
  * V8 uses these notifications to guide heuristics.
1409
1412
  */
1413
+ V8_DEPRECATE_SOON("Use SetPriority(Priority::kBestEffort) instead")
1410
1414
  void IsolateInBackgroundNotification();
1411
1415
 
1416
+ /**
1417
+ * Optional notification that the isolate changed `priority`.
1418
+ * V8 uses the priority value to guide heuristics.
1419
+ */
1420
+ void SetPriority(Priority priority);
1421
+
1412
1422
  /**
1413
1423
  * Optional notification to tell V8 the current performance requirements
1414
1424
  * of the embedder based on RAIL.
@@ -1592,6 +1602,9 @@ class V8_EXPORT Isolate {
1592
1602
  * Register callback to control whether compile hints magic comments are
1593
1603
  * enabled.
1594
1604
  */
1605
+ V8_DEPRECATED(
1606
+ "Will be removed, use ScriptCompiler::CompileOptions for enabling the "
1607
+ "compile hints magic comments")
1595
1608
  void SetJavaScriptCompileHintsMagicEnabledCallback(
1596
1609
  JavaScriptCompileHintsMagicEnabledCallback callback);
1597
1610
 
@@ -1656,7 +1669,7 @@ class V8_EXPORT Isolate {
1656
1669
  * heap. GC is not invoked prior to iterating, therefore there is no
1657
1670
  * guarantee that visited objects are still alive.
1658
1671
  */
1659
- V8_DEPRECATE_SOON("Will be removed without replacement. crbug.com/v8/14172")
1672
+ V8_DEPRECATED("Will be removed without replacement. crbug.com/v8/14172")
1660
1673
  void VisitExternalResources(ExternalResourceVisitor* visitor);
1661
1674
 
1662
1675
  /**
@@ -1711,6 +1724,12 @@ class V8_EXPORT Isolate {
1711
1724
  */
1712
1725
  void LocaleConfigurationChangeNotification();
1713
1726
 
1727
+ /**
1728
+ * Returns the default locale in a string if Intl support is enabled.
1729
+ * Otherwise returns an empty string.
1730
+ */
1731
+ std::string GetDefaultLocale();
1732
+
1714
1733
  Isolate() = delete;
1715
1734
  ~Isolate() = delete;
1716
1735
  Isolate(const Isolate&) = delete;
@@ -51,8 +51,6 @@ class Isolate;
51
51
  class Object;
52
52
  template <class F1, class F2, class F3>
53
53
  class PersistentValueMapBase;
54
- template <class F1, class F2>
55
- class PersistentValueVector;
56
54
  class Primitive;
57
55
  class Private;
58
56
  template <class F>
@@ -152,11 +150,11 @@ class V8_EXPORT V8_NODISCARD HandleScope {
152
150
 
153
151
  /**
154
152
  * A base class for local handles.
155
- * Its implementation depends on whether direct local support is enabled.
153
+ * Its implementation depends on whether direct handle support is enabled.
156
154
  * When it is, a local handle contains a direct pointer to the referenced
157
155
  * object, otherwise it contains an indirect pointer.
158
156
  */
159
- #ifdef V8_ENABLE_DIRECT_LOCAL
157
+ #ifdef V8_ENABLE_DIRECT_HANDLE
160
158
 
161
159
  template <typename T>
162
160
  class LocalBase : public api_internal::DirectHandleBase {
@@ -185,7 +183,7 @@ class LocalBase : public api_internal::DirectHandleBase {
185
183
  }
186
184
  };
187
185
 
188
- #else // !V8_ENABLE_DIRECT_LOCAL
186
+ #else // !V8_ENABLE_DIRECT_HANDLE
189
187
 
190
188
  template <typename T>
191
189
  class LocalBase : public api_internal::IndirectHandleBase {
@@ -217,7 +215,7 @@ class LocalBase : public api_internal::IndirectHandleBase {
217
215
  }
218
216
  };
219
217
 
220
- #endif // V8_ENABLE_DIRECT_LOCAL
218
+ #endif // V8_ENABLE_DIRECT_HANDLE
221
219
 
222
220
  /**
223
221
  * An object reference managed by the v8 garbage collector.
@@ -382,8 +380,6 @@ class V8_TRIVIAL_ABI Local : public LocalBase<T>,
382
380
  friend class InternalEscapableScope;
383
381
  template <class F1, class F2, class F3>
384
382
  friend class PersistentValueMapBase;
385
- template <class F1, class F2>
386
- friend class PersistentValueVector;
387
383
  template <class F>
388
384
  friend class ReturnValue;
389
385
  template <class F>
@@ -404,13 +400,13 @@ class V8_TRIVIAL_ABI Local : public LocalBase<T>,
404
400
  return Local<T>(LocalBase<T>::FromSlot(slot));
405
401
  }
406
402
 
407
- #ifdef V8_ENABLE_DIRECT_LOCAL
403
+ #ifdef V8_ENABLE_DIRECT_HANDLE
408
404
  friend class TypecheckWitness;
409
405
 
410
406
  V8_INLINE static Local<T> FromAddress(internal::Address ptr) {
411
407
  return Local<T>(LocalBase<T>(ptr));
412
408
  }
413
- #endif // V8_ENABLE_DIRECT_LOCAL
409
+ #endif // V8_ENABLE_DIRECT_HANDLE
414
410
 
415
411
  V8_INLINE static Local<T> New(Isolate* isolate, internal::Address value) {
416
412
  return Local<T>(LocalBase<T>::New(isolate, value));
@@ -439,16 +435,16 @@ class V8_TRIVIAL_ABI LocalUnchecked : public Local<T> {
439
435
  // In this case, the check is also enforced in the copy constructor and we
440
436
  // need to suppress it.
441
437
  LocalUnchecked(const LocalUnchecked& other)
442
- : Local<T>(other, Local<T>::do_not_check) {}
443
- LocalUnchecked& operator=(const LocalUnchecked&) = default;
438
+ : Local<T>(other, Local<T>::do_not_check) noexcept {}
439
+ LocalUnchecked& operator=(const LocalUnchecked&) noexcept = default;
444
440
  #endif
445
441
 
446
442
  // Implicit conversion from Local.
447
- LocalUnchecked(const Local<T>& other) // NOLINT(runtime/explicit)
443
+ LocalUnchecked(const Local<T>& other) noexcept // NOLINT(runtime/explicit)
448
444
  : Local<T>(other, Local<T>::do_not_check) {}
449
445
  };
450
446
 
451
- #ifdef V8_ENABLE_DIRECT_LOCAL
447
+ #ifdef V8_ENABLE_DIRECT_HANDLE
452
448
  // Off-stack allocated direct locals must be registered as strong roots.
453
449
  // For off-stack indirect locals, this is not necessary.
454
450
 
@@ -460,8 +456,10 @@ class StrongRootAllocator<LocalUnchecked<T>> : public StrongRootAllocatorBase {
460
456
  static_assert(sizeof(value_type) == sizeof(Address));
461
457
 
462
458
  explicit StrongRootAllocator(Heap* heap) : StrongRootAllocatorBase(heap) {}
463
- explicit StrongRootAllocator(v8::Isolate* isolate)
459
+ explicit StrongRootAllocator(Isolate* isolate)
464
460
  : StrongRootAllocatorBase(isolate) {}
461
+ explicit StrongRootAllocator(v8::Isolate* isolate)
462
+ : StrongRootAllocatorBase(reinterpret_cast<Isolate*>(isolate)) {}
465
463
  template <typename U>
466
464
  StrongRootAllocator(const StrongRootAllocator<U>& other) noexcept
467
465
  : StrongRootAllocatorBase(other) {}
@@ -473,7 +471,7 @@ class StrongRootAllocator<LocalUnchecked<T>> : public StrongRootAllocatorBase {
473
471
  return deallocate_impl(reinterpret_cast<Address*>(p), n);
474
472
  }
475
473
  };
476
- #endif // V8_ENABLE_DIRECT_LOCAL
474
+ #endif // V8_ENABLE_DIRECT_HANDLE
477
475
  } // namespace internal
478
476
 
479
477
  template <typename T>
@@ -481,7 +479,7 @@ class LocalVector {
481
479
  private:
482
480
  using element_type = internal::LocalUnchecked<T>;
483
481
 
484
- #ifdef V8_ENABLE_DIRECT_LOCAL
482
+ #ifdef V8_ENABLE_DIRECT_HANDLE
485
483
  using allocator_type = internal::StrongRootAllocator<element_type>;
486
484
 
487
485
  static allocator_type make_allocator(Isolate* isolate) noexcept {
@@ -493,7 +491,7 @@ class LocalVector {
493
491
  static allocator_type make_allocator(Isolate* isolate) noexcept {
494
492
  return allocator_type();
495
493
  }
496
- #endif // V8_ENABLE_DIRECT_LOCAL
494
+ #endif // V8_ENABLE_DIRECT_HANDLE
497
495
 
498
496
  using vector_type = std::vector<element_type, allocator_type>;
499
497
 
@@ -560,6 +558,7 @@ class LocalVector {
560
558
 
561
559
  LocalVector<T>& operator=(std::initializer_list<Local<T>> init) {
562
560
  backing_.clear();
561
+ backing_.reserve(init.size());
563
562
  backing_.insert(backing_.end(), init.begin(), init.end());
564
563
  return *this;
565
564
  }
@@ -716,7 +715,7 @@ class V8_EXPORT V8_NODISCARD EscapableHandleScope
716
715
  V8_INLINE ~EscapableHandleScope() = default;
717
716
  template <class T>
718
717
  V8_INLINE Local<T> Escape(Local<T> value) {
719
- #ifdef V8_ENABLE_DIRECT_LOCAL
718
+ #ifdef V8_ENABLE_DIRECT_HANDLE
720
719
  return value;
721
720
  #else
722
721
  if (value.IsEmpty()) return value;
@@ -61,27 +61,6 @@ class ScriptOriginOptions {
61
61
  */
62
62
  class V8_EXPORT ScriptOrigin {
63
63
  public:
64
- V8_DEPRECATE_SOON("Use constructor without the isolate.")
65
- V8_INLINE ScriptOrigin(Isolate* isolate, Local<Value> resource_name,
66
- int resource_line_offset = 0,
67
- int resource_column_offset = 0,
68
- bool resource_is_shared_cross_origin = false,
69
- int script_id = -1,
70
- Local<Value> source_map_url = Local<Value>(),
71
- bool resource_is_opaque = false, bool is_wasm = false,
72
- bool is_module = false,
73
- Local<Data> host_defined_options = Local<Data>())
74
- : resource_name_(resource_name),
75
- resource_line_offset_(resource_line_offset),
76
- resource_column_offset_(resource_column_offset),
77
- options_(resource_is_shared_cross_origin, resource_is_opaque, is_wasm,
78
- is_module),
79
- script_id_(script_id),
80
- source_map_url_(source_map_url),
81
- host_defined_options_(host_defined_options) {
82
- VerifyHostDefinedOptions();
83
- }
84
-
85
64
  V8_INLINE ScriptOrigin(Local<Value> resource_name,
86
65
  int resource_line_offset = 0,
87
66
  int resource_column_offset = 0,
@@ -55,6 +55,10 @@ struct GarbageCollectionFullCycle {
55
55
  double efficiency_cpp_in_bytes_per_us = -1.0;
56
56
  double main_thread_efficiency_in_bytes_per_us = -1.0;
57
57
  double main_thread_efficiency_cpp_in_bytes_per_us = -1.0;
58
+ double collection_weight_in_percent = -1.0;
59
+ double collection_weight_cpp_in_percent = -1.0;
60
+ double main_thread_collection_weight_in_percent = -1.0;
61
+ double main_thread_collection_weight_cpp_in_percent = -1.0;
58
62
  int64_t incremental_marking_start_stop_wall_clock_duration_in_us = -1;
59
63
  };
60
64
 
@@ -118,11 +118,6 @@ class V8_EXPORT V8_NODISCARD MicrotasksScope {
118
118
  public:
119
119
  enum Type { kRunMicrotasks, kDoNotRunMicrotasks };
120
120
 
121
- V8_DEPRECATE_SOON(
122
- "May be incorrect if context was created with non-default microtask "
123
- "queue")
124
- MicrotasksScope(Isolate* isolate, Type type);
125
-
126
121
  MicrotasksScope(Local<Context> context, Type type);
127
122
  MicrotasksScope(Isolate* isolate, MicrotaskQueue* microtask_queue, Type type);
128
123
  ~MicrotasksScope();