libv8-node 23.6.1.0-x86_64-linux → 24.1.0.0-x86_64-linux

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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/lib/libv8/node/version.rb +3 -3
  3. data/vendor/v8/include/cppgc/allocation.h +1 -2
  4. data/vendor/v8/include/cppgc/default-platform.h +3 -2
  5. data/vendor/v8/include/cppgc/heap-consistency.h +1 -1
  6. data/vendor/v8/include/cppgc/internal/api-constants.h +0 -17
  7. data/vendor/v8/include/cppgc/internal/base-page-handle.h +2 -4
  8. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +0 -4
  9. data/vendor/v8/include/cppgc/internal/caged-heap.h +0 -4
  10. data/vendor/v8/include/cppgc/internal/conditional-stack-allocated.h +41 -0
  11. data/vendor/v8/include/cppgc/internal/logging.h +3 -3
  12. data/vendor/v8/include/cppgc/internal/member-storage.h +63 -20
  13. data/vendor/v8/include/cppgc/internal/persistent-node.h +8 -3
  14. data/vendor/v8/include/cppgc/internal/pointer-policies.h +48 -11
  15. data/vendor/v8/include/cppgc/macros.h +21 -0
  16. data/vendor/v8/include/cppgc/member.h +70 -36
  17. data/vendor/v8/include/cppgc/name-provider.h +3 -0
  18. data/vendor/v8/include/cppgc/platform.h +11 -0
  19. data/vendor/v8/include/cppgc/type-traits.h +1 -0
  20. data/vendor/v8/include/cppgc/visitor.h +25 -1
  21. data/vendor/v8/include/libplatform/libplatform-export.h +2 -2
  22. data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
  23. data/vendor/v8/include/v8-array-buffer.h +111 -34
  24. data/vendor/v8/include/v8-callbacks.h +84 -26
  25. data/vendor/v8/include/v8-context.h +7 -6
  26. data/vendor/v8/include/v8-cppgc.h +2 -1
  27. data/vendor/v8/include/v8-data.h +5 -0
  28. data/vendor/v8/include/v8-debug.h +11 -0
  29. data/vendor/v8/include/v8-embedder-heap.h +1 -32
  30. data/vendor/v8/include/v8-exception.h +2 -0
  31. data/vendor/v8/include/v8-external-memory-accounter.h +60 -0
  32. data/vendor/v8/include/v8-fast-api-calls.h +17 -175
  33. data/vendor/v8/include/v8-function-callback.h +4 -33
  34. data/vendor/v8/include/v8-function.h +7 -0
  35. data/vendor/v8/include/v8-handle-base.h +18 -0
  36. data/vendor/v8/include/v8-initialization.h +9 -1
  37. data/vendor/v8/include/v8-inspector.h +8 -4
  38. data/vendor/v8/include/v8-internal.h +477 -399
  39. data/vendor/v8/include/v8-isolate.h +218 -151
  40. data/vendor/v8/include/v8-local-handle.h +56 -28
  41. data/vendor/v8/include/v8-maybe.h +2 -1
  42. data/vendor/v8/include/v8-memory-span.h +149 -24
  43. data/vendor/v8/include/v8-message.h +9 -1
  44. data/vendor/v8/include/v8-metrics.h +10 -0
  45. data/vendor/v8/include/v8-object.h +7 -2
  46. data/vendor/v8/include/v8-persistent-handle.h +17 -17
  47. data/vendor/v8/include/v8-platform.h +48 -13
  48. data/vendor/v8/include/v8-primitive.h +131 -6
  49. data/vendor/v8/include/v8-profiler.h +13 -1
  50. data/vendor/v8/include/v8-proxy.h +0 -1
  51. data/vendor/v8/include/v8-regexp.h +0 -1
  52. data/vendor/v8/include/v8-sandbox.h +3 -3
  53. data/vendor/v8/include/v8-script.h +21 -3
  54. data/vendor/v8/include/v8-source-location.h +6 -1
  55. data/vendor/v8/include/v8-template.h +8 -2
  56. data/vendor/v8/include/v8-trace-categories.h +23 -0
  57. data/vendor/v8/include/v8-traced-handle.h +16 -17
  58. data/vendor/v8/include/v8-typed-array.h +6 -10
  59. data/vendor/v8/include/v8-unwinder-state.h +2 -3
  60. data/vendor/v8/include/v8-value-serializer-version.h +3 -3
  61. data/vendor/v8/include/v8-value.h +18 -0
  62. data/vendor/v8/include/v8-version.h +4 -4
  63. data/vendor/v8/include/v8-wasm.h +24 -0
  64. data/vendor/v8/include/v8-weak-callback-info.h +20 -12
  65. data/vendor/v8/include/v8.h +3 -3
  66. data/vendor/v8/include/v8config.h +34 -40
  67. data/vendor/v8/x86_64-linux/libv8/obj/libv8_monolith.a +0 -0
  68. metadata +5 -3
  69. data/vendor/v8/include/cppgc/ephemeron-pair.h +0 -30
@@ -164,28 +164,6 @@ class V8_EXPORT ResourceConstraints {
164
164
  uint32_t* stack_limit_ = nullptr;
165
165
  };
166
166
 
167
- /**
168
- * Option flags passed to the SetRAILMode function.
169
- * See documentation https://developers.google.com/web/tools/chrome-devtools/
170
- * profile/evaluate-performance/rail
171
- */
172
- enum RAILMode : unsigned {
173
- // Response performance mode: In this mode very low virtual machine latency
174
- // is provided. V8 will try to avoid JavaScript execution interruptions.
175
- // Throughput may be throttled.
176
- PERFORMANCE_RESPONSE,
177
- // Animation performance mode: In this mode low virtual machine latency is
178
- // provided. V8 will try to avoid as many JavaScript execution interruptions
179
- // as possible. Throughput may be throttled. This is the default mode.
180
- PERFORMANCE_ANIMATION,
181
- // Idle performance mode: The embedder is idle. V8 can complete deferred work
182
- // in this mode.
183
- PERFORMANCE_IDLE,
184
- // Load performance mode: In this mode high throughput is provided. V8 may
185
- // turn off latency optimizations.
186
- PERFORMANCE_LOAD
187
- };
188
-
189
167
  /**
190
168
  * Memory pressure level for the MemoryPressureNotification.
191
169
  * kNone hints V8 that there is no memory pressure.
@@ -196,11 +174,95 @@ enum RAILMode : unsigned {
196
174
  */
197
175
  enum class MemoryPressureLevel { kNone, kModerate, kCritical };
198
176
 
177
+ /**
178
+ * Signal for dependants of contexts. Useful for
179
+ * `ContextDisposedNotification()` to implement different strategies.
180
+ */
181
+ enum class ContextDependants {
182
+ /** Context has no dependants. These are usually top-level contexts. */
183
+ kNoDependants,
184
+ /** Context has some dependants, i.e., it may depend on other contexts. This
185
+ is usually the case for inner contexts. */
186
+ kSomeDependants
187
+ };
188
+
199
189
  /**
200
190
  * Indicator for the stack state.
201
191
  */
202
192
  using StackState = cppgc::EmbedderStackState;
203
193
 
194
+ /**
195
+ * The set of V8 isolates in a process is partitioned into groups. Each group
196
+ * has its own sandbox (if V8 was configured with support for the sandbox) and
197
+ * pointer-compression cage (if configured with pointer compression).
198
+ *
199
+ * By default, all isolates are placed in the same group. This is the most
200
+ * efficient configuration in terms of speed and memory use. However, with
201
+ * pointer compression enabled, total heap usage of isolates in a group
202
+ * cannot exceed 4 GB, not counting array buffers and other off-heap storage.
203
+ * Using multiple isolate groups can allow embedders to allocate more than 4GB
204
+ * of objects with pointer compression enabled, if the embedder's use case can
205
+ * span multiple isolates.
206
+ *
207
+ * Creating an isolate group reserves a range of virtual memory addresses. A
208
+ * group's memory mapping will be released when the last isolate in the group is
209
+ * disposed, and there are no more live IsolateGroup objects that refer to it.
210
+ *
211
+ * Note that Isolate groups are reference counted, and
212
+ * the IsolateGroup type is a reference to one.
213
+ *
214
+ * Note that it's not going to be possible to pass shared JS objects
215
+ * across IsolateGroup boundary.
216
+ *
217
+ */
218
+ class V8_EXPORT IsolateGroup {
219
+ public:
220
+ /**
221
+ * Get the default isolate group. If this V8's build configuration only
222
+ * supports a single group, this is a reference to that single group.
223
+ * Otherwise this is a group like any other, distinguished only
224
+ * in that it is the first group.
225
+ */
226
+ static IsolateGroup GetDefault();
227
+
228
+ /**
229
+ * Return true if new isolate groups can be created at run-time, or false if
230
+ * all isolates must be in the same group.
231
+ */
232
+ static bool CanCreateNewGroups();
233
+
234
+ /**
235
+ * Create a new isolate group. If this V8's build configuration only supports
236
+ * a single group, abort.
237
+ */
238
+ static IsolateGroup Create();
239
+
240
+ IsolateGroup(IsolateGroup&& other);
241
+ IsolateGroup& operator=(IsolateGroup&& other);
242
+
243
+ IsolateGroup(const IsolateGroup&);
244
+ IsolateGroup& operator=(const IsolateGroup&);
245
+
246
+ ~IsolateGroup();
247
+
248
+ bool operator==(const IsolateGroup& other) const {
249
+ return isolate_group_ == other.isolate_group_;
250
+ }
251
+
252
+ bool operator!=(const IsolateGroup& other) const {
253
+ return !operator==(other);
254
+ }
255
+
256
+ private:
257
+ friend class Isolate;
258
+ friend class ArrayBuffer::Allocator;
259
+
260
+ // The isolate_group pointer should be already acquired.
261
+ explicit IsolateGroup(internal::IsolateGroup*&& isolate_group);
262
+
263
+ internal::IsolateGroup* isolate_group_;
264
+ };
265
+
204
266
  /**
205
267
  * Isolate represents an isolated instance of the V8 engine. V8 isolates have
206
268
  * completely separate states. Objects from one isolate must not be used in
@@ -524,7 +586,7 @@ class V8_EXPORT Isolate {
524
586
  kDurationFormat = 117,
525
587
  kInvalidatedNumberStringNotRegexpLikeProtector = 118,
526
588
  kOBSOLETE_RegExpUnicodeSetIncompatibilitiesWithUnicodeMode = 119,
527
- kImportAssertionDeprecatedSyntax = 120,
589
+ kOBSOLETE_ImportAssertionDeprecatedSyntax = 120,
528
590
  kLocaleInfoObsoletedGetters = 121,
529
591
  kLocaleInfoFunctions = 122,
530
592
  kCompileHintsMagicAll = 123,
@@ -548,6 +610,30 @@ class V8_EXPORT Isolate {
548
610
  kDocumentAllLegacyCall = 141,
549
611
  kDocumentAllLegacyConstruct = 142,
550
612
  kConsoleContext = 143,
613
+ kWasmImportedStringsUtf8 = 144,
614
+ kResizableArrayBuffer = 145,
615
+ kGrowableSharedArrayBuffer = 146,
616
+ kArrayByCopy = 147,
617
+ kArrayFromAsync = 148,
618
+ kIteratorMethods = 149,
619
+ kPromiseAny = 150,
620
+ kSetMethods = 151,
621
+ kArrayFindLast = 152,
622
+ kArrayGroup = 153,
623
+ kArrayBufferTransfer = 154,
624
+ kPromiseWithResolvers = 155,
625
+ kAtomicsWaitAsync = 156,
626
+ kExtendingNonExtensibleWithPrivate = 157,
627
+ kPromiseTry = 158,
628
+ kStringReplaceAll = 159,
629
+ kStringWellFormed = 160,
630
+ kWeakReferences = 161,
631
+ kErrorIsError = 162,
632
+ kInvalidatedTypedArrayLengthLookupChainProtector = 163,
633
+ kRegExpEscape = 164,
634
+ kFloat16Array = 165,
635
+ kExplicitResourceManagement = 166,
636
+ kWasmBranchHinting = 167,
551
637
 
552
638
  // If you add new values here, you'll also need to update Chromium's:
553
639
  // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
@@ -588,9 +674,9 @@ class V8_EXPORT Isolate {
588
674
  * currently entered isolate.
589
675
  *
590
676
  * Only Isolate::GetData() and Isolate::SetData(), which access the
591
- * embedder-controlled parts of the isolate, are allowed to be called on the
592
- * uninitialized isolate. To initialize the isolate, call
593
- * `Isolate::Initialize()` or initialize a `SnapshotCreator`.
677
+ * embedder-controlled parts of the isolate, as well as Isolate::GetGroup(),
678
+ * are allowed to be called on the uninitialized isolate. To initialize the
679
+ * isolate, call `Isolate::Initialize()` or initialize a `SnapshotCreator`.
594
680
  *
595
681
  * When an isolate is no longer used its resources should be freed
596
682
  * by calling Dispose(). Using the delete operator is not allowed.
@@ -598,6 +684,12 @@ class V8_EXPORT Isolate {
598
684
  * V8::Initialize() must have run prior to this.
599
685
  */
600
686
  static Isolate* Allocate();
687
+ static Isolate* Allocate(const IsolateGroup& group);
688
+
689
+ /**
690
+ * Return the group for this isolate.
691
+ */
692
+ IsolateGroup GetGroup() const;
601
693
 
602
694
  /**
603
695
  * Initialize an Isolate previously allocated by Isolate::Allocate().
@@ -614,6 +706,7 @@ class V8_EXPORT Isolate {
614
706
  * V8::Initialize() must have run prior to this.
615
707
  */
616
708
  static Isolate* New(const CreateParams& params);
709
+ static Isolate* New(const IsolateGroup& group, const CreateParams& params);
617
710
 
618
711
  /**
619
712
  * Returns the entered isolate for the current thread or NULL in
@@ -671,6 +764,18 @@ class V8_EXPORT Isolate {
671
764
  void SetHostImportModuleDynamicallyCallback(
672
765
  HostImportModuleDynamicallyCallback callback);
673
766
 
767
+ /**
768
+ * This specifies the callback called by the upcoming dynamic
769
+ * import() and import.source() language feature to load modules.
770
+ *
771
+ * This API is experimental and is expected to be changed or removed in the
772
+ * future. The callback is currently only called when for source-phase
773
+ * imports. Evaluation-phase imports use the existing
774
+ * HostImportModuleDynamicallyCallback callback.
775
+ */
776
+ void SetHostImportModuleWithPhaseDynamicallyCallback(
777
+ HostImportModuleWithPhaseDynamicallyCallback callback);
778
+
674
779
  /**
675
780
  * This specifies the callback called by the upcoming import.meta
676
781
  * language feature to retrieve host-defined meta data for a module.
@@ -685,6 +790,14 @@ class V8_EXPORT Isolate {
685
790
  void SetHostCreateShadowRealmContextCallback(
686
791
  HostCreateShadowRealmContextCallback callback);
687
792
 
793
+ /**
794
+ * Set the callback that checks whether a Error.isError should return true for
795
+ * a JSApiWrapper object, i.e. whether it represents a native JS error. For
796
+ * example, in an HTML embedder, DOMExceptions are considered native errors.
797
+ */
798
+ void SetIsJSApiWrapperNativeErrorCallback(
799
+ IsJSApiWrapperNativeErrorCallback callback);
800
+
688
801
  /**
689
802
  * This specifies the callback called when the stack property of Error
690
803
  * is accessed.
@@ -700,7 +813,10 @@ class V8_EXPORT Isolate {
700
813
  /**
701
814
  * This specifies the callback called when an ETW tracing session starts.
702
815
  */
816
+ V8_DEPRECATE_SOON("Use SetFilterETWSessionByURL2Callback instead")
703
817
  void SetFilterETWSessionByURLCallback(FilterETWSessionByURLCallback callback);
818
+ void SetFilterETWSessionByURL2Callback(
819
+ FilterETWSessionByURL2Callback callback);
704
820
  #endif // V8_OS_WIN
705
821
 
706
822
  /**
@@ -719,6 +835,14 @@ class V8_EXPORT Isolate {
719
835
  */
720
836
  void SetBatterySaverMode(bool battery_saver_mode_enabled);
721
837
 
838
+ /**
839
+ * Optional request from the embedder to tune v8 towards memory efficiency
840
+ * rather than speed if `memory_saver_mode_enabled` is true, because the
841
+ * embedder is in memory saver mode. If false, the correct tuning is left
842
+ * to v8 to decide.
843
+ */
844
+ void SetMemorySaverMode(bool memory_saver_mode_enabled);
845
+
722
846
  /**
723
847
  * Drop non-essential caches. Should only be called from testing code.
724
848
  * The method can potentially block for a long time and does not necessarily
@@ -748,11 +872,26 @@ class V8_EXPORT Isolate {
748
872
  void Exit();
749
873
 
750
874
  /**
751
- * Disposes the isolate. The isolate must not be entered by any
875
+ * Deinitializes and frees the isolate. The isolate must not be entered by any
752
876
  * thread to be disposable.
753
877
  */
754
878
  void Dispose();
755
879
 
880
+ /**
881
+ * Deinitializes the isolate, but does not free the address. The isolate must
882
+ * not be entered by any thread to be deinitializable. Embedders must call
883
+ * Isolate::Free() to free the isolate afterwards.
884
+ */
885
+ void Deinitialize();
886
+
887
+ /**
888
+ * Frees the memory allocated for the isolate. Can only be called after the
889
+ * Isolate has already been deinitialized with Isolate::Deinitialize(). After
890
+ * the isolate is freed, the next call to Isolate::New() or
891
+ * Isolate::Allocate() might return the same address that just get freed.
892
+ */
893
+ static void Free(Isolate* isolate);
894
+
756
895
  /**
757
896
  * Dumps activated low-level V8 internal stats. This can be used instead
758
897
  * of performing a full isolate disposal.
@@ -886,18 +1025,13 @@ class V8_EXPORT Isolate {
886
1025
  size_t frames_limit, SampleInfo* sample_info);
887
1026
 
888
1027
  /**
889
- * Adjusts the amount of registered external memory. Used to give V8 an
890
- * indication of the amount of externally allocated memory that is kept alive
891
- * by JavaScript objects. V8 uses this to decide when to perform global
892
- * garbage collections. Registering externally allocated memory will trigger
893
- * global garbage collections more often than it would otherwise in an attempt
894
- * to garbage collect the JavaScript objects that keep the externally
895
- * allocated memory alive.
1028
+ * Adjusts the amount of registered external memory.
896
1029
  *
897
1030
  * \param change_in_bytes the change in externally allocated memory that is
898
1031
  * kept alive by JavaScript objects.
899
1032
  * \returns the adjusted value.
900
1033
  */
1034
+ V8_DEPRECATE_SOON("Use ExternalMemoryAccounter instead.")
901
1035
  int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
902
1036
 
903
1037
  /**
@@ -962,6 +1096,14 @@ class V8_EXPORT Isolate {
962
1096
  */
963
1097
  Local<Value> ThrowException(Local<Value> exception);
964
1098
 
1099
+ /**
1100
+ * Returns true if an exception was thrown but not processed yet by an
1101
+ * exception handler on JavaScript side or by v8::TryCatch handler.
1102
+ *
1103
+ * This is an experimental feature and may still change significantly.
1104
+ */
1105
+ bool HasPendingException();
1106
+
965
1107
  using GCCallback = void (*)(Isolate* isolate, GCType type,
966
1108
  GCCallbackFlags flags);
967
1109
  using GCCallbackWithData = void (*)(Isolate* isolate, GCType type,
@@ -1045,28 +1187,14 @@ class V8_EXPORT Isolate {
1045
1187
  */
1046
1188
  void SetEmbedderRootsHandler(EmbedderRootsHandler* handler);
1047
1189
 
1048
- /**
1049
- * Attaches a managed C++ heap as an extension to the JavaScript heap. The
1050
- * embedder maintains ownership of the CppHeap. At most one C++ heap can be
1051
- * attached to V8.
1052
- *
1053
- * Multi-threaded use requires the use of v8::Locker/v8::Unlocker, see
1054
- * CppHeap.
1055
- *
1056
- * If a CppHeap is set via CreateParams, then this call is a noop.
1057
- */
1058
- V8_DEPRECATE_SOON(
1059
- "Set the heap on Isolate creation using CreateParams instead.")
1060
- void AttachCppHeap(CppHeap*);
1190
+ using ReleaseCppHeapCallback = void (*)(std::unique_ptr<CppHeap>);
1061
1191
 
1062
1192
  /**
1063
- * Detaches a managed C++ heap if one was attached using `AttachCppHeap()`.
1064
- *
1065
- * If a CppHeap is set via CreateParams, then this call is a noop.
1193
+ * Sets a callback on the isolate that gets called when the CppHeap gets
1194
+ * detached. The callback can then either take ownership of the CppHeap, or
1195
+ * the CppHeap gets deallocated.
1066
1196
  */
1067
- V8_DEPRECATE_SOON(
1068
- "Set the heap on Isolate creation using CreateParams instead.")
1069
- void DetachCppHeap();
1197
+ void SetReleaseCppHeapCallbackForTesting(ReleaseCppHeapCallback callback);
1070
1198
 
1071
1199
  /**
1072
1200
  * \returns the C++ heap managed by V8. Only available if such a heap has been
@@ -1074,85 +1202,6 @@ class V8_EXPORT Isolate {
1074
1202
  */
1075
1203
  CppHeap* GetCppHeap() const;
1076
1204
 
1077
- /**
1078
- * Use for |AtomicsWaitCallback| to indicate the type of event it receives.
1079
- */
1080
- enum class AtomicsWaitEvent {
1081
- /** Indicates that this call is happening before waiting. */
1082
- kStartWait,
1083
- /** `Atomics.wait()` finished because of an `Atomics.wake()` call. */
1084
- kWokenUp,
1085
- /** `Atomics.wait()` finished because it timed out. */
1086
- kTimedOut,
1087
- /** `Atomics.wait()` was interrupted through |TerminateExecution()|. */
1088
- kTerminatedExecution,
1089
- /** `Atomics.wait()` was stopped through |AtomicsWaitWakeHandle|. */
1090
- kAPIStopped,
1091
- /** `Atomics.wait()` did not wait, as the initial condition was not met. */
1092
- kNotEqual
1093
- };
1094
-
1095
- /**
1096
- * Passed to |AtomicsWaitCallback| as a means of stopping an ongoing
1097
- * `Atomics.wait` call.
1098
- */
1099
- class V8_EXPORT AtomicsWaitWakeHandle {
1100
- public:
1101
- /**
1102
- * Stop this `Atomics.wait()` call and call the |AtomicsWaitCallback|
1103
- * with |kAPIStopped|.
1104
- *
1105
- * This function may be called from another thread. The caller has to ensure
1106
- * through proper synchronization that it is not called after
1107
- * the finishing |AtomicsWaitCallback|.
1108
- *
1109
- * Note that the ECMAScript specification does not plan for the possibility
1110
- * of wakeups that are neither coming from a timeout or an `Atomics.wake()`
1111
- * call, so this may invalidate assumptions made by existing code.
1112
- * The embedder may accordingly wish to schedule an exception in the
1113
- * finishing |AtomicsWaitCallback|.
1114
- */
1115
- void Wake();
1116
- };
1117
-
1118
- /**
1119
- * Embedder callback for `Atomics.wait()` that can be added through
1120
- * |SetAtomicsWaitCallback|.
1121
- *
1122
- * This will be called just before starting to wait with the |event| value
1123
- * |kStartWait| and after finishing waiting with one of the other
1124
- * values of |AtomicsWaitEvent| inside of an `Atomics.wait()` call.
1125
- *
1126
- * |array_buffer| will refer to the underlying SharedArrayBuffer,
1127
- * |offset_in_bytes| to the location of the waited-on memory address inside
1128
- * the SharedArrayBuffer.
1129
- *
1130
- * |value| and |timeout_in_ms| will be the values passed to
1131
- * the `Atomics.wait()` call. If no timeout was used, |timeout_in_ms|
1132
- * will be `INFINITY`.
1133
- *
1134
- * In the |kStartWait| callback, |stop_handle| will be an object that
1135
- * is only valid until the corresponding finishing callback and that
1136
- * can be used to stop the wait process while it is happening.
1137
- *
1138
- * This callback may schedule exceptions, *unless* |event| is equal to
1139
- * |kTerminatedExecution|.
1140
- */
1141
- using AtomicsWaitCallback = void (*)(AtomicsWaitEvent event,
1142
- Local<SharedArrayBuffer> array_buffer,
1143
- size_t offset_in_bytes, int64_t value,
1144
- double timeout_in_ms,
1145
- AtomicsWaitWakeHandle* stop_handle,
1146
- void* data);
1147
-
1148
- /**
1149
- * Set a new |AtomicsWaitCallback|. This overrides an earlier
1150
- * |AtomicsWaitCallback|, if there was any. If |callback| is nullptr,
1151
- * this unsets the callback. |data| will be passed to the callback
1152
- * as its last parameter.
1153
- */
1154
- void SetAtomicsWaitCallback(AtomicsWaitCallback callback, void* data);
1155
-
1156
1205
  using GetExternallyAllocatedMemoryInBytesCallback = size_t (*)();
1157
1206
 
1158
1207
  /**
@@ -1397,8 +1446,18 @@ class V8_EXPORT Isolate {
1397
1446
  * The optional parameter |dependant_context| specifies whether the disposed
1398
1447
  * context was depending on state from other contexts or not.
1399
1448
  */
1449
+ V8_DEPRECATE_SOON("Use version that passes ContextDependants.")
1400
1450
  int ContextDisposedNotification(bool dependant_context = true);
1401
1451
 
1452
+ /**
1453
+ * Optional notification that a context has been disposed. V8 uses these
1454
+ * notifications to guide heuristics on e.g. GC or compilers.
1455
+ *
1456
+ * \param dependants A signal on whether this context possibly had any
1457
+ * dependants.
1458
+ */
1459
+ void ContextDisposedNotification(ContextDependants dependants);
1460
+
1402
1461
  /**
1403
1462
  * Optional notification that the isolate switched to the foreground.
1404
1463
  * V8 uses these notifications to guide heuristics.
@@ -1420,18 +1479,26 @@ class V8_EXPORT Isolate {
1420
1479
  void SetPriority(Priority priority);
1421
1480
 
1422
1481
  /**
1423
- * Optional notification to tell V8 the current performance requirements
1424
- * of the embedder based on RAIL.
1482
+ * Optional notification to tell V8 whether the embedder is currently loading
1483
+ * resources. If the embedder uses this notification, it should call
1484
+ * SetIsLoading(true) when loading starts and SetIsLoading(false) when it
1485
+ * ends.
1486
+ * It's valid to call SetIsLoading(true) again while loading, which will
1487
+ * update the timestamp when V8 considers the load started. Calling
1488
+ * SetIsLoading(false) while not loading does nothing.
1425
1489
  * V8 uses these notifications to guide heuristics.
1426
1490
  * This is an unfinished experimental feature. Semantics and implementation
1427
1491
  * may change frequently.
1428
1492
  */
1429
- void SetRAILMode(RAILMode rail_mode);
1493
+ void SetIsLoading(bool is_loading);
1430
1494
 
1431
1495
  /**
1432
- * Update load start time of the RAIL mode
1496
+ * Optional notification to tell V8 whether the embedder is currently frozen.
1497
+ * V8 uses these notifications to guide heuristics.
1498
+ * This is an unfinished experimental feature. Semantics and implementation
1499
+ * may change frequently.
1433
1500
  */
1434
- void UpdateLoadStartTime();
1501
+ void Freeze(bool is_frozen);
1435
1502
 
1436
1503
  /**
1437
1504
  * Optional notification to tell V8 the current isolate is used for debugging
@@ -1664,14 +1731,6 @@ class V8_EXPORT Isolate {
1664
1731
  bool capture, int frame_limit = 10,
1665
1732
  StackTrace::StackTraceOptions options = StackTrace::kOverview);
1666
1733
 
1667
- /**
1668
- * Iterates through all external resources referenced from current isolate
1669
- * heap. GC is not invoked prior to iterating, therefore there is no
1670
- * guarantee that visited objects are still alive.
1671
- */
1672
- V8_DEPRECATED("Will be removed without replacement. crbug.com/v8/14172")
1673
- void VisitExternalResources(ExternalResourceVisitor* visitor);
1674
-
1675
1734
  /**
1676
1735
  * Check if this isolate is in use.
1677
1736
  * True if at least one thread Enter'ed this isolate.
@@ -1730,6 +1789,11 @@ class V8_EXPORT Isolate {
1730
1789
  */
1731
1790
  std::string GetDefaultLocale();
1732
1791
 
1792
+ /**
1793
+ * Returns the hash seed for that isolate, for testing purposes.
1794
+ */
1795
+ uint64_t GetHashSeed();
1796
+
1733
1797
  Isolate() = delete;
1734
1798
  ~Isolate() = delete;
1735
1799
  Isolate(const Isolate&) = delete;
@@ -1744,9 +1808,12 @@ class V8_EXPORT Isolate {
1744
1808
  private:
1745
1809
  template <class K, class V, class Traits>
1746
1810
  friend class PersistentValueMapBase;
1811
+ friend class ExternalMemoryAccounter;
1747
1812
 
1748
- internal::Address* GetDataFromSnapshotOnce(size_t index);
1749
- void ReportExternalAllocationLimitReached();
1813
+ internal::ValueHelper::InternalRepresentationType GetDataFromSnapshotOnce(
1814
+ size_t index);
1815
+ int64_t AdjustAmountOfExternalAllocatedMemoryImpl(int64_t change_in_bytes);
1816
+ void HandleExternalMemoryInterrupt();
1750
1817
  };
1751
1818
 
1752
1819
  void Isolate::SetData(uint32_t slot, void* data) {
@@ -1766,10 +1833,10 @@ uint32_t Isolate::GetNumberOfDataSlots() {
1766
1833
 
1767
1834
  template <class T>
1768
1835
  MaybeLocal<T> Isolate::GetDataFromSnapshotOnce(size_t index) {
1769
- if (auto slot = GetDataFromSnapshotOnce(index); slot) {
1770
- internal::PerformCastCheck(
1771
- internal::ValueHelper::SlotAsValue<T, false>(slot));
1772
- return Local<T>::FromSlot(slot);
1836
+ if (auto repr = GetDataFromSnapshotOnce(index);
1837
+ repr != internal::ValueHelper::kEmpty) {
1838
+ internal::PerformCastCheck(internal::ValueHelper::ReprAsValue<T>(repr));
1839
+ return Local<T>::FromRepr(repr);
1773
1840
  }
1774
1841
  return {};
1775
1842
  }