node-aix-ppc64 20.9.0 → 21.1.0

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 (52) hide show
  1. package/CHANGELOG.md +354 -1654
  2. package/LICENSE +21 -10
  3. package/README.md +7 -5
  4. package/bin/node +0 -0
  5. package/include/node/common.gypi +3 -3
  6. package/include/node/config.gypi +5 -3
  7. package/include/node/cppgc/internal/api-constants.h +23 -4
  8. package/include/node/cppgc/internal/caged-heap-local-data.h +16 -6
  9. package/include/node/cppgc/internal/caged-heap.h +12 -5
  10. package/include/node/cppgc/internal/gc-info.h +82 -91
  11. package/include/node/cppgc/internal/member-storage.h +16 -8
  12. package/include/node/cppgc/member.h +25 -0
  13. package/include/node/cppgc/persistent.h +4 -0
  14. package/include/node/cppgc/platform.h +6 -1
  15. package/include/node/cppgc/sentinel-pointer.h +7 -0
  16. package/include/node/cppgc/source-location.h +2 -78
  17. package/include/node/cppgc/trace-trait.h +8 -0
  18. package/include/node/cppgc/visitor.h +82 -4
  19. package/include/node/js_native_api.h +11 -1
  20. package/include/node/libplatform/libplatform.h +7 -1
  21. package/include/node/node.exp +11941 -4880
  22. package/include/node/node.h +2 -0
  23. package/include/node/node_api.h +8 -7
  24. package/include/node/node_version.h +9 -8
  25. package/include/node/v8-callbacks.h +52 -8
  26. package/include/node/v8-context.h +10 -13
  27. package/include/node/v8-embedder-heap.h +12 -0
  28. package/include/node/v8-function-callback.h +11 -15
  29. package/include/node/v8-function.h +6 -0
  30. package/include/node/v8-handle-base.h +185 -0
  31. package/include/node/v8-internal.h +109 -77
  32. package/include/node/v8-isolate.h +130 -89
  33. package/include/node/v8-local-handle.h +134 -89
  34. package/include/node/v8-object.h +71 -69
  35. package/include/node/v8-persistent-handle.h +65 -89
  36. package/include/node/v8-platform.h +140 -9
  37. package/include/node/v8-primitive.h +12 -8
  38. package/include/node/v8-profiler.h +16 -2
  39. package/include/node/v8-script.h +9 -7
  40. package/include/node/v8-snapshot.h +4 -1
  41. package/include/node/v8-source-location.h +92 -0
  42. package/include/node/v8-statistics.h +36 -1
  43. package/include/node/v8-traced-handle.h +37 -54
  44. package/include/node/v8-unwinder.h +1 -1
  45. package/include/node/v8-value-serializer.h +14 -0
  46. package/include/node/v8-value.h +14 -0
  47. package/include/node/v8-version.h +3 -3
  48. package/include/node/v8config.h +19 -10
  49. package/package.json +1 -1
  50. package/share/doc/node/gdbinit +60 -6
  51. package/share/doc/node/lldb_commands.py +73 -10
  52. package/share/man/man1/node.1 +12 -0
@@ -12,7 +12,6 @@
12
12
  #include <atomic>
13
13
  #include <type_traits>
14
14
 
15
- #include "v8-version.h" // NOLINT(build/include_directory)
16
15
  #include "v8config.h" // NOLINT(build/include_directory)
17
16
 
18
17
  namespace v8 {
@@ -80,7 +79,7 @@ struct SmiTagging<4> {
80
79
  static_cast<intptr_t>(kUintptrAllBitsSet << (kSmiValueSize - 1));
81
80
  static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
82
81
 
83
- V8_INLINE static int SmiToInt(Address value) {
82
+ V8_INLINE static constexpr int SmiToInt(Address value) {
84
83
  int shift_bits = kSmiTagSize + kSmiShiftSize;
85
84
  // Truncate and shift down (requires >> to be sign extending).
86
85
  return static_cast<int32_t>(static_cast<uint32_t>(value)) >> shift_bits;
@@ -105,7 +104,7 @@ struct SmiTagging<8> {
105
104
  static_cast<intptr_t>(kUintptrAllBitsSet << (kSmiValueSize - 1));
106
105
  static constexpr intptr_t kSmiMaxValue = -(kSmiMinValue + 1);
107
106
 
108
- V8_INLINE static int SmiToInt(Address value) {
107
+ V8_INLINE static constexpr int SmiToInt(Address value) {
109
108
  int shift_bits = kSmiTagSize + kSmiShiftSize;
110
109
  // Shift down and throw away top 32 bits.
111
110
  return static_cast<int>(static_cast<intptr_t>(value) >> shift_bits);
@@ -247,20 +246,22 @@ static_assert(1ULL << (64 - kBoundedSizeShift) ==
247
246
  // size allows omitting bounds checks on table accesses if the indices are
248
247
  // guaranteed (e.g. through shifting) to be below the maximum index. This
249
248
  // value must be a power of two.
250
- static const size_t kExternalPointerTableReservationSize = 512 * MB;
249
+ constexpr size_t kExternalPointerTableReservationSize = 512 * MB;
251
250
 
252
251
  // The external pointer table indices stored in HeapObjects as external
253
252
  // pointers are shifted to the left by this amount to guarantee that they are
254
253
  // smaller than the maximum table size.
255
- static const uint32_t kExternalPointerIndexShift = 6;
254
+ constexpr uint32_t kExternalPointerIndexShift = 6;
256
255
  #else
257
- static const size_t kExternalPointerTableReservationSize = 1024 * MB;
258
- static const uint32_t kExternalPointerIndexShift = 5;
256
+ constexpr size_t kExternalPointerTableReservationSize = 1024 * MB;
257
+ constexpr uint32_t kExternalPointerIndexShift = 5;
259
258
  #endif // V8_TARGET_OS_ANDROID
260
259
 
261
260
  // The maximum number of entries in an external pointer table.
262
- static const size_t kMaxExternalPointers =
263
- kExternalPointerTableReservationSize / kApiSystemPointerSize;
261
+ constexpr int kExternalPointerTableEntrySize = 8;
262
+ constexpr int kExternalPointerTableEntrySizeLog2 = 3;
263
+ constexpr size_t kMaxExternalPointers =
264
+ kExternalPointerTableReservationSize / kExternalPointerTableEntrySize;
264
265
  static_assert((1 << (32 - kExternalPointerIndexShift)) == kMaxExternalPointers,
265
266
  "kExternalPointerTableReservationSize and "
266
267
  "kExternalPointerIndexShift don't match");
@@ -268,7 +269,7 @@ static_assert((1 << (32 - kExternalPointerIndexShift)) == kMaxExternalPointers,
268
269
  #else // !V8_COMPRESS_POINTERS
269
270
 
270
271
  // Needed for the V8.SandboxedExternalPointersCount histogram.
271
- static const size_t kMaxExternalPointers = 0;
272
+ constexpr size_t kMaxExternalPointers = 0;
272
273
 
273
274
  #endif // V8_COMPRESS_POINTERS
274
275
 
@@ -281,15 +282,21 @@ static const size_t kMaxExternalPointers = 0;
281
282
  // that it is smaller than the size of the table.
282
283
  using ExternalPointerHandle = uint32_t;
283
284
 
284
- // ExternalPointers point to objects located outside the sandbox. When
285
- // sandboxed external pointers are enabled, these are stored on heap as
286
- // ExternalPointerHandles, otherwise they are simply raw pointers.
285
+ // ExternalPointers point to objects located outside the sandbox. When the V8
286
+ // sandbox is enabled, these are stored on heap as ExternalPointerHandles,
287
+ // otherwise they are simply raw pointers.
287
288
  #ifdef V8_ENABLE_SANDBOX
288
289
  using ExternalPointer_t = ExternalPointerHandle;
289
290
  #else
290
291
  using ExternalPointer_t = Address;
291
292
  #endif
292
293
 
294
+ constexpr ExternalPointer_t kNullExternalPointer = 0;
295
+ constexpr ExternalPointerHandle kNullExternalPointerHandle = 0;
296
+
297
+ //
298
+ // External Pointers.
299
+ //
293
300
  // When the sandbox is enabled, external pointers are stored in an external
294
301
  // pointer table and are referenced from HeapObjects through an index (a
295
302
  // "handle"). When stored in the table, the pointers are tagged with per-type
@@ -359,6 +366,7 @@ using ExternalPointer_t = Address;
359
366
  // ExternalPointerTable.
360
367
  constexpr uint64_t kExternalPointerMarkBit = 1ULL << 62;
361
368
  constexpr uint64_t kExternalPointerTagMask = 0x40ff000000000000;
369
+ constexpr uint64_t kExternalPointerTagMaskWithoutMarkBit = 0xff000000000000;
362
370
  constexpr uint64_t kExternalPointerTagShift = 48;
363
371
 
364
372
  // All possible 8-bit type tags.
@@ -417,7 +425,8 @@ constexpr uint64_t kAllExternalPointerTypeTags[] = {
417
425
  V(kWasmTypeInfoNativeTypeTag, TAG(18)) \
418
426
  V(kWasmExportedFunctionDataSignatureTag, TAG(19)) \
419
427
  V(kWasmContinuationJmpbufTag, TAG(20)) \
420
- V(kArrayBufferExtensionTag, TAG(21))
428
+ V(kWasmIndirectFunctionTargetTag, TAG(21)) \
429
+ V(kArrayBufferExtensionTag, TAG(22))
421
430
 
422
431
  // All external pointer tags.
423
432
  #define ALL_EXTERNAL_POINTER_TAGS(V) \
@@ -430,7 +439,7 @@ constexpr uint64_t kAllExternalPointerTypeTags[] = {
430
439
  (HasMarkBit ? kExternalPointerMarkBit : 0))
431
440
  enum ExternalPointerTag : uint64_t {
432
441
  // Empty tag value. Mostly used as placeholder.
433
- kExternalPointerNullTag = MAKE_TAG(0, 0b00000000),
442
+ kExternalPointerNullTag = MAKE_TAG(1, 0b00000000),
434
443
  // External pointer tag that will match any external pointer. Use with care!
435
444
  kAnyExternalPointerTag = MAKE_TAG(1, 0b11111111),
436
445
  // The free entry tag has all type bits set so every type check with a
@@ -471,6 +480,74 @@ PER_ISOLATE_EXTERNAL_POINTER_TAGS(CHECK_NON_SHARED_EXTERNAL_POINTER_TAGS)
471
480
  #undef SHARED_EXTERNAL_POINTER_TAGS
472
481
  #undef EXTERNAL_POINTER_TAGS
473
482
 
483
+ //
484
+ // Indirect Pointers.
485
+ //
486
+ // When the sandbox is enabled, indirect pointers are used to reference
487
+ // HeapObjects that live outside of the sandbox (but are still managed through
488
+ // the GC). When object A references an object B through an indirect pointer,
489
+ // object A will contain a IndirectPointerHandle, i.e. a shifted 32-bit index,
490
+ // which identifies an entry in a pointer table (such as the CodePointerTable).
491
+ // This table entry then contains the actual pointer to object B. Further,
492
+ // object B owns this pointer table entry, and it is responsible for updating
493
+ // the "self-pointer" in the entry when it is relocated in memory. This way, in
494
+ // contrast to "normal" pointers, indirect pointers never need to be tracked by
495
+ // the GC (i.e. there is no remembered set for them).
496
+ // Currently there is only one type of object referenced through indirect
497
+ // pointers (Code objects), but once there are different types of such objects,
498
+ // the pointer table entry would probably also contain the type of the target
499
+ // object (e.g. by XORing the instance type into the top bits of the pointer).
500
+
501
+ // An IndirectPointerHandle represents a 32-bit index into a pointer table.
502
+ using IndirectPointerHandle = uint32_t;
503
+
504
+ // The indirect pointer handles are stores shifted to the left by this amount
505
+ // to guarantee that they are smaller than the maximum table size.
506
+ constexpr uint32_t kIndirectPointerHandleShift = 6;
507
+
508
+ // A null handle always references an entry that contains nullptr.
509
+ constexpr IndirectPointerHandle kNullIndirectPointerHandle = 0;
510
+
511
+ // Currently only Code objects can be referenced through indirect pointers and
512
+ // various places rely on that assumption. They will all static_assert against
513
+ // this constant to make them easy to find and fix once we reference other types
514
+ // of objects indirectly.
515
+ constexpr bool kAllIndirectPointerObjectsAreCode = true;
516
+
517
+ //
518
+ // Code Pointers.
519
+ //
520
+ // When the sandbox is enabled, Code objects are referenced from inside the
521
+ // sandbox through indirect pointers that reference entries in the code pointer
522
+ // table (CPT). Each entry in the CPT contains both a pointer to a Code object
523
+ // as well as a pointer to the Code's entrypoint. This allows calling/jumping
524
+ // into Code with one fewer memory access (compared to the case where the
525
+ // entrypoint pointer needs to be loaded from the Code object).
526
+ // As such, a CodePointerHandle can be used both to obtain the referenced Code
527
+ // object and to directly load its entrypoint pointer.
528
+ using CodePointerHandle = IndirectPointerHandle;
529
+ constexpr uint32_t kCodePointerHandleShift = kIndirectPointerHandleShift;
530
+ constexpr CodePointerHandle kNullCodePointerHandle = 0;
531
+
532
+ // The size of the virtual memory reservation for code pointer table.
533
+ // This determines the maximum number of entries in a table. Using a maximum
534
+ // size allows omitting bounds checks on table accesses if the indices are
535
+ // guaranteed (e.g. through shifting) to be below the maximum index. This
536
+ // value must be a power of two.
537
+ constexpr size_t kCodePointerTableReservationSize = 1 * GB;
538
+
539
+ // The maximum number of entries in an external pointer table.
540
+ constexpr int kCodePointerTableEntrySize = 16;
541
+ constexpr int kCodePointerTableEntrySizeLog2 = 4;
542
+ constexpr size_t kMaxCodePointers =
543
+ kCodePointerTableReservationSize / kCodePointerTableEntrySize;
544
+ static_assert(
545
+ (1 << (32 - kIndirectPointerHandleShift)) == kMaxCodePointers,
546
+ "kCodePointerTableReservationSize and kCodePointerHandleShift don't match");
547
+
548
+ constexpr int kCodePointerTableEntryEntrypointOffset = 0;
549
+ constexpr int kCodePointerTableEntryCodeObjectOffset = 8;
550
+
474
551
  // {obj} must be the raw tagged pointer representation of a HeapObject
475
552
  // that's guaranteed to never be in ReadOnlySpace.
476
553
  V8_EXPORT internal::Isolate* IsolateFromNeverReadOnlySpaceObject(Address obj);
@@ -517,15 +594,17 @@ class Internals {
517
594
  static const int kExternalOneByteRepresentationTag = 0x0a;
518
595
 
519
596
  static const uint32_t kNumIsolateDataSlots = 4;
520
- static const int kStackGuardSize = 7 * kApiSystemPointerSize;
597
+ static const int kStackGuardSize = 8 * kApiSystemPointerSize;
521
598
  static const int kBuiltinTier0EntryTableSize = 7 * kApiSystemPointerSize;
522
599
  static const int kBuiltinTier0TableSize = 7 * kApiSystemPointerSize;
523
600
  static const int kLinearAllocationAreaSize = 3 * kApiSystemPointerSize;
524
- static const int kThreadLocalTopSize = 25 * kApiSystemPointerSize;
601
+ static const int kThreadLocalTopSize = 30 * kApiSystemPointerSize;
602
+ static const int kHandleScopeDataSize =
603
+ 2 * kApiSystemPointerSize + 2 * kApiInt32Size;
525
604
 
526
605
  // ExternalPointerTable layout guarantees.
527
- static const int kExternalPointerTableBufferOffset = 0;
528
- static const int kExternalPointerTableSize = 4 * kApiSystemPointerSize;
606
+ static const int kExternalPointerTableBasePointerOffset = 0;
607
+ static const int kExternalPointerTableSize = 2 * kApiSystemPointerSize;
529
608
 
530
609
  // IsolateData layout guarantees.
531
610
  static const int kIsolateCageBaseOffset = 0;
@@ -551,19 +630,23 @@ class Internals {
551
630
  kIsolateFastApiCallTargetOffset + kApiSystemPointerSize;
552
631
  static const int kIsolateThreadLocalTopOffset =
553
632
  kIsolateLongTaskStatsCounterOffset + kApiSizetSize;
554
- static const int kIsolateEmbedderDataOffset =
633
+ static const int kIsolateHandleScopeDataOffset =
555
634
  kIsolateThreadLocalTopOffset + kThreadLocalTopSize;
635
+ static const int kIsolateEmbedderDataOffset =
636
+ kIsolateHandleScopeDataOffset + kHandleScopeDataSize;
556
637
  #ifdef V8_COMPRESS_POINTERS
557
638
  static const int kIsolateExternalPointerTableOffset =
558
639
  kIsolateEmbedderDataOffset + kNumIsolateDataSlots * kApiSystemPointerSize;
559
640
  static const int kIsolateSharedExternalPointerTableAddressOffset =
560
641
  kIsolateExternalPointerTableOffset + kExternalPointerTableSize;
561
- static const int kIsolateRootsOffset =
642
+ static const int kIsolateApiCallbackThunkArgumentOffset =
562
643
  kIsolateSharedExternalPointerTableAddressOffset + kApiSystemPointerSize;
563
644
  #else
564
- static const int kIsolateRootsOffset =
645
+ static const int kIsolateApiCallbackThunkArgumentOffset =
565
646
  kIsolateEmbedderDataOffset + kNumIsolateDataSlots * kApiSystemPointerSize;
566
647
  #endif
648
+ static const int kIsolateRootsOffset =
649
+ kIsolateApiCallbackThunkArgumentOffset + kApiSystemPointerSize;
567
650
 
568
651
  #if V8_STATIC_ROOTS_BOOL
569
652
 
@@ -641,11 +724,11 @@ class Internals {
641
724
  #endif
642
725
  }
643
726
 
644
- V8_INLINE static bool HasHeapObjectTag(Address value) {
727
+ V8_INLINE static constexpr bool HasHeapObjectTag(Address value) {
645
728
  return (value & kHeapObjectTagMask) == static_cast<Address>(kHeapObjectTag);
646
729
  }
647
730
 
648
- V8_INLINE static int SmiValue(Address value) {
731
+ V8_INLINE static constexpr int SmiValue(Address value) {
649
732
  return PlatformSmiTagging::SmiToInt(value);
650
733
  }
651
734
 
@@ -770,7 +853,7 @@ class Internals {
770
853
  V8_INLINE static Address* GetExternalPointerTableBase(v8::Isolate* isolate) {
771
854
  Address addr = reinterpret_cast<Address>(isolate) +
772
855
  kIsolateExternalPointerTableOffset +
773
- kExternalPointerTableBufferOffset;
856
+ kExternalPointerTableBasePointerOffset;
774
857
  return *reinterpret_cast<Address**>(addr);
775
858
  }
776
859
 
@@ -779,7 +862,7 @@ class Internals {
779
862
  Address addr = reinterpret_cast<Address>(isolate) +
780
863
  kIsolateSharedExternalPointerTableAddressOffset;
781
864
  addr = *reinterpret_cast<Address*>(addr);
782
- addr += kExternalPointerTableBufferOffset;
865
+ addr += kExternalPointerTableBasePointerOffset;
783
866
  return *reinterpret_cast<Address**>(addr);
784
867
  }
785
868
  #endif
@@ -901,57 +984,6 @@ class BackingStoreBase {};
901
984
  // This is needed for histograms sampling garbage collection reasons.
902
985
  constexpr int kGarbageCollectionReasonMaxValue = 27;
903
986
 
904
- // Helper functions about values contained in handles.
905
- class ValueHelper final {
906
- public:
907
- #ifdef V8_ENABLE_CONSERVATIVE_STACK_SCANNING
908
- static constexpr Address kLocalTaggedNullAddress = 1;
909
-
910
- template <typename T>
911
- static constexpr T* EmptyValue() {
912
- return reinterpret_cast<T*>(kLocalTaggedNullAddress);
913
- }
914
-
915
- template <typename T>
916
- V8_INLINE static Address ValueAsAddress(const T* value) {
917
- return reinterpret_cast<Address>(value);
918
- }
919
-
920
- template <typename T, typename S>
921
- V8_INLINE static T* SlotAsValue(S* slot) {
922
- return *reinterpret_cast<T**>(slot);
923
- }
924
-
925
- template <typename T>
926
- V8_INLINE static T* ValueAsSlot(T* const& value) {
927
- return reinterpret_cast<T*>(const_cast<T**>(&value));
928
- }
929
-
930
- #else // !V8_ENABLE_CONSERVATIVE_STACK_SCANNING
931
-
932
- template <typename T>
933
- static constexpr T* EmptyValue() {
934
- return nullptr;
935
- }
936
-
937
- template <typename T>
938
- V8_INLINE static Address ValueAsAddress(const T* value) {
939
- return *reinterpret_cast<const Address*>(value);
940
- }
941
-
942
- template <typename T, typename S>
943
- V8_INLINE static T* SlotAsValue(S* slot) {
944
- return reinterpret_cast<T*>(slot);
945
- }
946
-
947
- template <typename T>
948
- V8_INLINE static T* ValueAsSlot(T* const& value) {
949
- return value;
950
- }
951
-
952
- #endif // V8_ENABLE_CONSERVATIVE_STACK_SCANNING
953
- };
954
-
955
987
  } // namespace internal
956
988
  } // namespace v8
957
989
 
@@ -414,40 +414,43 @@ class V8_EXPORT Isolate {
414
414
  * Features reported via the SetUseCounterCallback callback. Do not change
415
415
  * assigned numbers of existing items; add new features to the end of this
416
416
  * list.
417
+ * Dead features can be marked `V8_DEPRECATE_SOON`, then `V8_DEPRECATED`, and
418
+ * then finally be renamed to `kOBSOLETE_...` to stop embedders from using
419
+ * them.
417
420
  */
418
421
  enum UseCounterFeature {
419
422
  kUseAsm = 0,
420
423
  kBreakIterator = 1,
421
- kLegacyConst = 2,
422
- kMarkDequeOverflow = 3,
423
- kStoreBufferOverflow = 4,
424
- kSlotsBufferOverflow = 5,
425
- kObjectObserve = 6,
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,
426
429
  kForcedGC = 7,
427
430
  kSloppyMode = 8,
428
431
  kStrictMode = 9,
429
- kStrongMode = 10,
432
+ kStrongMode V8_DEPRECATE_SOON("unused") = 10,
430
433
  kRegExpPrototypeStickyGetter = 11,
431
434
  kRegExpPrototypeToString = 12,
432
435
  kRegExpPrototypeUnicodeGetter = 13,
433
- kIntlV8Parse = 14,
434
- kIntlPattern = 15,
435
- kIntlResolved = 16,
436
- kPromiseChain = 17,
437
- kPromiseAccept = 18,
438
- kPromiseDefer = 19,
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
442
  kHtmlCommentInExternalScript = 20,
440
443
  kHtmlComment = 21,
441
444
  kSloppyModeBlockScopedFunctionRedefinition = 22,
442
445
  kForInInitializer = 23,
443
- kArrayProtectorDirtied = 24,
446
+ kArrayProtectorDirtied V8_DEPRECATE_SOON("unused") = 24,
444
447
  kArraySpeciesModified = 25,
445
448
  kArrayPrototypeConstructorModified = 26,
446
- kArrayInstanceProtoModified = 27,
449
+ kArrayInstanceProtoModified V8_DEPRECATE_SOON("unused") = 27,
447
450
  kArrayInstanceConstructorModified = 28,
448
- kLegacyFunctionDeclaration = 29,
449
- kRegExpPrototypeSourceGetter = 30, // Unused.
450
- kRegExpPrototypeOldFlagGetter = 31, // Unused.
451
+ kLegacyFunctionDeclaration V8_DEPRECATE_SOON("unused") = 29,
452
+ kRegExpPrototypeSourceGetter V8_DEPRECATE_SOON("unused") = 30,
453
+ kRegExpPrototypeOldFlagGetter V8_DEPRECATE_SOON("unused") = 31,
451
454
  kDecimalWithLeadingZeroInStrictMode = 32,
452
455
  kLegacyDateParser = 33,
453
456
  kDefineGetterOrSetterWouldThrow = 34,
@@ -455,21 +458,22 @@ class V8_EXPORT Isolate {
455
458
  kAssigmentExpressionLHSIsCallInSloppy = 36,
456
459
  kAssigmentExpressionLHSIsCallInStrict = 37,
457
460
  kPromiseConstructorReturnedUndefined = 38,
458
- kConstructorNonUndefinedPrimitiveReturn = 39,
459
- kLabeledExpressionStatement = 40,
460
- kLineOrParagraphSeparatorAsLineTerminator = 41,
461
+ kConstructorNonUndefinedPrimitiveReturn V8_DEPRECATE_SOON("unused") = 39,
462
+ kLabeledExpressionStatement V8_DEPRECATE_SOON("unused") = 40,
463
+ kLineOrParagraphSeparatorAsLineTerminator V8_DEPRECATE_SOON("unused") = 41,
461
464
  kIndexAccessor = 42,
462
465
  kErrorCaptureStackTrace = 43,
463
466
  kErrorPrepareStackTrace = 44,
464
467
  kErrorStackTraceLimit = 45,
465
468
  kWebAssemblyInstantiation = 46,
466
469
  kDeoptimizerDisableSpeculation = 47,
467
- kArrayPrototypeSortJSArrayModifiedPrototype = 48,
470
+ kArrayPrototypeSortJSArrayModifiedPrototype V8_DEPRECATE_SOON("unused") =
471
+ 48,
468
472
  kFunctionTokenOffsetTooLongForToString = 49,
469
473
  kWasmSharedMemory = 50,
470
474
  kWasmThreadOpcodes = 51,
471
- kAtomicsNotify = 52, // Unused.
472
- kAtomicsWake = 53, // Unused.
475
+ kAtomicsNotify V8_DEPRECATE_SOON("unused") = 52,
476
+ kAtomicsWake V8_DEPRECATE_SOON("unused") = 53,
473
477
  kCollator = 54,
474
478
  kNumberFormat = 55,
475
479
  kDateTimeFormat = 56,
@@ -479,7 +483,7 @@ class V8_EXPORT Isolate {
479
483
  kListFormat = 60,
480
484
  kSegmenter = 61,
481
485
  kStringLocaleCompare = 62,
482
- kStringToLocaleUpperCase = 63,
486
+ kStringToLocaleUpperCase V8_DEPRECATE_SOON("unused") = 63,
483
487
  kStringToLocaleLowerCase = 64,
484
488
  kNumberToLocaleString = 65,
485
489
  kDateToLocaleString = 66,
@@ -487,14 +491,14 @@ class V8_EXPORT Isolate {
487
491
  kDateToLocaleTimeString = 68,
488
492
  kAttemptOverrideReadOnlyOnPrototypeSloppy = 69,
489
493
  kAttemptOverrideReadOnlyOnPrototypeStrict = 70,
490
- kOptimizedFunctionWithOneShotBytecode = 71, // Unused.
494
+ kOptimizedFunctionWithOneShotBytecode V8_DEPRECATE_SOON("unused") = 71,
491
495
  kRegExpMatchIsTrueishOnNonJSRegExp = 72,
492
496
  kRegExpMatchIsFalseishOnJSRegExp = 73,
493
- kDateGetTimezoneOffset = 74, // Unused.
497
+ kDateGetTimezoneOffset V8_DEPRECATE_SOON("unused") = 74,
494
498
  kStringNormalize = 75,
495
499
  kCallSiteAPIGetFunctionSloppyCall = 76,
496
500
  kCallSiteAPIGetThisSloppyCall = 77,
497
- kRegExpMatchAllWithNonGlobalRegExp = 78,
501
+ kRegExpMatchAllWithNonGlobalRegExp V8_DEPRECATE_SOON("unused") = 78,
498
502
  kRegExpExecCalledOnSlowRegExp = 79,
499
503
  kRegExpReplaceCalledOnSlowRegExp = 80,
500
504
  kDisplayNames = 81,
@@ -525,8 +529,10 @@ class V8_EXPORT Isolate {
525
529
  kWasmSimdOpcodes = 106,
526
530
  kVarRedeclaredCatchBinding = 107,
527
531
  kWasmRefTypes = 108,
528
- kWasmBulkMemory = 109, // Unused.
529
- kWasmMultiValue = 110,
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,
530
536
  kWasmExceptionHandling = 111,
531
537
  kInvalidatedMegaDOMProtector = 112,
532
538
  kFunctionPrototypeArguments = 113,
@@ -534,8 +540,17 @@ class V8_EXPORT Isolate {
534
540
  kTurboFanOsrCompileStarted = 115,
535
541
  kAsyncStackTaggingCreateTaskCall = 116,
536
542
  kDurationFormat = 117,
537
- kInvalidatedNumberStringPrototypeNoReplaceProtector = 118,
538
- kRegExpUnicodeSetIncompatibilitiesWithUnicodeMode = 119, // Unused.
543
+ kInvalidatedNumberStringNotRegexpLikeProtector = 118,
544
+ kRegExpUnicodeSetIncompatibilitiesWithUnicodeMode V8_DEPRECATE_SOON(
545
+ "unused") = 119,
546
+ kImportAssertionDeprecatedSyntax = 120,
547
+ kLocaleInfoObsoletedGetters = 121,
548
+ kLocaleInfoFunctions = 122,
549
+ kCompileHintsMagicAll = 123,
550
+ kInvalidatedNoProfilingProtector = 124,
551
+ kWasmMemory64 = 125,
552
+ kWasmMultiMemory = 126,
553
+ kWasmGC = 127,
539
554
 
540
555
  // If you add new values here, you'll also need to update Chromium's:
541
556
  // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
@@ -664,6 +679,13 @@ class V8_EXPORT Isolate {
664
679
  */
665
680
  void SetPrepareStackTraceCallback(PrepareStackTraceCallback callback);
666
681
 
682
+ #if defined(V8_OS_WIN)
683
+ /**
684
+ * This specifies the callback called when an ETW tracing session starts.
685
+ */
686
+ void SetFilterETWSessionByURLCallback(FilterETWSessionByURLCallback callback);
687
+ #endif // V8_OS_WIN
688
+
667
689
  /**
668
690
  * Optional notification that the system is running low on memory.
669
691
  * V8 uses these notifications to guide heuristics.
@@ -904,25 +926,73 @@ class V8_EXPORT Isolate {
904
926
 
905
927
  /**
906
928
  * Enables the host application to receive a notification before a
907
- * garbage collection. Allocations are allowed in the callback function,
908
- * but the callback is not re-entrant: if the allocation inside it will
909
- * trigger the garbage collection, the callback won't be called again.
910
- * It is possible to specify the GCType filter for your callback. But it is
911
- * not possible to register the same callback function two times with
912
- * different GCType filters.
929
+ * garbage collection.
930
+ *
931
+ * \param callback The callback to be invoked. The callback is allowed to
932
+ * allocate but invocation is not re-entrant: a callback triggering
933
+ * garbage collection will not be called again. JS execution is prohibited
934
+ * from these callbacks. A single callback may only be registered once.
935
+ * \param gc_type_filter A filter in case it should be applied.
913
936
  */
914
- void AddGCPrologueCallback(GCCallbackWithData callback, void* data = nullptr,
915
- GCType gc_type_filter = kGCTypeAll);
916
937
  void AddGCPrologueCallback(GCCallback callback,
917
938
  GCType gc_type_filter = kGCTypeAll);
918
939
 
919
940
  /**
920
- * This function removes callback which was installed by
921
- * AddGCPrologueCallback function.
941
+ * \copydoc AddGCPrologueCallback(GCCallback, GCType)
942
+ *
943
+ * \param data Additional data that should be passed to the callback.
944
+ */
945
+ void AddGCPrologueCallback(GCCallbackWithData callback, void* data = nullptr,
946
+ GCType gc_type_filter = kGCTypeAll);
947
+
948
+ /**
949
+ * This function removes a callback which was added by
950
+ * `AddGCPrologueCallback`.
951
+ *
952
+ * \param callback the callback to remove.
922
953
  */
923
- void RemoveGCPrologueCallback(GCCallbackWithData, void* data = nullptr);
924
954
  void RemoveGCPrologueCallback(GCCallback callback);
925
955
 
956
+ /**
957
+ * \copydoc AddGCPrologueCallback(GCCallback)
958
+ *
959
+ * \param data Additional data that was used to install the callback.
960
+ */
961
+ void RemoveGCPrologueCallback(GCCallbackWithData, void* data = nullptr);
962
+
963
+ /**
964
+ * Enables the host application to receive a notification after a
965
+ * garbage collection.
966
+ *
967
+ * \copydetails AddGCPrologueCallback(GCCallback, GCType)
968
+ */
969
+ void AddGCEpilogueCallback(GCCallback callback,
970
+ GCType gc_type_filter = kGCTypeAll);
971
+
972
+ /**
973
+ * \copydoc AddGCEpilogueCallback(GCCallback, GCType)
974
+ *
975
+ * \param data Additional data that should be passed to the callback.
976
+ */
977
+ void AddGCEpilogueCallback(GCCallbackWithData callback, void* data = nullptr,
978
+ GCType gc_type_filter = kGCTypeAll);
979
+
980
+ /**
981
+ * This function removes a callback which was added by
982
+ * `AddGCEpilogueCallback`.
983
+ *
984
+ * \param callback the callback to remove.
985
+ */
986
+ void RemoveGCEpilogueCallback(GCCallback callback);
987
+
988
+ /**
989
+ * \copydoc RemoveGCEpilogueCallback(GCCallback)
990
+ *
991
+ * \param data Additional data that was used to install the callback.
992
+ */
993
+ void RemoveGCEpilogueCallback(GCCallbackWithData callback,
994
+ void* data = nullptr);
995
+
926
996
  /**
927
997
  * Sets an embedder roots handle that V8 should consider when performing
928
998
  * non-unified heap garbage collections. The intended use case is for setting
@@ -1032,28 +1102,6 @@ class V8_EXPORT Isolate {
1032
1102
  */
1033
1103
  void SetAtomicsWaitCallback(AtomicsWaitCallback callback, void* data);
1034
1104
 
1035
- /**
1036
- * Enables the host application to receive a notification after a
1037
- * garbage collection. Allocations are allowed in the callback function,
1038
- * but the callback is not re-entrant: if the allocation inside it will
1039
- * trigger the garbage collection, the callback won't be called again.
1040
- * It is possible to specify the GCType filter for your callback. But it is
1041
- * not possible to register the same callback function two times with
1042
- * different GCType filters.
1043
- */
1044
- void AddGCEpilogueCallback(GCCallbackWithData callback, void* data = nullptr,
1045
- GCType gc_type_filter = kGCTypeAll);
1046
- void AddGCEpilogueCallback(GCCallback callback,
1047
- GCType gc_type_filter = kGCTypeAll);
1048
-
1049
- /**
1050
- * This function removes callback which was installed by
1051
- * AddGCEpilogueCallback function.
1052
- */
1053
- void RemoveGCEpilogueCallback(GCCallbackWithData callback,
1054
- void* data = nullptr);
1055
- void RemoveGCEpilogueCallback(GCCallback callback);
1056
-
1057
1105
  using GetExternallyAllocatedMemoryInBytesCallback = size_t (*)();
1058
1106
 
1059
1107
  /**
@@ -1321,20 +1369,6 @@ class V8_EXPORT Isolate {
1321
1369
  */
1322
1370
  void IsolateInBackgroundNotification();
1323
1371
 
1324
- /**
1325
- * Optional notification which will enable the memory savings mode.
1326
- * V8 uses this notification to guide heuristics which may result in a
1327
- * smaller memory footprint at the cost of reduced runtime performance.
1328
- */
1329
- V8_DEPRECATED("Use IsolateInBackgroundNotification() instead")
1330
- void EnableMemorySavingsMode();
1331
-
1332
- /**
1333
- * Optional notification which will disable the memory savings mode.
1334
- */
1335
- V8_DEPRECATED("Use IsolateInBackgroundNotification() instead")
1336
- void DisableMemorySavingsMode();
1337
-
1338
1372
  /**
1339
1373
  * Optional notification to tell V8 the current performance requirements
1340
1374
  * of the embedder based on RAIL.
@@ -1506,22 +1540,26 @@ class V8_EXPORT Isolate {
1506
1540
 
1507
1541
  void SetWasmLoadSourceMapCallback(WasmLoadSourceMapCallback callback);
1508
1542
 
1509
- V8_DEPRECATED("Wasm SIMD is always enabled")
1510
- void SetWasmSimdEnabledCallback(WasmSimdEnabledCallback callback);
1511
-
1512
- V8_DEPRECATED("Wasm exceptions are always enabled")
1513
- void SetWasmExceptionsEnabledCallback(WasmExceptionsEnabledCallback callback);
1514
-
1515
1543
  /**
1516
- * Register callback to control whehter Wasm GC is enabled.
1544
+ * Register callback to control whether Wasm GC is enabled.
1517
1545
  * The callback overwrites the value of the flag.
1518
1546
  * If the callback returns true, it will also enable Wasm stringrefs.
1519
1547
  */
1520
1548
  void SetWasmGCEnabledCallback(WasmGCEnabledCallback callback);
1521
1549
 
1550
+ void SetWasmImportedStringsEnabledCallback(
1551
+ WasmImportedStringsEnabledCallback callback);
1552
+
1522
1553
  void SetSharedArrayBufferConstructorEnabledCallback(
1523
1554
  SharedArrayBufferConstructorEnabledCallback callback);
1524
1555
 
1556
+ /**
1557
+ * Register callback to control whether compile hints magic comments are
1558
+ * enabled.
1559
+ */
1560
+ void SetJavaScriptCompileHintsMagicEnabledCallback(
1561
+ JavaScriptCompileHintsMagicEnabledCallback callback);
1562
+
1525
1563
  /**
1526
1564
  * This function can be called by the embedder to signal V8 that the dynamic
1527
1565
  * enabling of features has finished. V8 can now set up dynamically added
@@ -1583,6 +1621,7 @@ class V8_EXPORT Isolate {
1583
1621
  * heap. GC is not invoked prior to iterating, therefore there is no
1584
1622
  * guarantee that visited objects are still alive.
1585
1623
  */
1624
+ V8_DEPRECATE_SOON("Will be removed without replacement. crbug.com/v8/14172")
1586
1625
  void VisitExternalResources(ExternalResourceVisitor* visitor);
1587
1626
 
1588
1627
  /**
@@ -1673,10 +1712,12 @@ uint32_t Isolate::GetNumberOfDataSlots() {
1673
1712
 
1674
1713
  template <class T>
1675
1714
  MaybeLocal<T> Isolate::GetDataFromSnapshotOnce(size_t index) {
1676
- T* data =
1677
- internal::ValueHelper::SlotAsValue<T>(GetDataFromSnapshotOnce(index));
1678
- if (data) internal::PerformCastCheck(data);
1679
- return Local<T>(data);
1715
+ auto slot = GetDataFromSnapshotOnce(index);
1716
+ if (slot) {
1717
+ internal::PerformCastCheck(
1718
+ internal::ValueHelper::SlotAsValue<T, false>(slot));
1719
+ }
1720
+ return Local<T>::FromSlot(slot);
1680
1721
  }
1681
1722
 
1682
1723
  } // namespace v8