v8 12.4.254 (node 22.4.1)
V8 is Google's open source JavaScript engine
Loading...
Searching...
No Matches
v8-isolate.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_ISOLATE_H_
6#define INCLUDE_V8_ISOLATE_H_
7
8#include <stddef.h>
9#include <stdint.h>
10
11#include <memory>
12#include <utility>
13
14#include "cppgc/common.h"
15#include "v8-array-buffer.h" // NOLINT(build/include_directory)
16#include "v8-callbacks.h" // NOLINT(build/include_directory)
17#include "v8-data.h" // NOLINT(build/include_directory)
18#include "v8-debug.h" // NOLINT(build/include_directory)
19#include "v8-embedder-heap.h" // NOLINT(build/include_directory)
20#include "v8-function-callback.h" // NOLINT(build/include_directory)
21#include "v8-internal.h" // NOLINT(build/include_directory)
22#include "v8-local-handle.h" // NOLINT(build/include_directory)
23#include "v8-microtask.h" // NOLINT(build/include_directory)
24#include "v8-persistent-handle.h" // NOLINT(build/include_directory)
25#include "v8-primitive.h" // NOLINT(build/include_directory)
26#include "v8-statistics.h" // NOLINT(build/include_directory)
27#include "v8-unwinder.h" // NOLINT(build/include_directory)
28#include "v8config.h" // NOLINT(build/include_directory)
29
30namespace v8 {
31
32class CppHeap;
33class HeapProfiler;
34class MicrotaskQueue;
35class StartupData;
36class ScriptOrModule;
37class SharedArrayBuffer;
38
39namespace internal {
40class MicrotaskQueue;
41class ThreadLocalTop;
42} // namespace internal
43
44namespace metrics {
45class Recorder;
46} // namespace metrics
47
63 public:
82 void ConfigureDefaultsFromHeapSize(size_t initial_heap_size_in_bytes,
83 size_t maximum_heap_size_in_bytes);
84
94 void ConfigureDefaults(uint64_t physical_memory,
95 uint64_t virtual_memory_limit);
96
100 uint32_t* stack_limit() const { return stack_limit_; }
101 void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
102
112 size_t code_range_size_in_bytes() const { return code_range_size_; }
113 void set_code_range_size_in_bytes(size_t limit) { code_range_size_ = limit; }
114
123 return max_old_generation_size_;
124 }
126 max_old_generation_size_ = limit;
127 }
128
135 return max_young_generation_size_;
136 }
138 max_young_generation_size_ = limit;
139 }
140
142 return initial_old_generation_size_;
143 }
145 initial_old_generation_size_ = initial_size;
146 }
147
149 return initial_young_generation_size_;
150 }
152 initial_young_generation_size_ = initial_size;
153 }
154
155 private:
156 static constexpr size_t kMB = 1048576u;
157 size_t code_range_size_ = 0;
158 size_t max_old_generation_size_ = 0;
159 size_t max_young_generation_size_ = 0;
160 size_t initial_old_generation_size_ = 0;
161 size_t initial_young_generation_size_ = 0;
162 uint32_t* stack_limit_ = nullptr;
163};
164
170enum 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.
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.
179 // Idle performance mode: The embedder is idle. V8 can complete deferred work
180 // in this mode.
182 // Load performance mode: In this mode high throughput is provided. V8 may
183 // turn off latency optimizations.
186
196
201
211 public:
218
220
221
225 JitCodeEventHandler code_event_handler = nullptr;
226
231
236 const StartupData* snapshot_blob = nullptr;
237
242 CounterLookupCallback counter_lookup_callback = nullptr;
243
250 CreateHistogramCallback create_histogram_callback = nullptr;
251 AddHistogramSampleCallback add_histogram_sample_callback = nullptr;
252
262 ArrayBuffer::Allocator* array_buffer_allocator = nullptr;
263 std::shared_ptr<ArrayBuffer::Allocator> array_buffer_allocator_shared;
264
271 const intptr_t* external_references = nullptr;
272
277 bool allow_atomics_wait = true;
278
282 bool only_terminate_in_safe_scope = false;
283
289 int embedder_wrapper_type_index = -1;
290 int embedder_wrapper_object_index = -1;
291
295 FatalErrorCallback fatal_error_callback = nullptr;
296 OOMErrorCallback oom_error_callback = nullptr;
297
302 CppHeap* cpp_heap = nullptr;
303 };
304
310 public:
311 explicit Scope(Isolate* isolate) : v8_isolate_(isolate) {
312 v8_isolate_->Enter();
313 }
314
315 ~Scope() { v8_isolate_->Exit(); }
316
317 // Prevent copying of Scope objects.
318 Scope(const Scope&) = delete;
319 Scope& operator=(const Scope&) = delete;
320
321 private:
322 Isolate* const v8_isolate_;
323 };
324
329 public:
330 enum OnFailure { CRASH_ON_FAILURE, THROW_ON_FAILURE, DUMP_ON_FAILURE };
331
334
335 // Prevent copying of Scope objects.
337 delete;
339 const DisallowJavascriptExecutionScope&) = delete;
340
341 private:
342 v8::Isolate* const v8_isolate_;
343 const OnFailure on_failure_;
344 bool was_execution_allowed_;
345 };
346
351 public:
354
355 // Prevent copying of Scope objects.
357 delete;
359 const AllowJavascriptExecutionScope&) = delete;
360
361 private:
362 Isolate* const v8_isolate_;
363 bool was_execution_allowed_assert_;
364 bool was_execution_allowed_throws_;
365 bool was_execution_allowed_dump_;
366 };
367
373 public:
375 Isolate* isolate, MicrotaskQueue* microtask_queue = nullptr);
377
378 // Prevent copying of Scope objects.
380 delete;
382 const SuppressMicrotaskExecutionScope&) = delete;
383
384 private:
385 internal::Isolate* const i_isolate_;
386 internal::MicrotaskQueue* const microtask_queue_;
387 internal::Address previous_stack_height_;
388
389 friend class internal::ThreadLocalTop;
390 };
391
397 public:
398 V8_DEPRECATE_SOON("All code should be safe for termination")
399 explicit SafeForTerminationScope(v8::Isolate* v8_isolate) {}
401
402 // Prevent copying of Scope objects.
405 };
406
413 kMinorGarbageCollection
414 };
415
425 kUseAsm = 0,
426 kBreakIterator = 1,
427 kOBSOLETE_LegacyConst = 2,
428 kOBSOLETE_MarkDequeOverflow = 3,
429 kOBSOLETE_StoreBufferOverflow = 4,
430 kOBSOLETE_SlotsBufferOverflow = 5,
431 kOBSOLETE_ObjectObserve = 6,
432 kForcedGC = 7,
433 kSloppyMode = 8,
434 kStrictMode = 9,
435 kOBSOLETE_StrongMode = 10,
436 kRegExpPrototypeStickyGetter = 11,
437 kRegExpPrototypeToString = 12,
438 kRegExpPrototypeUnicodeGetter = 13,
439 kOBSOLETE_IntlV8Parse = 14,
440 kOBSOLETE_IntlPattern = 15,
441 kOBSOLETE_IntlResolved = 16,
442 kOBSOLETE_PromiseChain = 17,
443 kOBSOLETE_PromiseAccept = 18,
444 kOBSOLETE_PromiseDefer = 19,
445 kHtmlCommentInExternalScript = 20,
446 kHtmlComment = 21,
447 kSloppyModeBlockScopedFunctionRedefinition = 22,
448 kForInInitializer = 23,
449 kOBSOLETE_ArrayProtectorDirtied = 24,
450 kArraySpeciesModified = 25,
451 kArrayPrototypeConstructorModified = 26,
452 kOBSOLETE_ArrayInstanceProtoModified = 27,
453 kArrayInstanceConstructorModified = 28,
454 kOBSOLETE_LegacyFunctionDeclaration = 29,
455 kOBSOLETE_RegExpPrototypeSourceGetter = 30,
456 kOBSOLETE_RegExpPrototypeOldFlagGetter = 31,
457 kDecimalWithLeadingZeroInStrictMode = 32,
458 kLegacyDateParser = 33,
459 kDefineGetterOrSetterWouldThrow = 34,
460 kFunctionConstructorReturnedUndefined = 35,
461 kAssigmentExpressionLHSIsCallInSloppy = 36,
462 kAssigmentExpressionLHSIsCallInStrict = 37,
463 kPromiseConstructorReturnedUndefined = 38,
464 kOBSOLETE_ConstructorNonUndefinedPrimitiveReturn = 39,
465 kOBSOLETE_LabeledExpressionStatement = 40,
466 kOBSOLETE_LineOrParagraphSeparatorAsLineTerminator = 41,
467 kIndexAccessor = 42,
468 kErrorCaptureStackTrace = 43,
469 kErrorPrepareStackTrace = 44,
470 kErrorStackTraceLimit = 45,
471 kWebAssemblyInstantiation = 46,
472 kDeoptimizerDisableSpeculation = 47,
473 kOBSOLETE_ArrayPrototypeSortJSArrayModifiedPrototype = 48,
474 kFunctionTokenOffsetTooLongForToString = 49,
475 kWasmSharedMemory = 50,
476 kWasmThreadOpcodes = 51,
477 kOBSOLETE_AtomicsNotify = 52,
478 kOBSOLETE_AtomicsWake = 53,
479 kCollator = 54,
480 kNumberFormat = 55,
481 kDateTimeFormat = 56,
482 kPluralRules = 57,
483 kRelativeTimeFormat = 58,
484 kLocale = 59,
485 kListFormat = 60,
486 kSegmenter = 61,
487 kStringLocaleCompare = 62,
488 kOBSOLETE_StringToLocaleUpperCase = 63,
489 kStringToLocaleLowerCase = 64,
490 kNumberToLocaleString = 65,
491 kDateToLocaleString = 66,
492 kDateToLocaleDateString = 67,
493 kDateToLocaleTimeString = 68,
494 kAttemptOverrideReadOnlyOnPrototypeSloppy = 69,
495 kAttemptOverrideReadOnlyOnPrototypeStrict = 70,
496 kOBSOLETE_OptimizedFunctionWithOneShotBytecode = 71,
497 kRegExpMatchIsTrueishOnNonJSRegExp = 72,
498 kRegExpMatchIsFalseishOnJSRegExp = 73,
499 kOBSOLETE_DateGetTimezoneOffset = 74,
500 kStringNormalize = 75,
501 kCallSiteAPIGetFunctionSloppyCall = 76,
502 kCallSiteAPIGetThisSloppyCall = 77,
503 kOBSOLETE_RegExpMatchAllWithNonGlobalRegExp = 78,
504 kRegExpExecCalledOnSlowRegExp = 79,
505 kRegExpReplaceCalledOnSlowRegExp = 80,
506 kDisplayNames = 81,
507 kSharedArrayBufferConstructed = 82,
508 kArrayPrototypeHasElements = 83,
509 kObjectPrototypeHasElements = 84,
510 kNumberFormatStyleUnit = 85,
511 kDateTimeFormatRange = 86,
512 kDateTimeFormatDateTimeStyle = 87,
513 kBreakIteratorTypeWord = 88,
514 kBreakIteratorTypeLine = 89,
515 kInvalidatedArrayBufferDetachingProtector = 90,
516 kInvalidatedArrayConstructorProtector = 91,
517 kInvalidatedArrayIteratorLookupChainProtector = 92,
518 kInvalidatedArraySpeciesLookupChainProtector = 93,
519 kInvalidatedIsConcatSpreadableLookupChainProtector = 94,
520 kInvalidatedMapIteratorLookupChainProtector = 95,
521 kInvalidatedNoElementsProtector = 96,
522 kInvalidatedPromiseHookProtector = 97,
523 kInvalidatedPromiseResolveLookupChainProtector = 98,
524 kInvalidatedPromiseSpeciesLookupChainProtector = 99,
525 kInvalidatedPromiseThenLookupChainProtector = 100,
526 kInvalidatedRegExpSpeciesLookupChainProtector = 101,
527 kInvalidatedSetIteratorLookupChainProtector = 102,
528 kInvalidatedStringIteratorLookupChainProtector = 103,
529 kInvalidatedStringLengthOverflowLookupChainProtector = 104,
530 kInvalidatedTypedArraySpeciesLookupChainProtector = 105,
531 kWasmSimdOpcodes = 106,
532 kVarRedeclaredCatchBinding = 107,
533 kWasmRefTypes = 108,
534 kOBSOLETE_WasmBulkMemory = 109,
535 kOBSOLETE_WasmMultiValue = 110,
536 kWasmExceptionHandling = 111,
537 kInvalidatedMegaDOMProtector = 112,
538 kFunctionPrototypeArguments = 113,
539 kFunctionPrototypeCaller = 114,
540 kTurboFanOsrCompileStarted = 115,
541 kAsyncStackTaggingCreateTaskCall = 116,
542 kDurationFormat = 117,
543 kInvalidatedNumberStringNotRegexpLikeProtector = 118,
544 kOBSOLETE_RegExpUnicodeSetIncompatibilitiesWithUnicodeMode = 119,
545 kImportAssertionDeprecatedSyntax = 120,
546 kLocaleInfoObsoletedGetters = 121,
547 kLocaleInfoFunctions = 122,
548 kCompileHintsMagicAll = 123,
549 kInvalidatedNoProfilingProtector = 124,
550 kWasmMemory64 = 125,
551 kWasmMultiMemory = 126,
552 kWasmGC = 127,
553 kWasmImportedStrings = 128,
554 kSourceMappingUrlMagicCommentAtSign = 129,
555 kTemporalObject = 130,
556 kWasmModuleCompilation = 131,
557 kInvalidatedNoUndetectableObjectsProtector = 132,
558 kWasmJavaScriptPromiseIntegration = 133,
559 kWasmReturnCall = 134,
560 kWasmExtendedConst = 135,
561 kWasmRelaxedSimd = 136,
562 kWasmTypeReflection = 137,
563 kWasmExnRef = 138,
564 kWasmTypedFuncRef = 139,
565 kInvalidatedStringWrapperToPrimitiveProtector = 140,
566
567 // If you add new values here, you'll also need to update Chromium's:
568 // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
569 // this list need to be landed first, then changes on the Chromium side.
570 kUseCounterFeatureCount // This enum value must be last.
571 };
572
574 kMessageLog = (1 << 0),
575 kMessageDebug = (1 << 1),
576 kMessageInfo = (1 << 2),
577 kMessageError = (1 << 3),
578 kMessageWarning = (1 << 4),
579 kMessageAll = kMessageLog | kMessageDebug | kMessageInfo | kMessageError |
580 kMessageWarning,
581 };
582
583 using UseCounterCallback = void (*)(Isolate* isolate,
584 UseCounterFeature feature);
585
600 static Isolate* Allocate();
601
605 static void Initialize(Isolate* isolate, const CreateParams& params);
606
616 static Isolate* New(const CreateParams& params);
617
625
633
637 bool IsCurrent() const;
638
653
666
673
680
687
693
694#if defined(V8_OS_WIN)
698 void SetFilterETWSessionByURLCallback(FilterETWSessionByURLCallback callback);
699#endif // V8_OS_WIN
700
708
715 void SetBatterySaverMode(bool battery_saver_mode_enabled);
716
723
734 void Enter();
735
743 void Exit();
744
749 void Dispose();
750
756
765
770 V8_INLINE void SetData(uint32_t slot, void* data);
771
776 V8_INLINE void* GetData(uint32_t slot);
777
782 V8_INLINE static uint32_t GetNumberOfDataSlots();
783
789 template <class T>
791
797
803
807 void GetHeapStatistics(HeapStatistics* heap_statistics);
808
813
824 size_t index);
825
830
841 size_t type_index);
842
851
865 std::unique_ptr<MeasureMemoryDelegate> delegate,
866 MeasureMemoryExecution execution = MeasureMemoryExecution::kDefault);
867
880 void GetStackSample(const RegisterState& state, void** frames,
881 size_t frames_limit, SampleInfo* sample_info);
882
896 int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
897
903
907 void SetIdle(bool is_idle);
908
911
913 bool InContext();
914
920
928
934
940 template <int N>
941 Local<Value> ThrowError(const char (&message)[N]) {
942 return ThrowError(String::NewFromUtf8Literal(this, message));
943 }
945
953
954 using GCCallback = void (*)(Isolate* isolate, GCType type,
955 GCCallbackFlags flags);
956 using GCCallbackWithData = void (*)(Isolate* isolate, GCType type,
957 GCCallbackFlags flags, void* data);
958
970 GCType gc_type_filter = kGCTypeAll);
971
977 void AddGCPrologueCallback(GCCallbackWithData callback, void* data = nullptr,
978 GCType gc_type_filter = kGCTypeAll);
979
987
993 void RemoveGCPrologueCallback(GCCallbackWithData, void* data = nullptr);
994
1002 GCType gc_type_filter = kGCTypeAll);
1003
1009 void AddGCEpilogueCallback(GCCallbackWithData callback, void* data = nullptr,
1010 GCType gc_type_filter = kGCTypeAll);
1011
1019
1026 void* data = nullptr);
1027
1036
1048 "Set the heap on Isolate creation using CreateParams instead.")
1049 void AttachCppHeap(CppHeap*);
1050
1057 "Set the heap on Isolate creation using CreateParams instead.")
1058 void DetachCppHeap();
1059
1064 CppHeap* GetCppHeap() const;
1065
1069 enum class AtomicsWaitEvent {
1071 kStartWait,
1073 kWokenUp,
1075 kTimedOut,
1077 kTerminatedExecution,
1079 kAPIStopped,
1081 kNotEqual
1082 };
1083
1089 public:
1104 void Wake();
1105 };
1106
1131 Local<SharedArrayBuffer> array_buffer,
1132 size_t offset_in_bytes, int64_t value,
1133 double timeout_in_ms,
1134 AtomicsWaitWakeHandle* stop_handle,
1135 void* data);
1136
1144
1146
1155
1164
1174
1190
1199 void RequestInterrupt(InterruptCallback callback, void* data);
1200
1207
1218
1230 StackState stack_state);
1231
1236
1244
1249
1258
1263
1269
1275
1283
1288
1292 void EnqueueMicrotask(MicrotaskCallback callback, void* data = nullptr);
1293
1298
1303
1318 MicrotasksCompletedCallbackWithData callback, void* data = nullptr);
1319
1324 MicrotasksCompletedCallbackWithData callback, void* data = nullptr);
1325
1330
1336
1345
1356 const std::shared_ptr<metrics::Recorder>& metrics_recorder);
1357
1364
1380 "Use MemoryPressureNotification() to influence the GC schedule.")
1381 bool IdleNotificationDeadline(double deadline_in_seconds);
1382
1387 void LowMemoryNotification();
1388
1398 int ContextDisposedNotification(bool dependant_context = true);
1399
1404 void IsolateInForegroundNotification();
1405
1410 void IsolateInBackgroundNotification();
1411
1419 void SetRAILMode(RAILMode rail_mode);
1420
1424 void UpdateLoadStartTime();
1425
1430 void IncreaseHeapLimitForDebugging();
1431
1435 void RestoreOriginalHeapLimit();
1436
1441 bool IsHeapLimitIncreasedForDebugging();
1442
1465 void SetJitCodeEventHandler(JitCodeEventOptions options,
1466 JitCodeEventHandler event_handler);
1467
1477 void SetStackLimit(uintptr_t stack_limit);
1478
1494 void GetCodeRange(void** start, size_t* length_in_bytes);
1495
1500 void GetEmbeddedCodeRange(const void** start, size_t* length_in_bytes);
1501
1505 JSEntryStubs GetJSEntryStubs();
1506
1507 static constexpr size_t kMinCodePagesBufferSize = 32;
1508
1522 size_t CopyCodePages(size_t capacity, MemoryRange* code_pages_out);
1523
1525 void SetFatalErrorHandler(FatalErrorCallback that);
1526
1528 void SetOOMErrorHandler(OOMErrorCallback that);
1529
1535 void AddNearHeapLimitCallback(NearHeapLimitCallback callback, void* data);
1536
1544 void RemoveNearHeapLimitCallback(NearHeapLimitCallback callback,
1545 size_t heap_limit);
1546
1553 void AutomaticallyRestoreInitialHeapLimit(double threshold_percent = 0.5);
1554
1559 void SetModifyCodeGenerationFromStringsCallback(
1561
1566 void SetAllowWasmCodeGenerationCallback(
1568
1573 void SetWasmModuleCallback(ExtensionCallback callback);
1574 void SetWasmInstanceCallback(ExtensionCallback callback);
1575
1576 void SetWasmStreamingCallback(WasmStreamingCallback callback);
1577
1578 void SetWasmAsyncResolvePromiseCallback(
1580
1581 void SetWasmLoadSourceMapCallback(WasmLoadSourceMapCallback callback);
1582
1583 void SetWasmImportedStringsEnabledCallback(
1585
1586 void SetSharedArrayBufferConstructorEnabledCallback(
1588
1589 void SetWasmJSPIEnabledCallback(WasmJSPIEnabledCallback callback);
1590
1595 void SetJavaScriptCompileHintsMagicEnabledCallback(
1597
1603 void InstallConditionalFeatures(Local<Context> context);
1604
1609 bool IsDead();
1610
1620 bool AddMessageListener(MessageCallback that,
1621 Local<Value> data = Local<Value>());
1622
1634 bool AddMessageListenerWithErrorLevel(MessageCallback that,
1635 int message_levels,
1636 Local<Value> data = Local<Value>());
1637
1641 void RemoveMessageListeners(MessageCallback that);
1642
1644 void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
1645
1650 void SetCaptureStackTraceForUncaughtExceptions(
1651 bool capture, int frame_limit = 10,
1652 StackTrace::StackTraceOptions options = StackTrace::kOverview);
1653
1659 V8_DEPRECATE_SOON("Will be removed without replacement. crbug.com/v8/14172")
1660 void VisitExternalResources(ExternalResourceVisitor* visitor);
1661
1666 bool IsInUse();
1667
1673 void SetAllowAtomicsWait(bool allow);
1674
1688 enum class TimeZoneDetection { kSkip, kRedetect };
1689
1701 TimeZoneDetection time_zone_detection = TimeZoneDetection::kSkip);
1702
1713
1714 Isolate() = delete;
1715 ~Isolate() = delete;
1716 Isolate(const Isolate&) = delete;
1717 Isolate& operator=(const Isolate&) = delete;
1718 // Deleting operator new and delete here is allowed as ctor and dtor is also
1719 // deleted.
1720 void* operator new(size_t size) = delete;
1721 void* operator new[](size_t size) = delete;
1722 void operator delete(void*, size_t) = delete;
1723 void operator delete[](void*, size_t) = delete;
1724
1725 private:
1726 template <class K, class V, class Traits>
1728
1729 internal::Address* GetDataFromSnapshotOnce(size_t index);
1730 void ReportExternalAllocationLimitReached();
1731};
1732
1733void Isolate::SetData(uint32_t slot, void* data) {
1734 using I = internal::Internals;
1735 I::SetEmbedderData(this, slot, data);
1736}
1737
1738void* Isolate::GetData(uint32_t slot) {
1739 using I = internal::Internals;
1740 return I::GetEmbedderData(this, slot);
1741}
1742
1743uint32_t Isolate::GetNumberOfDataSlots() {
1744 using I = internal::Internals;
1745 return I::kNumIsolateDataSlots;
1746}
1747
1748template <class T>
1749MaybeLocal<T> Isolate::GetDataFromSnapshotOnce(size_t index) {
1750 if (auto slot = GetDataFromSnapshotOnce(index); slot) {
1751 internal::PerformCastCheck(
1752 internal::ValueHelper::SlotAsValue<T, false>(slot));
1753 return Local<T>::FromSlot(slot);
1754 }
1755 return {};
1756}
1757
1758} // namespace v8
1759
1760#endif // INCLUDE_V8_ISOLATE_H_
AllowJavascriptExecutionScope & operator=(const AllowJavascriptExecutionScope &)=delete
AllowJavascriptExecutionScope(const AllowJavascriptExecutionScope &)=delete
DisallowJavascriptExecutionScope(Isolate *isolate, OnFailure on_failure)
DisallowJavascriptExecutionScope(const DisallowJavascriptExecutionScope &)=delete
DisallowJavascriptExecutionScope & operator=(const DisallowJavascriptExecutionScope &)=delete
SafeForTerminationScope & operator=(const SafeForTerminationScope &)=delete
SafeForTerminationScope(const SafeForTerminationScope &)=delete
Scope(Isolate *isolate)
Definition v8-isolate.h:311
Scope(const Scope &)=delete
Scope & operator=(const Scope &)=delete
SuppressMicrotaskExecutionScope & operator=(const SuppressMicrotaskExecutionScope &)=delete
SuppressMicrotaskExecutionScope(Isolate *isolate, MicrotaskQueue *microtask_queue=nullptr)
SuppressMicrotaskExecutionScope(const SuppressMicrotaskExecutionScope &)=delete
void SetCounterFunction(CounterLookupCallback)
void DiscardThreadSpecificMetadata()
void SetIdle(bool is_idle)
Local< Context > GetEnteredOrMicrotaskContext()
void SetAddCrashKeyCallback(AddCrashKeyCallback)
void AddGCPrologueCallback(GCCallbackWithData callback, void *data=nullptr, GCType gc_type_filter=kGCTypeAll)
void SetBatterySaverMode(bool battery_saver_mode_enabled)
bool(*)(Isolate *) AbortOnUncaughtExceptionCallback
Definition v8-isolate.h:663
void SetHostInitializeImportMetaObjectCallback(HostInitializeImportMetaObjectCallback callback)
void SetHostImportModuleDynamicallyCallback(HostImportModuleDynamicallyCallback callback)
void EnqueueMicrotask(MicrotaskCallback callback, void *data=nullptr)
static void Initialize(Isolate *isolate, const CreateParams &params)
void DumpAndResetStats()
@ kFullGarbageCollection
Definition v8-isolate.h:412
void GetStackSample(const RegisterState &state, void **frames, size_t frames_limit, SampleInfo *sample_info)
void AddCallCompletedCallback(CallCompletedCallback callback)
static Isolate * GetCurrent()
void SetContinuationPreservedEmbedderData(Local< Value > data)
bool GetHeapObjectStatisticsAtLastGC(HeapObjectStatistics *object_statistics, size_t type_index)
void SetPromiseRejectCallback(PromiseRejectCallback callback)
ArrayBuffer::Allocator * GetArrayBufferAllocator()
void SetCreateHistogramFunction(CreateHistogramCallback)
void GetHeapStatistics(HeapStatistics *heap_statistics)
void SetPrepareStackTraceCallback(PrepareStackTraceCallback callback)
Isolate()=delete
void AddGCEpilogueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll)
Local< Context > GetIncumbentContext()
MicrotasksPolicy GetMicrotasksPolicy() const
Local< Value > GetContinuationPreservedEmbedderData()
void RequestGarbageCollectionForTesting(GarbageCollectionType type)
bool InContext()
void RemoveGCPrologueCallback(GCCallback callback)
size_t NumberOfHeapSpaces()
void(*)(Isolate *isolate, GCType type, GCCallbackFlags flags, void *data) GCCallbackWithData
Definition v8-isolate.h:957
bool GetHeapCodeAndMetadataStatistics(HeapCodeStatistics *object_statistics)
size_t(*)() GetExternallyAllocatedMemoryInBytesCallback
void RemoveGCEpilogueCallback(GCCallbackWithData callback, void *data=nullptr)
void ClearCachesForTesting()
void SetAtomicsWaitCallback(AtomicsWaitCallback callback, void *data)
void AddGCPrologueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll)
void Dispose()
void DateTimeConfigurationChangeNotification(TimeZoneDetection time_zone_detection=TimeZoneDetection::kSkip)
void(*)(Isolate *isolate, UseCounterFeature feature) UseCounterCallback
Definition v8-isolate.h:584
static Isolate * TryGetCurrent()
void RequestInterrupt(InterruptCallback callback, void *data)
void RemoveBeforeCallEnteredCallback(BeforeCallEnteredCallback callback)
void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallbackWithData callback, void *data=nullptr)
void RemoveCallCompletedCallback(CallCompletedCallback callback)
void Enter()
V8_DEPRECATE_SOON("Use MemoryPressureNotification() to influence the GC schedule.") bool IdleNotificationDeadline(double deadline_in_seconds)
Local< Value > ThrowError(const char(&message)[N])
Definition v8-isolate.h:941
void SetPromiseHook(PromiseHook hook)
void SetEmbedderRootsHandler(EmbedderRootsHandler *handler)
Local< Value > ThrowError(Local< String > message)
void SetGetExternallyAllocatedMemoryInBytesCallback(GetExternallyAllocatedMemoryInBytesCallback callback)
void SetMicrotasksPolicy(MicrotasksPolicy policy)
HeapProfiler * GetHeapProfiler()
void RequestGarbageCollectionForTesting(GarbageCollectionType type, StackState stack_state)
void TerminateExecution()
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
bool MeasureMemory(std::unique_ptr< MeasureMemoryDelegate > delegate, MeasureMemoryExecution execution=MeasureMemoryExecution::kDefault)
void SetMetricsRecorder(const std::shared_ptr< metrics::Recorder > &metrics_recorder)
size_t NumberOfTrackedHeapObjectTypes()
Local< Value > ThrowException(Local< Value > exception)
Local< Context > GetCurrentContext()
void ClearKeptObjects()
Isolate(const Isolate &)=delete
bool GetHeapSpaceStatistics(HeapSpaceStatistics *space_statistics, size_t index)
void RemoveGCPrologueCallback(GCCallbackWithData, void *data=nullptr)
void SetUseCounterCallback(UseCounterCallback callback)
void LocaleConfigurationChangeNotification()
~Isolate()=delete
void CancelTerminateExecution()
void AddMicrotasksCompletedCallback(MicrotasksCompletedCallbackWithData callback, void *data=nullptr)
void MemoryPressureNotification(MemoryPressureLevel level)
void AddGCEpilogueCallback(GCCallbackWithData callback, void *data=nullptr, GCType gc_type_filter=kGCTypeAll)
void SetEventLogger(LogEventCallback that)
V8_DEPRECATE_SOON("Set the heap on Isolate creation using CreateParams instead.") void AttachCppHeap(CppHeap *)
void EnqueueMicrotask(Local< Function > microtask)
Isolate & operator=(const Isolate &)=delete
bool IsExecutionTerminating()
static Isolate * New(const CreateParams &params)
void RemoveGCEpilogueCallback(GCCallback callback)
int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes)
static Isolate * Allocate()
void(*)(Isolate *isolate, GCType type, GCCallbackFlags flags) GCCallback
Definition v8-isolate.h:955
bool IsCurrent() const
void SetAddHistogramSampleFunction(AddHistogramSampleCallback)
void SetHostCreateShadowRealmContextCallback(HostCreateShadowRealmContextCallback callback)
void AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback)
void PerformMicrotaskCheckpoint()
void SetAbortOnUncaughtExceptionCallback(AbortOnUncaughtExceptionCallback callback)
bool HasPendingBackgroundTasks()
void(*)(AtomicsWaitEvent event, Local< SharedArrayBuffer > array_buffer, size_t offset_in_bytes, int64_t value, double timeout_in_ms, AtomicsWaitWakeHandle *stop_handle, void *data) AtomicsWaitCallback
void set_max_young_generation_size_in_bytes(size_t limit)
Definition v8-isolate.h:137
void set_stack_limit(uint32_t *value)
Definition v8-isolate.h:101
void set_initial_young_generation_size_in_bytes(size_t initial_size)
Definition v8-isolate.h:151
size_t max_old_generation_size_in_bytes() const
Definition v8-isolate.h:122
size_t initial_old_generation_size_in_bytes() const
Definition v8-isolate.h:141
size_t initial_young_generation_size_in_bytes() const
Definition v8-isolate.h:148
void set_code_range_size_in_bytes(size_t limit)
Definition v8-isolate.h:113
size_t code_range_size_in_bytes() const
Definition v8-isolate.h:112
size_t max_young_generation_size_in_bytes() const
Definition v8-isolate.h:134
void ConfigureDefaults(uint64_t physical_memory, uint64_t virtual_memory_limit)
void set_max_old_generation_size_in_bytes(size_t limit)
Definition v8-isolate.h:125
uint32_t * stack_limit() const
Definition v8-isolate.h:100
void set_initial_old_generation_size_in_bytes(size_t initial_size)
Definition v8-isolate.h:144
void ConfigureDefaultsFromHeapSize(size_t initial_heap_size_in_bytes, size_t maximum_heap_size_in_bytes)
EmbedderStackState
Definition common.h:15
uintptr_t Address
Definition v8-internal.h:31
bool(*)(Local< Context > context) WasmJSPIEnabledCallback
void(*)(const char *name, int status) LogEventCallback
bool(*)(const FunctionCallbackInfo< Value > &) ExtensionCallback
void(*)(Local< Message > message, Local< Value > data) MessageCallback
MemoryPressureLevel
Definition v8-isolate.h:195
void(*)(Isolate *, void *) MicrotasksCompletedCallbackWithData
void(*)(CrashKeyId id, const std::string &value) AddCrashKeyCallback
RAILMode
Definition v8-isolate.h:170
@ PERFORMANCE_IDLE
Definition v8-isolate.h:181
@ PERFORMANCE_ANIMATION
Definition v8-isolate.h:178
@ PERFORMANCE_LOAD
Definition v8-isolate.h:184
@ PERFORMANCE_RESPONSE
Definition v8-isolate.h:174
void(*)(PromiseRejectMessage message) PromiseRejectCallback
Definition v8-promise.h:170
bool(*)(Local< Context > context, Local< String > source) AllowWasmCodeGenerationCallback
void(*)(PromiseHookType type, Local< Promise > promise, Local< Value > parent) PromiseHook
Definition v8-promise.h:144
bool(*)(Local< Context > context) JavaScriptCompileHintsMagicEnabledCallback
void(*)(void *data) MicrotaskCallback
ModifyCodeGenerationFromStringsResult(*)(Local< Context > context, Local< Value > source, bool is_code_like) ModifyCodeGenerationFromStringsCallback2
GCCallbackFlags
void(*)(Isolate *) CallCompletedCallback
bool(*)(Local< Context > context) WasmImportedStringsEnabledCallback
size_t(*)(void *data, size_t current_heap_limit, size_t initial_heap_limit) NearHeapLimitCallback
JitCodeEventOptions
void(*)(Local< Object > target, AccessType type, Local< Value > data) FailedAccessCheckCallback
void(*)(Isolate *isolate, void *data) InterruptCallback
bool(*)(Local< Context > context) SharedArrayBufferConstructorEnabledCallback
MeasureMemoryExecution
void(*)(const FunctionCallbackInfo< Value > &) WasmStreamingCallback
void(*)(const char *location, const char *message) FatalErrorCallback
void(*)(const char *location, const OOMDetails &details) OOMErrorCallback
void(*)(Isolate *isolate, Local< Context > context, Local< Promise::Resolver > resolver, Local< Value > result, WasmAsyncSuccess success) WasmAsyncResolvePromiseCallback
void(*)(Isolate *) BeforeCallEnteredCallback
void(*)(void *histogram, int sample) AddHistogramSampleCallback
int *(*)(const char *name) CounterLookupCallback
void(*)(Local< Context > context, Local< Module > module, Local< Object > meta) HostInitializeImportMetaObjectCallback
MicrotasksPolicy
void *(*)(const char *name, int min, int max, size_t buckets) CreateHistogramCallback
void(*)(const JitCodeEvent *event) JitCodeEventHandler
Definition v8-unwinder.h:68
#define V8_EXPORT
Definition v8config.h:753
#define V8_INLINE
Definition v8config.h:477
#define V8_DEPRECATE_SOON(message)
Definition v8config.h:571
#define ALLOW_COPY_AND_MOVE_WITH_DEPRECATED_FIELDS(ClassName)
Definition v8config.h:594
#define V8_NODISCARD
Definition v8config.h:650