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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (88) hide show
  1. checksums.yaml +4 -4
  2. data/ext/libv8-node/location.rb +3 -5
  3. data/ext/libv8-node/paths.rb +2 -0
  4. data/lib/libv8/node/version.rb +7 -4
  5. data/lib/libv8/node.rb +2 -0
  6. data/lib/libv8-node.rb +2 -0
  7. data/vendor/v8/aarch64-linux-musl/libv8/obj/libv8_monolith.a +0 -0
  8. data/vendor/v8/include/cppgc/allocation.h +11 -13
  9. data/vendor/v8/include/cppgc/default-platform.h +3 -2
  10. data/vendor/v8/include/cppgc/garbage-collected.h +8 -0
  11. data/vendor/v8/include/cppgc/heap-consistency.h +1 -1
  12. data/vendor/v8/include/cppgc/heap-statistics.h +2 -0
  13. data/vendor/v8/include/cppgc/internal/api-constants.h +2 -14
  14. data/vendor/v8/include/cppgc/internal/base-page-handle.h +2 -4
  15. data/vendor/v8/include/cppgc/internal/caged-heap-local-data.h +0 -4
  16. data/vendor/v8/include/cppgc/internal/caged-heap.h +0 -4
  17. data/vendor/v8/include/cppgc/internal/compiler-specific.h +9 -1
  18. data/vendor/v8/include/cppgc/internal/conditional-stack-allocated.h +41 -0
  19. data/vendor/v8/include/cppgc/internal/gc-info.h +12 -10
  20. data/vendor/v8/include/cppgc/internal/logging.h +3 -3
  21. data/vendor/v8/include/cppgc/internal/member-storage.h +69 -20
  22. data/vendor/v8/include/cppgc/internal/name-trait.h +5 -1
  23. data/vendor/v8/include/cppgc/internal/persistent-node.h +8 -3
  24. data/vendor/v8/include/cppgc/internal/pointer-policies.h +48 -11
  25. data/vendor/v8/include/cppgc/macros.h +21 -0
  26. data/vendor/v8/include/cppgc/member.h +70 -36
  27. data/vendor/v8/include/cppgc/name-provider.h +10 -0
  28. data/vendor/v8/include/cppgc/platform.h +11 -0
  29. data/vendor/v8/include/cppgc/type-traits.h +26 -4
  30. data/vendor/v8/include/cppgc/visitor.h +25 -1
  31. data/vendor/v8/include/libplatform/libplatform-export.h +2 -2
  32. data/vendor/v8/include/libplatform/v8-tracing.h +0 -1
  33. data/vendor/v8/include/v8-array-buffer.h +149 -46
  34. data/vendor/v8/include/v8-callbacks.h +100 -43
  35. data/vendor/v8/include/v8-container.h +54 -0
  36. data/vendor/v8/include/v8-context.h +92 -30
  37. data/vendor/v8/include/v8-cppgc.h +5 -56
  38. data/vendor/v8/include/v8-data.h +5 -0
  39. data/vendor/v8/include/v8-date.h +9 -0
  40. data/vendor/v8/include/v8-debug.h +11 -0
  41. data/vendor/v8/include/v8-embedder-heap.h +8 -20
  42. data/vendor/v8/include/v8-embedder-state-scope.h +2 -1
  43. data/vendor/v8/include/v8-exception.h +87 -9
  44. data/vendor/v8/include/v8-external-memory-accounter.h +60 -0
  45. data/vendor/v8/include/v8-fast-api-calls.h +67 -223
  46. data/vendor/v8/include/v8-forward.h +1 -0
  47. data/vendor/v8/include/v8-function-callback.h +296 -75
  48. data/vendor/v8/include/v8-function.h +11 -3
  49. data/vendor/v8/include/v8-handle-base.h +52 -82
  50. data/vendor/v8/include/v8-initialization.h +26 -1
  51. data/vendor/v8/include/v8-inspector.h +26 -27
  52. data/vendor/v8/include/v8-internal.h +960 -230
  53. data/vendor/v8/include/v8-isolate.h +347 -226
  54. data/vendor/v8/include/v8-local-handle.h +307 -55
  55. data/vendor/v8/include/v8-maybe.h +2 -1
  56. data/vendor/v8/include/v8-memory-span.h +284 -4
  57. data/vendor/v8/include/v8-message.h +11 -5
  58. data/vendor/v8/include/v8-metrics.h +15 -0
  59. data/vendor/v8/include/v8-microtask-queue.h +0 -5
  60. data/vendor/v8/include/v8-object.h +314 -41
  61. data/vendor/v8/include/v8-persistent-handle.h +29 -39
  62. data/vendor/v8/include/v8-platform.h +135 -77
  63. data/vendor/v8/include/v8-primitive.h +223 -5
  64. data/vendor/v8/include/v8-profiler.h +51 -2
  65. data/vendor/v8/include/v8-promise.h +2 -2
  66. data/vendor/v8/include/v8-proxy.h +0 -1
  67. data/vendor/v8/include/v8-regexp.h +0 -1
  68. data/vendor/v8/include/v8-sandbox.h +173 -0
  69. data/vendor/v8/include/v8-script.h +125 -27
  70. data/vendor/v8/include/v8-snapshot.h +130 -23
  71. data/vendor/v8/include/v8-source-location.h +6 -1
  72. data/vendor/v8/include/v8-statistics.h +10 -24
  73. data/vendor/v8/include/v8-template.h +320 -193
  74. data/vendor/v8/include/v8-trace-categories.h +23 -0
  75. data/vendor/v8/include/v8-traced-handle.h +99 -76
  76. data/vendor/v8/include/v8-typed-array.h +111 -7
  77. data/vendor/v8/include/v8-unwinder-state.h +2 -3
  78. data/vendor/v8/include/v8-unwinder.h +2 -1
  79. data/vendor/v8/include/v8-util.h +10 -125
  80. data/vendor/v8/include/v8-value-serializer-version.h +3 -3
  81. data/vendor/v8/include/v8-value.h +113 -6
  82. data/vendor/v8/include/v8-version.h +3 -3
  83. data/vendor/v8/include/v8-wasm.h +27 -0
  84. data/vendor/v8/include/v8-weak-callback-info.h +20 -12
  85. data/vendor/v8/include/v8.h +3 -3
  86. data/vendor/v8/include/v8config.h +116 -53
  87. metadata +55 -12
  88. data/vendor/v8/include/cppgc/ephemeron-pair.h +0 -30
@@ -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)
@@ -162,28 +164,6 @@ class V8_EXPORT ResourceConstraints {
162
164
  uint32_t* stack_limit_ = nullptr;
163
165
  };
164
166
 
165
- /**
166
- * Option flags passed to the SetRAILMode function.
167
- * See documentation https://developers.google.com/web/tools/chrome-devtools/
168
- * profile/evaluate-performance/rail
169
- */
170
- enum RAILMode : unsigned {
171
- // Response performance mode: In this mode very low virtual machine latency
172
- // is provided. V8 will try to avoid JavaScript execution interruptions.
173
- // Throughput may be throttled.
174
- PERFORMANCE_RESPONSE,
175
- // Animation performance mode: In this mode low virtual machine latency is
176
- // provided. V8 will try to avoid as many JavaScript execution interruptions
177
- // as possible. Throughput may be throttled. This is the default mode.
178
- PERFORMANCE_ANIMATION,
179
- // Idle performance mode: The embedder is idle. V8 can complete deferred work
180
- // in this mode.
181
- PERFORMANCE_IDLE,
182
- // Load performance mode: In this mode high throughput is provided. V8 may
183
- // turn off latency optimizations.
184
- PERFORMANCE_LOAD
185
- };
186
-
187
167
  /**
188
168
  * Memory pressure level for the MemoryPressureNotification.
189
169
  * kNone hints V8 that there is no memory pressure.
@@ -194,11 +174,95 @@ enum RAILMode : unsigned {
194
174
  */
195
175
  enum class MemoryPressureLevel { kNone, kModerate, kCritical };
196
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
+
197
189
  /**
198
190
  * Indicator for the stack state.
199
191
  */
200
192
  using StackState = cppgc::EmbedderStackState;
201
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
+
202
266
  /**
203
267
  * Isolate represents an isolated instance of the V8 engine. V8 isolates have
204
268
  * completely separate states. Objects from one isolate must not be used in
@@ -276,11 +340,6 @@ class V8_EXPORT Isolate {
276
340
  */
277
341
  bool allow_atomics_wait = true;
278
342
 
279
- /**
280
- * Termination is postponed when there is no active SafeForTerminationScope.
281
- */
282
- bool only_terminate_in_safe_scope = false;
283
-
284
343
  /**
285
344
  * The following parameters describe the offsets for addressing type info
286
345
  * for wrapped API objects and are used by the fast C API
@@ -294,6 +353,12 @@ class V8_EXPORT Isolate {
294
353
  */
295
354
  FatalErrorCallback fatal_error_callback = nullptr;
296
355
  OOMErrorCallback oom_error_callback = nullptr;
356
+
357
+ /**
358
+ * A CppHeap used to construct the Isolate. V8 takes ownership of the
359
+ * CppHeap passed this way.
360
+ */
361
+ CppHeap* cpp_heap = nullptr;
297
362
  };
298
363
 
299
364
  /**
@@ -383,24 +448,6 @@ class V8_EXPORT Isolate {
383
448
  friend class internal::ThreadLocalTop;
384
449
  };
385
450
 
386
- /**
387
- * This scope allows terminations inside direct V8 API calls and forbid them
388
- * inside any recursive API calls without explicit SafeForTerminationScope.
389
- */
390
- class V8_EXPORT V8_NODISCARD SafeForTerminationScope {
391
- public:
392
- explicit SafeForTerminationScope(v8::Isolate* v8_isolate);
393
- ~SafeForTerminationScope();
394
-
395
- // Prevent copying of Scope objects.
396
- SafeForTerminationScope(const SafeForTerminationScope&) = delete;
397
- SafeForTerminationScope& operator=(const SafeForTerminationScope&) = delete;
398
-
399
- private:
400
- internal::Isolate* i_isolate_;
401
- bool prev_value_;
402
- };
403
-
404
451
  /**
405
452
  * Types of garbage collections that can be requested via
406
453
  * RequestGarbageCollectionForTesting.
@@ -421,36 +468,36 @@ class V8_EXPORT Isolate {
421
468
  enum UseCounterFeature {
422
469
  kUseAsm = 0,
423
470
  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,
471
+ kOBSOLETE_LegacyConst = 2,
472
+ kOBSOLETE_MarkDequeOverflow = 3,
473
+ kOBSOLETE_StoreBufferOverflow = 4,
474
+ kOBSOLETE_SlotsBufferOverflow = 5,
475
+ kOBSOLETE_ObjectObserve = 6,
429
476
  kForcedGC = 7,
430
477
  kSloppyMode = 8,
431
478
  kStrictMode = 9,
432
- kStrongMode V8_DEPRECATE_SOON("unused") = 10,
479
+ kOBSOLETE_StrongMode = 10,
433
480
  kRegExpPrototypeStickyGetter = 11,
434
481
  kRegExpPrototypeToString = 12,
435
482
  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,
483
+ kOBSOLETE_IntlV8Parse = 14,
484
+ kOBSOLETE_IntlPattern = 15,
485
+ kOBSOLETE_IntlResolved = 16,
486
+ kOBSOLETE_PromiseChain = 17,
487
+ kOBSOLETE_PromiseAccept = 18,
488
+ kOBSOLETE_PromiseDefer = 19,
442
489
  kHtmlCommentInExternalScript = 20,
443
490
  kHtmlComment = 21,
444
491
  kSloppyModeBlockScopedFunctionRedefinition = 22,
445
492
  kForInInitializer = 23,
446
- kArrayProtectorDirtied V8_DEPRECATE_SOON("unused") = 24,
493
+ kOBSOLETE_ArrayProtectorDirtied = 24,
447
494
  kArraySpeciesModified = 25,
448
495
  kArrayPrototypeConstructorModified = 26,
449
- kArrayInstanceProtoModified V8_DEPRECATE_SOON("unused") = 27,
496
+ kOBSOLETE_ArrayInstanceProtoModified = 27,
450
497
  kArrayInstanceConstructorModified = 28,
451
- kLegacyFunctionDeclaration V8_DEPRECATE_SOON("unused") = 29,
452
- kRegExpPrototypeSourceGetter V8_DEPRECATE_SOON("unused") = 30,
453
- kRegExpPrototypeOldFlagGetter V8_DEPRECATE_SOON("unused") = 31,
498
+ kOBSOLETE_LegacyFunctionDeclaration = 29,
499
+ kOBSOLETE_RegExpPrototypeSourceGetter = 30,
500
+ kOBSOLETE_RegExpPrototypeOldFlagGetter = 31,
454
501
  kDecimalWithLeadingZeroInStrictMode = 32,
455
502
  kLegacyDateParser = 33,
456
503
  kDefineGetterOrSetterWouldThrow = 34,
@@ -458,22 +505,21 @@ class V8_EXPORT Isolate {
458
505
  kAssigmentExpressionLHSIsCallInSloppy = 36,
459
506
  kAssigmentExpressionLHSIsCallInStrict = 37,
460
507
  kPromiseConstructorReturnedUndefined = 38,
461
- kConstructorNonUndefinedPrimitiveReturn V8_DEPRECATE_SOON("unused") = 39,
462
- kLabeledExpressionStatement V8_DEPRECATE_SOON("unused") = 40,
463
- kLineOrParagraphSeparatorAsLineTerminator V8_DEPRECATE_SOON("unused") = 41,
508
+ kOBSOLETE_ConstructorNonUndefinedPrimitiveReturn = 39,
509
+ kOBSOLETE_LabeledExpressionStatement = 40,
510
+ kOBSOLETE_LineOrParagraphSeparatorAsLineTerminator = 41,
464
511
  kIndexAccessor = 42,
465
512
  kErrorCaptureStackTrace = 43,
466
513
  kErrorPrepareStackTrace = 44,
467
514
  kErrorStackTraceLimit = 45,
468
515
  kWebAssemblyInstantiation = 46,
469
516
  kDeoptimizerDisableSpeculation = 47,
470
- kArrayPrototypeSortJSArrayModifiedPrototype V8_DEPRECATE_SOON("unused") =
471
- 48,
517
+ kOBSOLETE_ArrayPrototypeSortJSArrayModifiedPrototype = 48,
472
518
  kFunctionTokenOffsetTooLongForToString = 49,
473
519
  kWasmSharedMemory = 50,
474
520
  kWasmThreadOpcodes = 51,
475
- kAtomicsNotify V8_DEPRECATE_SOON("unused") = 52,
476
- kAtomicsWake V8_DEPRECATE_SOON("unused") = 53,
521
+ kOBSOLETE_AtomicsNotify = 52,
522
+ kOBSOLETE_AtomicsWake = 53,
477
523
  kCollator = 54,
478
524
  kNumberFormat = 55,
479
525
  kDateTimeFormat = 56,
@@ -483,7 +529,7 @@ class V8_EXPORT Isolate {
483
529
  kListFormat = 60,
484
530
  kSegmenter = 61,
485
531
  kStringLocaleCompare = 62,
486
- kStringToLocaleUpperCase V8_DEPRECATE_SOON("unused") = 63,
532
+ kOBSOLETE_StringToLocaleUpperCase = 63,
487
533
  kStringToLocaleLowerCase = 64,
488
534
  kNumberToLocaleString = 65,
489
535
  kDateToLocaleString = 66,
@@ -491,14 +537,14 @@ class V8_EXPORT Isolate {
491
537
  kDateToLocaleTimeString = 68,
492
538
  kAttemptOverrideReadOnlyOnPrototypeSloppy = 69,
493
539
  kAttemptOverrideReadOnlyOnPrototypeStrict = 70,
494
- kOptimizedFunctionWithOneShotBytecode V8_DEPRECATE_SOON("unused") = 71,
540
+ kOBSOLETE_OptimizedFunctionWithOneShotBytecode = 71,
495
541
  kRegExpMatchIsTrueishOnNonJSRegExp = 72,
496
542
  kRegExpMatchIsFalseishOnJSRegExp = 73,
497
- kDateGetTimezoneOffset V8_DEPRECATE_SOON("unused") = 74,
543
+ kOBSOLETE_DateGetTimezoneOffset = 74,
498
544
  kStringNormalize = 75,
499
545
  kCallSiteAPIGetFunctionSloppyCall = 76,
500
546
  kCallSiteAPIGetThisSloppyCall = 77,
501
- kRegExpMatchAllWithNonGlobalRegExp V8_DEPRECATE_SOON("unused") = 78,
547
+ kOBSOLETE_RegExpMatchAllWithNonGlobalRegExp = 78,
502
548
  kRegExpExecCalledOnSlowRegExp = 79,
503
549
  kRegExpReplaceCalledOnSlowRegExp = 80,
504
550
  kDisplayNames = 81,
@@ -529,10 +575,8 @@ class V8_EXPORT Isolate {
529
575
  kWasmSimdOpcodes = 106,
530
576
  kVarRedeclaredCatchBinding = 107,
531
577
  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,
578
+ kOBSOLETE_WasmBulkMemory = 109,
579
+ kOBSOLETE_WasmMultiValue = 110,
536
580
  kWasmExceptionHandling = 111,
537
581
  kInvalidatedMegaDOMProtector = 112,
538
582
  kFunctionPrototypeArguments = 113,
@@ -541,9 +585,8 @@ class V8_EXPORT Isolate {
541
585
  kAsyncStackTaggingCreateTaskCall = 116,
542
586
  kDurationFormat = 117,
543
587
  kInvalidatedNumberStringNotRegexpLikeProtector = 118,
544
- kRegExpUnicodeSetIncompatibilitiesWithUnicodeMode V8_DEPRECATE_SOON(
545
- "unused") = 119,
546
- kImportAssertionDeprecatedSyntax = 120,
588
+ kOBSOLETE_RegExpUnicodeSetIncompatibilitiesWithUnicodeMode = 119,
589
+ kOBSOLETE_ImportAssertionDeprecatedSyntax = 120,
547
590
  kLocaleInfoObsoletedGetters = 121,
548
591
  kLocaleInfoFunctions = 122,
549
592
  kCompileHintsMagicAll = 123,
@@ -551,6 +594,46 @@ class V8_EXPORT Isolate {
551
594
  kWasmMemory64 = 125,
552
595
  kWasmMultiMemory = 126,
553
596
  kWasmGC = 127,
597
+ kWasmImportedStrings = 128,
598
+ kSourceMappingUrlMagicCommentAtSign = 129,
599
+ kTemporalObject = 130,
600
+ kWasmModuleCompilation = 131,
601
+ kInvalidatedNoUndetectableObjectsProtector = 132,
602
+ kWasmJavaScriptPromiseIntegration = 133,
603
+ kWasmReturnCall = 134,
604
+ kWasmExtendedConst = 135,
605
+ kWasmRelaxedSimd = 136,
606
+ kWasmTypeReflection = 137,
607
+ kWasmExnRef = 138,
608
+ kWasmTypedFuncRef = 139,
609
+ kInvalidatedStringWrapperToPrimitiveProtector = 140,
610
+ kDocumentAllLegacyCall = 141,
611
+ kDocumentAllLegacyConstruct = 142,
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,
554
637
 
555
638
  // If you add new values here, you'll also need to update Chromium's:
556
639
  // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
@@ -568,6 +651,21 @@ class V8_EXPORT Isolate {
568
651
  kMessageWarning,
569
652
  };
570
653
 
654
+ // The different priorities that an isolate can have.
655
+ enum class Priority {
656
+ // The isolate does not relate to content that is currently important
657
+ // to the user. Lowest priority.
658
+ kBestEffort,
659
+
660
+ // The isolate contributes to content that is visible to the user, like a
661
+ // visible iframe that's not interacted directly with. High priority.
662
+ kUserVisible,
663
+
664
+ // The isolate contributes to content that is of the utmost importance to
665
+ // the user, like visible content in the focused window. Highest priority.
666
+ kUserBlocking,
667
+ };
668
+
571
669
  using UseCounterCallback = void (*)(Isolate* isolate,
572
670
  UseCounterFeature feature);
573
671
 
@@ -576,9 +674,9 @@ class V8_EXPORT Isolate {
576
674
  * currently entered isolate.
577
675
  *
578
676
  * Only Isolate::GetData() and Isolate::SetData(), which access the
579
- * embedder-controlled parts of the isolate, are allowed to be called on the
580
- * uninitialized isolate. To initialize the isolate, call
581
- * Isolate::Initialize().
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`.
582
680
  *
583
681
  * When an isolate is no longer used its resources should be freed
584
682
  * by calling Dispose(). Using the delete operator is not allowed.
@@ -586,6 +684,12 @@ class V8_EXPORT Isolate {
586
684
  * V8::Initialize() must have run prior to this.
587
685
  */
588
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;
589
693
 
590
694
  /**
591
695
  * Initialize an Isolate previously allocated by Isolate::Allocate().
@@ -602,6 +706,7 @@ class V8_EXPORT Isolate {
602
706
  * V8::Initialize() must have run prior to this.
603
707
  */
604
708
  static Isolate* New(const CreateParams& params);
709
+ static Isolate* New(const IsolateGroup& group, const CreateParams& params);
605
710
 
606
711
  /**
607
712
  * Returns the entered isolate for the current thread or NULL in
@@ -659,6 +764,18 @@ class V8_EXPORT Isolate {
659
764
  void SetHostImportModuleDynamicallyCallback(
660
765
  HostImportModuleDynamicallyCallback callback);
661
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
+
662
779
  /**
663
780
  * This specifies the callback called by the upcoming import.meta
664
781
  * language feature to retrieve host-defined meta data for a module.
@@ -673,17 +790,33 @@ class V8_EXPORT Isolate {
673
790
  void SetHostCreateShadowRealmContextCallback(
674
791
  HostCreateShadowRealmContextCallback callback);
675
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
+
676
801
  /**
677
802
  * This specifies the callback called when the stack property of Error
678
803
  * is accessed.
679
804
  */
680
805
  void SetPrepareStackTraceCallback(PrepareStackTraceCallback callback);
681
806
 
807
+ /**
808
+ * Get the stackTraceLimit property of Error.
809
+ */
810
+ int GetStackTraceLimit();
811
+
682
812
  #if defined(V8_OS_WIN)
683
813
  /**
684
814
  * This specifies the callback called when an ETW tracing session starts.
685
815
  */
816
+ V8_DEPRECATE_SOON("Use SetFilterETWSessionByURL2Callback instead")
686
817
  void SetFilterETWSessionByURLCallback(FilterETWSessionByURLCallback callback);
818
+ void SetFilterETWSessionByURL2Callback(
819
+ FilterETWSessionByURL2Callback callback);
687
820
  #endif // V8_OS_WIN
688
821
 
689
822
  /**
@@ -694,6 +827,22 @@ class V8_EXPORT Isolate {
694
827
  */
695
828
  void MemoryPressureNotification(MemoryPressureLevel level);
696
829
 
830
+ /**
831
+ * Optional request from the embedder to tune v8 towards energy efficiency
832
+ * rather than speed if `battery_saver_mode_enabled` is true, because the
833
+ * embedder is in battery saver mode. If false, the correct tuning is left
834
+ * to v8 to decide.
835
+ */
836
+ void SetBatterySaverMode(bool battery_saver_mode_enabled);
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
+
697
846
  /**
698
847
  * Drop non-essential caches. Should only be called from testing code.
699
848
  * The method can potentially block for a long time and does not necessarily
@@ -723,11 +872,26 @@ class V8_EXPORT Isolate {
723
872
  void Exit();
724
873
 
725
874
  /**
726
- * 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
727
876
  * thread to be disposable.
728
877
  */
729
878
  void Dispose();
730
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
+
731
895
  /**
732
896
  * Dumps activated low-level V8 internal stats. This can be used instead
733
897
  * of performing a full isolate disposal.
@@ -769,6 +933,18 @@ class V8_EXPORT Isolate {
769
933
  template <class T>
770
934
  V8_INLINE MaybeLocal<T> GetDataFromSnapshotOnce(size_t index);
771
935
 
936
+ /**
937
+ * Returns the value that was set or restored by
938
+ * SetContinuationPreservedEmbedderData(), if any.
939
+ */
940
+ Local<Value> GetContinuationPreservedEmbedderData();
941
+
942
+ /**
943
+ * Sets a value that will be stored on continuations and reset while the
944
+ * continuation runs.
945
+ */
946
+ void SetContinuationPreservedEmbedderData(Local<Value> data);
947
+
772
948
  /**
773
949
  * Get statistics about the heap memory usage.
774
950
  */
@@ -849,18 +1025,13 @@ class V8_EXPORT Isolate {
849
1025
  size_t frames_limit, SampleInfo* sample_info);
850
1026
 
851
1027
  /**
852
- * Adjusts the amount of registered external memory. Used to give V8 an
853
- * indication of the amount of externally allocated memory that is kept alive
854
- * by JavaScript objects. V8 uses this to decide when to perform global
855
- * garbage collections. Registering externally allocated memory will trigger
856
- * global garbage collections more often than it would otherwise in an attempt
857
- * to garbage collect the JavaScript objects that keep the externally
858
- * allocated memory alive.
1028
+ * Adjusts the amount of registered external memory.
859
1029
  *
860
1030
  * \param change_in_bytes the change in externally allocated memory that is
861
1031
  * kept alive by JavaScript objects.
862
1032
  * \returns the adjusted value.
863
1033
  */
1034
+ V8_DEPRECATE_SOON("Use ExternalMemoryAccounter instead.")
864
1035
  int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
865
1036
 
866
1037
  /**
@@ -900,6 +1071,12 @@ class V8_EXPORT Isolate {
900
1071
  */
901
1072
  Local<Context> GetIncumbentContext();
902
1073
 
1074
+ /**
1075
+ * Returns the host defined options set for currently running script or
1076
+ * module, if available.
1077
+ */
1078
+ MaybeLocal<Data> GetCurrentHostDefinedOptions();
1079
+
903
1080
  /**
904
1081
  * Schedules a v8::Exception::Error with the given message.
905
1082
  * See ThrowException for more details. Templatized to provide compile-time
@@ -919,6 +1096,14 @@ class V8_EXPORT Isolate {
919
1096
  */
920
1097
  Local<Value> ThrowException(Local<Value> exception);
921
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
+
922
1107
  using GCCallback = void (*)(Isolate* isolate, GCType type,
923
1108
  GCCallbackFlags flags);
924
1109
  using GCCallbackWithData = void (*)(Isolate* isolate, GCType type,
@@ -1002,20 +1187,14 @@ class V8_EXPORT Isolate {
1002
1187
  */
1003
1188
  void SetEmbedderRootsHandler(EmbedderRootsHandler* handler);
1004
1189
 
1005
- /**
1006
- * Attaches a managed C++ heap as an extension to the JavaScript heap. The
1007
- * embedder maintains ownership of the CppHeap. At most one C++ heap can be
1008
- * attached to V8.
1009
- *
1010
- * Multi-threaded use requires the use of v8::Locker/v8::Unlocker, see
1011
- * CppHeap.
1012
- */
1013
- void AttachCppHeap(CppHeap*);
1190
+ using ReleaseCppHeapCallback = void (*)(std::unique_ptr<CppHeap>);
1014
1191
 
1015
1192
  /**
1016
- * Detaches a managed C++ heap if one was attached using `AttachCppHeap()`.
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.
1017
1196
  */
1018
- void DetachCppHeap();
1197
+ void SetReleaseCppHeapCallbackForTesting(ReleaseCppHeapCallback callback);
1019
1198
 
1020
1199
  /**
1021
1200
  * \returns the C++ heap managed by V8. Only available if such a heap has been
@@ -1023,85 +1202,6 @@ class V8_EXPORT Isolate {
1023
1202
  */
1024
1203
  CppHeap* GetCppHeap() const;
1025
1204
 
1026
- /**
1027
- * Use for |AtomicsWaitCallback| to indicate the type of event it receives.
1028
- */
1029
- enum class AtomicsWaitEvent {
1030
- /** Indicates that this call is happening before waiting. */
1031
- kStartWait,
1032
- /** `Atomics.wait()` finished because of an `Atomics.wake()` call. */
1033
- kWokenUp,
1034
- /** `Atomics.wait()` finished because it timed out. */
1035
- kTimedOut,
1036
- /** `Atomics.wait()` was interrupted through |TerminateExecution()|. */
1037
- kTerminatedExecution,
1038
- /** `Atomics.wait()` was stopped through |AtomicsWaitWakeHandle|. */
1039
- kAPIStopped,
1040
- /** `Atomics.wait()` did not wait, as the initial condition was not met. */
1041
- kNotEqual
1042
- };
1043
-
1044
- /**
1045
- * Passed to |AtomicsWaitCallback| as a means of stopping an ongoing
1046
- * `Atomics.wait` call.
1047
- */
1048
- class V8_EXPORT AtomicsWaitWakeHandle {
1049
- public:
1050
- /**
1051
- * Stop this `Atomics.wait()` call and call the |AtomicsWaitCallback|
1052
- * with |kAPIStopped|.
1053
- *
1054
- * This function may be called from another thread. The caller has to ensure
1055
- * through proper synchronization that it is not called after
1056
- * the finishing |AtomicsWaitCallback|.
1057
- *
1058
- * Note that the ECMAScript specification does not plan for the possibility
1059
- * of wakeups that are neither coming from a timeout or an `Atomics.wake()`
1060
- * call, so this may invalidate assumptions made by existing code.
1061
- * The embedder may accordingly wish to schedule an exception in the
1062
- * finishing |AtomicsWaitCallback|.
1063
- */
1064
- void Wake();
1065
- };
1066
-
1067
- /**
1068
- * Embedder callback for `Atomics.wait()` that can be added through
1069
- * |SetAtomicsWaitCallback|.
1070
- *
1071
- * This will be called just before starting to wait with the |event| value
1072
- * |kStartWait| and after finishing waiting with one of the other
1073
- * values of |AtomicsWaitEvent| inside of an `Atomics.wait()` call.
1074
- *
1075
- * |array_buffer| will refer to the underlying SharedArrayBuffer,
1076
- * |offset_in_bytes| to the location of the waited-on memory address inside
1077
- * the SharedArrayBuffer.
1078
- *
1079
- * |value| and |timeout_in_ms| will be the values passed to
1080
- * the `Atomics.wait()` call. If no timeout was used, |timeout_in_ms|
1081
- * will be `INFINITY`.
1082
- *
1083
- * In the |kStartWait| callback, |stop_handle| will be an object that
1084
- * is only valid until the corresponding finishing callback and that
1085
- * can be used to stop the wait process while it is happening.
1086
- *
1087
- * This callback may schedule exceptions, *unless* |event| is equal to
1088
- * |kTerminatedExecution|.
1089
- */
1090
- using AtomicsWaitCallback = void (*)(AtomicsWaitEvent event,
1091
- Local<SharedArrayBuffer> array_buffer,
1092
- size_t offset_in_bytes, int64_t value,
1093
- double timeout_in_ms,
1094
- AtomicsWaitWakeHandle* stop_handle,
1095
- void* data);
1096
-
1097
- /**
1098
- * Set a new |AtomicsWaitCallback|. This overrides an earlier
1099
- * |AtomicsWaitCallback|, if there was any. If |callback| is nullptr,
1100
- * this unsets the callback. |data| will be passed to the callback
1101
- * as its last parameter.
1102
- */
1103
- void SetAtomicsWaitCallback(AtomicsWaitCallback callback, void* data);
1104
-
1105
1205
  using GetExternallyAllocatedMemoryInBytesCallback = size_t (*)();
1106
1206
 
1107
1207
  /**
@@ -1233,6 +1333,15 @@ class V8_EXPORT Isolate {
1233
1333
  */
1234
1334
  void SetPromiseRejectCallback(PromiseRejectCallback callback);
1235
1335
 
1336
+ /**
1337
+ * This is a part of experimental Api and might be changed without further
1338
+ * notice.
1339
+ * Do not use it.
1340
+ *
1341
+ * Set callback to notify about a new exception being thrown.
1342
+ */
1343
+ void SetExceptionPropagationCallback(ExceptionPropagationCallback callback);
1344
+
1236
1345
  /**
1237
1346
  * Runs the default MicrotaskQueue until it gets empty and perform other
1238
1347
  * microtask checkpoint steps, such as calling ClearKeptObjects. Asserts that
@@ -1322,24 +1431,6 @@ class V8_EXPORT Isolate {
1322
1431
  */
1323
1432
  void SetAddCrashKeyCallback(AddCrashKeyCallback);
1324
1433
 
1325
- /**
1326
- * Optional notification that the embedder is idle.
1327
- * V8 uses the notification to perform garbage collection.
1328
- * This call can be used repeatedly if the embedder remains idle.
1329
- * Returns true if the embedder should stop calling IdleNotificationDeadline
1330
- * until real work has been done. This indicates that V8 has done
1331
- * as much cleanup as it will be able to do.
1332
- *
1333
- * The deadline_in_seconds argument specifies the deadline V8 has to finish
1334
- * garbage collection work. deadline_in_seconds is compared with
1335
- * MonotonicallyIncreasingTime() and should be based on the same timebase as
1336
- * that function. There is no guarantee that the actual work will be done
1337
- * within the time limit.
1338
- */
1339
- V8_DEPRECATE_SOON(
1340
- "Use MemoryPressureNotification() to influence the GC schedule.")
1341
- bool IdleNotificationDeadline(double deadline_in_seconds);
1342
-
1343
1434
  /**
1344
1435
  * Optional notification that the system is running low on memory.
1345
1436
  * V8 uses these notifications to attempt to free memory.
@@ -1355,33 +1446,59 @@ class V8_EXPORT Isolate {
1355
1446
  * The optional parameter |dependant_context| specifies whether the disposed
1356
1447
  * context was depending on state from other contexts or not.
1357
1448
  */
1449
+ V8_DEPRECATE_SOON("Use version that passes ContextDependants.")
1358
1450
  int ContextDisposedNotification(bool dependant_context = true);
1359
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
+
1360
1461
  /**
1361
1462
  * Optional notification that the isolate switched to the foreground.
1362
1463
  * V8 uses these notifications to guide heuristics.
1363
1464
  */
1465
+ V8_DEPRECATE_SOON("Use SetPriority(Priority::kUserBlocking) instead")
1364
1466
  void IsolateInForegroundNotification();
1365
1467
 
1366
1468
  /**
1367
1469
  * Optional notification that the isolate switched to the background.
1368
1470
  * V8 uses these notifications to guide heuristics.
1369
1471
  */
1472
+ V8_DEPRECATE_SOON("Use SetPriority(Priority::kBestEffort) instead")
1370
1473
  void IsolateInBackgroundNotification();
1371
1474
 
1372
1475
  /**
1373
- * Optional notification to tell V8 the current performance requirements
1374
- * of the embedder based on RAIL.
1476
+ * Optional notification that the isolate changed `priority`.
1477
+ * V8 uses the priority value to guide heuristics.
1478
+ */
1479
+ void SetPriority(Priority priority);
1480
+
1481
+ /**
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.
1375
1489
  * V8 uses these notifications to guide heuristics.
1376
1490
  * This is an unfinished experimental feature. Semantics and implementation
1377
1491
  * may change frequently.
1378
1492
  */
1379
- void SetRAILMode(RAILMode rail_mode);
1493
+ void SetIsLoading(bool is_loading);
1380
1494
 
1381
1495
  /**
1382
- * 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.
1383
1500
  */
1384
- void UpdateLoadStartTime();
1501
+ void Freeze(bool is_frozen);
1385
1502
 
1386
1503
  /**
1387
1504
  * Optional notification to tell V8 the current isolate is used for debugging
@@ -1540,23 +1657,21 @@ class V8_EXPORT Isolate {
1540
1657
 
1541
1658
  void SetWasmLoadSourceMapCallback(WasmLoadSourceMapCallback callback);
1542
1659
 
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
1660
  void SetWasmImportedStringsEnabledCallback(
1551
1661
  WasmImportedStringsEnabledCallback callback);
1552
1662
 
1553
1663
  void SetSharedArrayBufferConstructorEnabledCallback(
1554
1664
  SharedArrayBufferConstructorEnabledCallback callback);
1555
1665
 
1666
+ void SetWasmJSPIEnabledCallback(WasmJSPIEnabledCallback callback);
1667
+
1556
1668
  /**
1557
1669
  * Register callback to control whether compile hints magic comments are
1558
1670
  * enabled.
1559
1671
  */
1672
+ V8_DEPRECATED(
1673
+ "Will be removed, use ScriptCompiler::CompileOptions for enabling the "
1674
+ "compile hints magic comments")
1560
1675
  void SetJavaScriptCompileHintsMagicEnabledCallback(
1561
1676
  JavaScriptCompileHintsMagicEnabledCallback callback);
1562
1677
 
@@ -1616,14 +1731,6 @@ class V8_EXPORT Isolate {
1616
1731
  bool capture, int frame_limit = 10,
1617
1732
  StackTrace::StackTraceOptions options = StackTrace::kOverview);
1618
1733
 
1619
- /**
1620
- * Iterates through all external resources referenced from current isolate
1621
- * heap. GC is not invoked prior to iterating, therefore there is no
1622
- * guarantee that visited objects are still alive.
1623
- */
1624
- V8_DEPRECATE_SOON("Will be removed without replacement. crbug.com/v8/14172")
1625
- void VisitExternalResources(ExternalResourceVisitor* visitor);
1626
-
1627
1734
  /**
1628
1735
  * Check if this isolate is in use.
1629
1736
  * True if at least one thread Enter'ed this isolate.
@@ -1676,6 +1783,17 @@ class V8_EXPORT Isolate {
1676
1783
  */
1677
1784
  void LocaleConfigurationChangeNotification();
1678
1785
 
1786
+ /**
1787
+ * Returns the default locale in a string if Intl support is enabled.
1788
+ * Otherwise returns an empty string.
1789
+ */
1790
+ std::string GetDefaultLocale();
1791
+
1792
+ /**
1793
+ * Returns the hash seed for that isolate, for testing purposes.
1794
+ */
1795
+ uint64_t GetHashSeed();
1796
+
1679
1797
  Isolate() = delete;
1680
1798
  ~Isolate() = delete;
1681
1799
  Isolate(const Isolate&) = delete;
@@ -1690,9 +1808,12 @@ class V8_EXPORT Isolate {
1690
1808
  private:
1691
1809
  template <class K, class V, class Traits>
1692
1810
  friend class PersistentValueMapBase;
1811
+ friend class ExternalMemoryAccounter;
1693
1812
 
1694
- internal::Address* GetDataFromSnapshotOnce(size_t index);
1695
- void ReportExternalAllocationLimitReached();
1813
+ internal::ValueHelper::InternalRepresentationType GetDataFromSnapshotOnce(
1814
+ size_t index);
1815
+ int64_t AdjustAmountOfExternalAllocatedMemoryImpl(int64_t change_in_bytes);
1816
+ void HandleExternalMemoryInterrupt();
1696
1817
  };
1697
1818
 
1698
1819
  void Isolate::SetData(uint32_t slot, void* data) {
@@ -1712,12 +1833,12 @@ uint32_t Isolate::GetNumberOfDataSlots() {
1712
1833
 
1713
1834
  template <class T>
1714
1835
  MaybeLocal<T> Isolate::GetDataFromSnapshotOnce(size_t index) {
1715
- auto slot = GetDataFromSnapshotOnce(index);
1716
- if (slot) {
1717
- internal::PerformCastCheck(
1718
- internal::ValueHelper::SlotAsValue<T, false>(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);
1719
1840
  }
1720
- return Local<T>::FromSlot(slot);
1841
+ return {};
1721
1842
  }
1722
1843
 
1723
1844
  } // namespace v8