libv8-node 21.7.2.0-x86_64-linux → 22.7.0.1-x86_64-linux

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +7 -4
  3. data/vendor/v8/include/cppgc/internal/api-constants.h +1 -1
  4. data/vendor/v8/include/cppgc/type-traits.h +25 -4
  5. data/vendor/v8/include/v8-array-buffer.h +6 -0
  6. data/vendor/v8/include/v8-callbacks.h +6 -12
  7. data/vendor/v8/include/v8-container.h +54 -0
  8. data/vendor/v8/include/v8-context.h +51 -22
  9. data/vendor/v8/include/v8-embedder-heap.h +19 -3
  10. data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
  11. data/vendor/v8/include/v8-exception.h +15 -9
  12. data/vendor/v8/include/v8-fast-api-calls.h +35 -26
  13. data/vendor/v8/include/v8-forward.h +1 -0
  14. data/vendor/v8/include/v8-function-callback.h +129 -20
  15. data/vendor/v8/include/v8-handle-base.h +32 -80
  16. data/vendor/v8/include/v8-inspector.h +16 -24
  17. data/vendor/v8/include/v8-internal.h +472 -65
  18. data/vendor/v8/include/v8-isolate.h +86 -51
  19. data/vendor/v8/include/v8-local-handle.h +258 -33
  20. data/vendor/v8/include/v8-memory-span.h +157 -2
  21. data/vendor/v8/include/v8-message.h +22 -3
  22. data/vendor/v8/include/v8-metrics.h +1 -0
  23. data/vendor/v8/include/v8-object.h +29 -10
  24. data/vendor/v8/include/v8-persistent-handle.h +5 -3
  25. data/vendor/v8/include/v8-platform.h +81 -44
  26. data/vendor/v8/include/v8-script.h +61 -11
  27. data/vendor/v8/include/v8-snapshot.h +94 -23
  28. data/vendor/v8/include/v8-statistics.h +10 -24
  29. data/vendor/v8/include/v8-template.h +410 -131
  30. data/vendor/v8/include/v8-traced-handle.h +81 -46
  31. data/vendor/v8/include/v8-typed-array.h +115 -7
  32. data/vendor/v8/include/v8-util.h +13 -12
  33. data/vendor/v8/include/v8-value.h +92 -4
  34. data/vendor/v8/include/v8-version.h +4 -4
  35. data/vendor/v8/include/v8config.h +35 -10
  36. data/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a +0 -0
  37. metadata +2 -2
@@ -294,6 +294,12 @@ class V8_EXPORT Isolate {
294
294
  */
295
295
  FatalErrorCallback fatal_error_callback = nullptr;
296
296
  OOMErrorCallback oom_error_callback = nullptr;
297
+
298
+ /**
299
+ * A CppHeap used to construct the Isolate. V8 takes ownership of the
300
+ * CppHeap passed this way.
301
+ */
302
+ CppHeap* cpp_heap = nullptr;
297
303
  };
298
304
 
299
305
  /**
@@ -389,16 +395,13 @@ class V8_EXPORT Isolate {
389
395
  */
390
396
  class V8_EXPORT V8_NODISCARD SafeForTerminationScope {
391
397
  public:
392
- explicit SafeForTerminationScope(v8::Isolate* v8_isolate);
393
- ~SafeForTerminationScope();
398
+ V8_DEPRECATE_SOON("All code should be safe for termination")
399
+ explicit SafeForTerminationScope(v8::Isolate* v8_isolate) {}
400
+ ~SafeForTerminationScope() {}
394
401
 
395
402
  // Prevent copying of Scope objects.
396
403
  SafeForTerminationScope(const SafeForTerminationScope&) = delete;
397
404
  SafeForTerminationScope& operator=(const SafeForTerminationScope&) = delete;
398
-
399
- private:
400
- internal::Isolate* i_isolate_;
401
- bool prev_value_;
402
405
  };
403
406
 
404
407
  /**
@@ -421,36 +424,36 @@ class V8_EXPORT Isolate {
421
424
  enum UseCounterFeature {
422
425
  kUseAsm = 0,
423
426
  kBreakIterator = 1,
424
- kLegacyConst V8_DEPRECATE_SOON("unused") = 2,
425
- kMarkDequeOverflow V8_DEPRECATE_SOON("unused") = 3,
426
- kStoreBufferOverflow V8_DEPRECATE_SOON("unused") = 4,
427
- kSlotsBufferOverflow V8_DEPRECATE_SOON("unused") = 5,
428
- kObjectObserve V8_DEPRECATE_SOON("unused") = 6,
427
+ kOBSOLETE_LegacyConst = 2,
428
+ kOBSOLETE_MarkDequeOverflow = 3,
429
+ kOBSOLETE_StoreBufferOverflow = 4,
430
+ kOBSOLETE_SlotsBufferOverflow = 5,
431
+ kOBSOLETE_ObjectObserve = 6,
429
432
  kForcedGC = 7,
430
433
  kSloppyMode = 8,
431
434
  kStrictMode = 9,
432
- kStrongMode V8_DEPRECATE_SOON("unused") = 10,
435
+ kOBSOLETE_StrongMode = 10,
433
436
  kRegExpPrototypeStickyGetter = 11,
434
437
  kRegExpPrototypeToString = 12,
435
438
  kRegExpPrototypeUnicodeGetter = 13,
436
- kIntlV8Parse V8_DEPRECATE_SOON("unused") = 14,
437
- kIntlPattern V8_DEPRECATE_SOON("unused") = 15,
438
- kIntlResolved V8_DEPRECATE_SOON("unused") = 16,
439
- kPromiseChain V8_DEPRECATE_SOON("unused") = 17,
440
- kPromiseAccept V8_DEPRECATE_SOON("unused") = 18,
441
- kPromiseDefer V8_DEPRECATE_SOON("unused") = 19,
439
+ kOBSOLETE_IntlV8Parse = 14,
440
+ kOBSOLETE_IntlPattern = 15,
441
+ kOBSOLETE_IntlResolved = 16,
442
+ kOBSOLETE_PromiseChain = 17,
443
+ kOBSOLETE_PromiseAccept = 18,
444
+ kOBSOLETE_PromiseDefer = 19,
442
445
  kHtmlCommentInExternalScript = 20,
443
446
  kHtmlComment = 21,
444
447
  kSloppyModeBlockScopedFunctionRedefinition = 22,
445
448
  kForInInitializer = 23,
446
- kArrayProtectorDirtied V8_DEPRECATE_SOON("unused") = 24,
449
+ kOBSOLETE_ArrayProtectorDirtied = 24,
447
450
  kArraySpeciesModified = 25,
448
451
  kArrayPrototypeConstructorModified = 26,
449
- kArrayInstanceProtoModified V8_DEPRECATE_SOON("unused") = 27,
452
+ kOBSOLETE_ArrayInstanceProtoModified = 27,
450
453
  kArrayInstanceConstructorModified = 28,
451
- kLegacyFunctionDeclaration V8_DEPRECATE_SOON("unused") = 29,
452
- kRegExpPrototypeSourceGetter V8_DEPRECATE_SOON("unused") = 30,
453
- kRegExpPrototypeOldFlagGetter V8_DEPRECATE_SOON("unused") = 31,
454
+ kOBSOLETE_LegacyFunctionDeclaration = 29,
455
+ kOBSOLETE_RegExpPrototypeSourceGetter = 30,
456
+ kOBSOLETE_RegExpPrototypeOldFlagGetter = 31,
454
457
  kDecimalWithLeadingZeroInStrictMode = 32,
455
458
  kLegacyDateParser = 33,
456
459
  kDefineGetterOrSetterWouldThrow = 34,
@@ -458,22 +461,21 @@ class V8_EXPORT Isolate {
458
461
  kAssigmentExpressionLHSIsCallInSloppy = 36,
459
462
  kAssigmentExpressionLHSIsCallInStrict = 37,
460
463
  kPromiseConstructorReturnedUndefined = 38,
461
- kConstructorNonUndefinedPrimitiveReturn V8_DEPRECATE_SOON("unused") = 39,
462
- kLabeledExpressionStatement V8_DEPRECATE_SOON("unused") = 40,
463
- kLineOrParagraphSeparatorAsLineTerminator V8_DEPRECATE_SOON("unused") = 41,
464
+ kOBSOLETE_ConstructorNonUndefinedPrimitiveReturn = 39,
465
+ kOBSOLETE_LabeledExpressionStatement = 40,
466
+ kOBSOLETE_LineOrParagraphSeparatorAsLineTerminator = 41,
464
467
  kIndexAccessor = 42,
465
468
  kErrorCaptureStackTrace = 43,
466
469
  kErrorPrepareStackTrace = 44,
467
470
  kErrorStackTraceLimit = 45,
468
471
  kWebAssemblyInstantiation = 46,
469
472
  kDeoptimizerDisableSpeculation = 47,
470
- kArrayPrototypeSortJSArrayModifiedPrototype V8_DEPRECATE_SOON("unused") =
471
- 48,
473
+ kOBSOLETE_ArrayPrototypeSortJSArrayModifiedPrototype = 48,
472
474
  kFunctionTokenOffsetTooLongForToString = 49,
473
475
  kWasmSharedMemory = 50,
474
476
  kWasmThreadOpcodes = 51,
475
- kAtomicsNotify V8_DEPRECATE_SOON("unused") = 52,
476
- kAtomicsWake V8_DEPRECATE_SOON("unused") = 53,
477
+ kOBSOLETE_AtomicsNotify = 52,
478
+ kOBSOLETE_AtomicsWake = 53,
477
479
  kCollator = 54,
478
480
  kNumberFormat = 55,
479
481
  kDateTimeFormat = 56,
@@ -483,7 +485,7 @@ class V8_EXPORT Isolate {
483
485
  kListFormat = 60,
484
486
  kSegmenter = 61,
485
487
  kStringLocaleCompare = 62,
486
- kStringToLocaleUpperCase V8_DEPRECATE_SOON("unused") = 63,
488
+ kOBSOLETE_StringToLocaleUpperCase = 63,
487
489
  kStringToLocaleLowerCase = 64,
488
490
  kNumberToLocaleString = 65,
489
491
  kDateToLocaleString = 66,
@@ -491,14 +493,14 @@ class V8_EXPORT Isolate {
491
493
  kDateToLocaleTimeString = 68,
492
494
  kAttemptOverrideReadOnlyOnPrototypeSloppy = 69,
493
495
  kAttemptOverrideReadOnlyOnPrototypeStrict = 70,
494
- kOptimizedFunctionWithOneShotBytecode V8_DEPRECATE_SOON("unused") = 71,
496
+ kOBSOLETE_OptimizedFunctionWithOneShotBytecode = 71,
495
497
  kRegExpMatchIsTrueishOnNonJSRegExp = 72,
496
498
  kRegExpMatchIsFalseishOnJSRegExp = 73,
497
- kDateGetTimezoneOffset V8_DEPRECATE_SOON("unused") = 74,
499
+ kOBSOLETE_DateGetTimezoneOffset = 74,
498
500
  kStringNormalize = 75,
499
501
  kCallSiteAPIGetFunctionSloppyCall = 76,
500
502
  kCallSiteAPIGetThisSloppyCall = 77,
501
- kRegExpMatchAllWithNonGlobalRegExp V8_DEPRECATE_SOON("unused") = 78,
503
+ kOBSOLETE_RegExpMatchAllWithNonGlobalRegExp = 78,
502
504
  kRegExpExecCalledOnSlowRegExp = 79,
503
505
  kRegExpReplaceCalledOnSlowRegExp = 80,
504
506
  kDisplayNames = 81,
@@ -529,10 +531,8 @@ class V8_EXPORT Isolate {
529
531
  kWasmSimdOpcodes = 106,
530
532
  kVarRedeclaredCatchBinding = 107,
531
533
  kWasmRefTypes = 108,
532
- kWasmBulkMemory V8_DEPRECATE_SOON(
533
- "Unused since 2021 (https://crrev.com/c/2622913)") = 109,
534
- kWasmMultiValue V8_DEPRECATE_SOON(
535
- "Unused since 2021 (https://crrev.com/c/2817790)") = 110,
534
+ kOBSOLETE_WasmBulkMemory = 109,
535
+ kOBSOLETE_WasmMultiValue = 110,
536
536
  kWasmExceptionHandling = 111,
537
537
  kInvalidatedMegaDOMProtector = 112,
538
538
  kFunctionPrototypeArguments = 113,
@@ -541,8 +541,7 @@ class V8_EXPORT Isolate {
541
541
  kAsyncStackTaggingCreateTaskCall = 116,
542
542
  kDurationFormat = 117,
543
543
  kInvalidatedNumberStringNotRegexpLikeProtector = 118,
544
- kRegExpUnicodeSetIncompatibilitiesWithUnicodeMode V8_DEPRECATE_SOON(
545
- "unused") = 119,
544
+ kOBSOLETE_RegExpUnicodeSetIncompatibilitiesWithUnicodeMode = 119,
546
545
  kImportAssertionDeprecatedSyntax = 120,
547
546
  kLocaleInfoObsoletedGetters = 121,
548
547
  kLocaleInfoFunctions = 122,
@@ -551,6 +550,19 @@ class V8_EXPORT Isolate {
551
550
  kWasmMemory64 = 125,
552
551
  kWasmMultiMemory = 126,
553
552
  kWasmGC = 127,
553
+ kWasmImportedStrings = 128,
554
+ kSourceMappingUrlMagicCommentAtSign = 129,
555
+ kTemporalObject = 130,
556
+ kWasmModuleCompilation = 131,
557
+ kInvalidatedNoUndetectableObjectsProtector = 132,
558
+ kWasmJavaScriptPromiseIntegration = 133,
559
+ kWasmReturnCall = 134,
560
+ kWasmExtendedConst = 135,
561
+ kWasmRelaxedSimd = 136,
562
+ kWasmTypeReflection = 137,
563
+ kWasmExnRef = 138,
564
+ kWasmTypedFuncRef = 139,
565
+ kInvalidatedStringWrapperToPrimitiveProtector = 140,
554
566
 
555
567
  // If you add new values here, you'll also need to update Chromium's:
556
568
  // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
@@ -578,7 +590,7 @@ class V8_EXPORT Isolate {
578
590
  * Only Isolate::GetData() and Isolate::SetData(), which access the
579
591
  * embedder-controlled parts of the isolate, are allowed to be called on the
580
592
  * uninitialized isolate. To initialize the isolate, call
581
- * Isolate::Initialize().
593
+ * `Isolate::Initialize()` or initialize a `SnapshotCreator`.
582
594
  *
583
595
  * When an isolate is no longer used its resources should be freed
584
596
  * by calling Dispose(). Using the delete operator is not allowed.
@@ -694,6 +706,14 @@ class V8_EXPORT Isolate {
694
706
  */
695
707
  void MemoryPressureNotification(MemoryPressureLevel level);
696
708
 
709
+ /**
710
+ * Optional request from the embedder to tune v8 towards energy efficiency
711
+ * rather than speed if `battery_saver_mode_enabled` is true, because the
712
+ * embedder is in battery saver mode. If false, the correct tuning is left
713
+ * to v8 to decide.
714
+ */
715
+ void SetBatterySaverMode(bool battery_saver_mode_enabled);
716
+
697
717
  /**
698
718
  * Drop non-essential caches. Should only be called from testing code.
699
719
  * The method can potentially block for a long time and does not necessarily
@@ -769,6 +789,18 @@ class V8_EXPORT Isolate {
769
789
  template <class T>
770
790
  V8_INLINE MaybeLocal<T> GetDataFromSnapshotOnce(size_t index);
771
791
 
792
+ /**
793
+ * Returns the value that was set or restored by
794
+ * SetContinuationPreservedEmbedderData(), if any.
795
+ */
796
+ Local<Value> GetContinuationPreservedEmbedderData();
797
+
798
+ /**
799
+ * Sets a value that will be stored on continuations and reset while the
800
+ * continuation runs.
801
+ */
802
+ void SetContinuationPreservedEmbedderData(Local<Value> data);
803
+
772
804
  /**
773
805
  * Get statistics about the heap memory usage.
774
806
  */
@@ -1009,12 +1041,20 @@ class V8_EXPORT Isolate {
1009
1041
  *
1010
1042
  * Multi-threaded use requires the use of v8::Locker/v8::Unlocker, see
1011
1043
  * CppHeap.
1044
+ *
1045
+ * If a CppHeap is set via CreateParams, then this call is a noop.
1012
1046
  */
1047
+ V8_DEPRECATE_SOON(
1048
+ "Set the heap on Isolate creation using CreateParams instead.")
1013
1049
  void AttachCppHeap(CppHeap*);
1014
1050
 
1015
1051
  /**
1016
1052
  * Detaches a managed C++ heap if one was attached using `AttachCppHeap()`.
1053
+ *
1054
+ * If a CppHeap is set via CreateParams, then this call is a noop.
1017
1055
  */
1056
+ V8_DEPRECATE_SOON(
1057
+ "Set the heap on Isolate creation using CreateParams instead.")
1018
1058
  void DetachCppHeap();
1019
1059
 
1020
1060
  /**
@@ -1540,19 +1580,14 @@ class V8_EXPORT Isolate {
1540
1580
 
1541
1581
  void SetWasmLoadSourceMapCallback(WasmLoadSourceMapCallback callback);
1542
1582
 
1543
- /**
1544
- * Register callback to control whether Wasm GC is enabled.
1545
- * The callback overwrites the value of the flag.
1546
- * If the callback returns true, it will also enable Wasm stringrefs.
1547
- */
1548
- void SetWasmGCEnabledCallback(WasmGCEnabledCallback callback);
1549
-
1550
1583
  void SetWasmImportedStringsEnabledCallback(
1551
1584
  WasmImportedStringsEnabledCallback callback);
1552
1585
 
1553
1586
  void SetSharedArrayBufferConstructorEnabledCallback(
1554
1587
  SharedArrayBufferConstructorEnabledCallback callback);
1555
1588
 
1589
+ void SetWasmJSPIEnabledCallback(WasmJSPIEnabledCallback callback);
1590
+
1556
1591
  /**
1557
1592
  * Register callback to control whether compile hints magic comments are
1558
1593
  * enabled.
@@ -1712,12 +1747,12 @@ uint32_t Isolate::GetNumberOfDataSlots() {
1712
1747
 
1713
1748
  template <class T>
1714
1749
  MaybeLocal<T> Isolate::GetDataFromSnapshotOnce(size_t index) {
1715
- auto slot = GetDataFromSnapshotOnce(index);
1716
- if (slot) {
1750
+ if (auto slot = GetDataFromSnapshotOnce(index); slot) {
1717
1751
  internal::PerformCastCheck(
1718
1752
  internal::ValueHelper::SlotAsValue<T, false>(slot));
1753
+ return Local<T>::FromSlot(slot);
1719
1754
  }
1720
- return Local<T>::FromSlot(slot);
1755
+ return {};
1721
1756
  }
1722
1757
 
1723
1758
  } // namespace v8