5#ifndef INCLUDE_V8_ISOLATE_H_
6#define INCLUDE_V8_ISOLATE_H_
37class SharedArrayBuffer;
83 size_t maximum_heap_size_in_bytes);
95 uint64_t virtual_memory_limit);
123 return max_old_generation_size_;
126 max_old_generation_size_ = limit;
135 return max_young_generation_size_;
138 max_young_generation_size_ = limit;
142 return initial_old_generation_size_;
145 initial_old_generation_size_ = initial_size;
149 return initial_young_generation_size_;
152 initial_young_generation_size_ = initial_size;
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;
264 const intptr_t* external_references =
nullptr;
270 bool allow_atomics_wait =
true;
275 bool only_terminate_in_safe_scope =
false;
282 int embedder_wrapper_type_index = -1;
283 int embedder_wrapper_object_index = -1;
295 Isolate* experimental_attach_to_shared_isolate =
nullptr;
336 bool was_execution_allowed_assert_;
337 bool was_execution_allowed_throws_;
338 bool was_execution_allowed_dump_;
357 bool was_execution_allowed_assert_;
358 bool was_execution_allowed_throws_;
359 bool was_execution_allowed_dump_;
379 internal::Isolate*
const isolate_;
380 internal::MicrotaskQueue*
const microtask_queue_;
383 friend class internal::ThreadLocalTop;
400 internal::Isolate* isolate_;
410 kMinorGarbageCollection
422 kMarkDequeOverflow = 3,
423 kStoreBufferOverflow = 4,
424 kSlotsBufferOverflow = 5,
430 kRegExpPrototypeStickyGetter = 11,
431 kRegExpPrototypeToString = 12,
432 kRegExpPrototypeUnicodeGetter = 13,
439 kHtmlCommentInExternalScript = 20,
441 kSloppyModeBlockScopedFunctionRedefinition = 22,
442 kForInInitializer = 23,
443 kArrayProtectorDirtied = 24,
444 kArraySpeciesModified = 25,
445 kArrayPrototypeConstructorModified = 26,
446 kArrayInstanceProtoModified = 27,
447 kArrayInstanceConstructorModified = 28,
448 kLegacyFunctionDeclaration = 29,
449 kRegExpPrototypeSourceGetter = 30,
450 kRegExpPrototypeOldFlagGetter = 31,
451 kDecimalWithLeadingZeroInStrictMode = 32,
452 kLegacyDateParser = 33,
453 kDefineGetterOrSetterWouldThrow = 34,
454 kFunctionConstructorReturnedUndefined = 35,
455 kAssigmentExpressionLHSIsCallInSloppy = 36,
456 kAssigmentExpressionLHSIsCallInStrict = 37,
457 kPromiseConstructorReturnedUndefined = 38,
458 kConstructorNonUndefinedPrimitiveReturn = 39,
459 kLabeledExpressionStatement = 40,
460 kLineOrParagraphSeparatorAsLineTerminator = 41,
462 kErrorCaptureStackTrace = 43,
463 kErrorPrepareStackTrace = 44,
464 kErrorStackTraceLimit = 45,
465 kWebAssemblyInstantiation = 46,
466 kDeoptimizerDisableSpeculation = 47,
467 kArrayPrototypeSortJSArrayModifiedPrototype = 48,
468 kFunctionTokenOffsetTooLongForToString = 49,
469 kWasmSharedMemory = 50,
470 kWasmThreadOpcodes = 51,
475 kDateTimeFormat = 56,
477 kRelativeTimeFormat = 58,
481 kStringLocaleCompare = 62,
482 kStringToLocaleUpperCase = 63,
483 kStringToLocaleLowerCase = 64,
484 kNumberToLocaleString = 65,
485 kDateToLocaleString = 66,
486 kDateToLocaleDateString = 67,
487 kDateToLocaleTimeString = 68,
488 kAttemptOverrideReadOnlyOnPrototypeSloppy = 69,
489 kAttemptOverrideReadOnlyOnPrototypeStrict = 70,
490 kOptimizedFunctionWithOneShotBytecode = 71,
491 kRegExpMatchIsTrueishOnNonJSRegExp = 72,
492 kRegExpMatchIsFalseishOnJSRegExp = 73,
493 kDateGetTimezoneOffset = 74,
494 kStringNormalize = 75,
495 kCallSiteAPIGetFunctionSloppyCall = 76,
496 kCallSiteAPIGetThisSloppyCall = 77,
497 kRegExpMatchAllWithNonGlobalRegExp = 78,
498 kRegExpExecCalledOnSlowRegExp = 79,
499 kRegExpReplaceCalledOnSlowRegExp = 80,
501 kSharedArrayBufferConstructed = 82,
502 kArrayPrototypeHasElements = 83,
503 kObjectPrototypeHasElements = 84,
504 kNumberFormatStyleUnit = 85,
505 kDateTimeFormatRange = 86,
506 kDateTimeFormatDateTimeStyle = 87,
507 kBreakIteratorTypeWord = 88,
508 kBreakIteratorTypeLine = 89,
509 kInvalidatedArrayBufferDetachingProtector = 90,
510 kInvalidatedArrayConstructorProtector = 91,
511 kInvalidatedArrayIteratorLookupChainProtector = 92,
512 kInvalidatedArraySpeciesLookupChainProtector = 93,
513 kInvalidatedIsConcatSpreadableLookupChainProtector = 94,
514 kInvalidatedMapIteratorLookupChainProtector = 95,
515 kInvalidatedNoElementsProtector = 96,
516 kInvalidatedPromiseHookProtector = 97,
517 kInvalidatedPromiseResolveLookupChainProtector = 98,
518 kInvalidatedPromiseSpeciesLookupChainProtector = 99,
519 kInvalidatedPromiseThenLookupChainProtector = 100,
520 kInvalidatedRegExpSpeciesLookupChainProtector = 101,
521 kInvalidatedSetIteratorLookupChainProtector = 102,
522 kInvalidatedStringIteratorLookupChainProtector = 103,
523 kInvalidatedStringLengthOverflowLookupChainProtector = 104,
524 kInvalidatedTypedArraySpeciesLookupChainProtector = 105,
525 kWasmSimdOpcodes = 106,
526 kVarRedeclaredCatchBinding = 107,
528 kWasmBulkMemory = 109,
529 kWasmMultiValue = 110,
530 kWasmExceptionHandling = 111,
531 kInvalidatedMegaDOMProtector = 112,
532 kFunctionPrototypeArguments = 113,
533 kFunctionPrototypeCaller = 114,
538 kUseCounterFeatureCount
542 kMessageLog = (1 << 0),
543 kMessageDebug = (1 << 1),
544 kMessageInfo = (1 << 2),
545 kMessageError = (1 << 3),
546 kMessageWarning = (1 << 4),
547 kMessageAll = kMessageLog | kMessageDebug | kMessageInfo | kMessageError |
640 void SetHostImportModuleDynamicallyCallback(
642 void SetHostImportModuleDynamicallyCallback(
649 void SetHostInitializeImportMetaObjectCallback(
656 void SetHostCreateShadowRealmContextCallback(
678 void ClearCachesForTesting();
711 void DumpAndResetStats();
720 void DiscardThreadSpecificMetadata();
726 V8_INLINE void SetData(uint32_t slot,
void* data);
738 V8_INLINE static uint32_t GetNumberOfDataSlots();
756 size_t NumberOfHeapSpaces();
773 size_t NumberOfTrackedHeapObjectTypes();
825 size_t frames_limit,
SampleInfo* sample_info);
840 int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
846 size_t NumberOfPhantomHandleResetsSinceLastCall();
857 void SetIdle(
bool is_idle);
892 return ThrowError(String::NewFromUtf8Literal(
this, message));
919 GCType gc_type_filter = kGCTypeAll);
921 GCType gc_type_filter = kGCTypeAll);
990 kTerminatedExecution,
1045 size_t offset_in_bytes, int64_t value,
1046 double timeout_in_ms,
1068 GCType gc_type_filter = kGCTypeAll);
1070 GCType gc_type_filter = kGCTypeAll);
1077 void* data =
nullptr);
1294 const std::shared_ptr<metrics::Recorder>& metrics_recorder);
1455 static constexpr size_t kMinCodePagesBufferSize = 32;
1591 bool capture,
int frame_limit = 10,
1672 void*
operator new(
size_t size) =
delete;
1673 void*
operator new[](
size_t size) =
delete;
1674 void operator delete(
void*, size_t) =
delete;
1675 void operator delete[](
void*, size_t) =
delete;
1678 template <
class K,
class V,
class Traits>
1682 void ReportExternalAllocationLimitReached();
1687 I::SetEmbedderData(
this, slot, data);
1692 return I::GetEmbedderData(
this, slot);
1697 return I::kNumIsolateDataSlots;
AllowJavascriptExecutionScope & operator=(const AllowJavascriptExecutionScope &)=delete
AllowJavascriptExecutionScope(Isolate *isolate)
~AllowJavascriptExecutionScope()
AllowJavascriptExecutionScope(const AllowJavascriptExecutionScope &)=delete
DisallowJavascriptExecutionScope(Isolate *isolate, OnFailure on_failure)
DisallowJavascriptExecutionScope(const DisallowJavascriptExecutionScope &)=delete
~DisallowJavascriptExecutionScope()
DisallowJavascriptExecutionScope & operator=(const DisallowJavascriptExecutionScope &)=delete
SafeForTerminationScope & operator=(const SafeForTerminationScope &)=delete
SafeForTerminationScope(const SafeForTerminationScope &)=delete
SafeForTerminationScope(v8::Isolate *isolate)
~SafeForTerminationScope()
Scope(const Scope &)=delete
Scope & operator=(const Scope &)=delete
~SuppressMicrotaskExecutionScope()
SuppressMicrotaskExecutionScope & operator=(const SuppressMicrotaskExecutionScope &)=delete
SuppressMicrotaskExecutionScope(Isolate *isolate, MicrotaskQueue *microtask_queue=nullptr)
SuppressMicrotaskExecutionScope(const SuppressMicrotaskExecutionScope &)=delete
void SetJitCodeEventHandler(JitCodeEventOptions options, JitCodeEventHandler event_handler)
void SetCounterFunction(CounterLookupCallback)
void SetWasmInstanceCallback(ExtensionCallback callback)
void SetOOMErrorHandler(OOMErrorCallback that)
void AttachCppHeap(CppHeap *)
void SetAddCrashKeyCallback(AddCrashKeyCallback)
void AddGCPrologueCallback(GCCallbackWithData callback, void *data=nullptr, GCType gc_type_filter=kGCTypeAll)
void SetSharedArrayBufferConstructorEnabledCallback(SharedArrayBufferConstructorEnabledCallback callback)
bool(*)(Isolate *) AbortOnUncaughtExceptionCallback
void LowMemoryNotification()
void SetWasmSimdEnabledCallback(WasmSimdEnabledCallback callback)
void SetWasmModuleCallback(ExtensionCallback callback)
void EnqueueMicrotask(MicrotaskCallback callback, void *data=nullptr)
void EnableMemorySavingsMode()
static void Initialize(Isolate *isolate, const CreateParams ¶ms)
bool AddMessageListener(MessageCallback that, Local< Value > data=Local< Value >())
CppHeap * GetCppHeap() const
void GetEmbeddedCodeRange(const void **start, size_t *length_in_bytes)
void SetStackLimit(uintptr_t stack_limit)
void AddCallCompletedCallback(CallCompletedCallback callback)
static Isolate * GetCurrent()
void VisitHandlesWithClassIds(PersistentHandleVisitor *visitor)
static V8_INLINE uint32_t GetNumberOfDataSlots()
void SetPromiseRejectCallback(PromiseRejectCallback callback)
void SetCreateHistogramFunction(CreateHistogramCallback)
void AddGCEpilogueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll)
MicrotasksPolicy GetMicrotasksPolicy() const
void RequestGarbageCollectionForTesting(GarbageCollectionType type)
JSEntryStubs GetJSEntryStubs()
void RemoveGCPrologueCallback(GCCallback callback)
void SetRAILMode(RAILMode rail_mode)
void(*)(Isolate *isolate, GCType type, GCCallbackFlags flags, void *data) GCCallbackWithData
size_t(*)() GetExternallyAllocatedMemoryInBytesCallback
void RemoveGCEpilogueCallback(GCCallbackWithData callback, void *data=nullptr)
void SetAtomicsWaitCallback(AtomicsWaitCallback callback, void *data)
void AddGCPrologueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll)
void DateTimeConfigurationChangeNotification(TimeZoneDetection time_zone_detection=TimeZoneDetection::kSkip)
void(*)(Isolate *isolate, UseCounterFeature feature) UseCounterCallback
void VisitWeakHandles(PersistentHandleVisitor *visitor)
void VisitExternalResources(ExternalResourceVisitor *visitor)
static Isolate * TryGetCurrent()
void AutomaticallyRestoreInitialHeapLimit(double threshold_percent=0.5)
void RequestInterrupt(InterruptCallback callback, void *data)
V8_INLINE void SetData(uint32_t slot, void *data)
void GetCodeRange(void **start, size_t *length_in_bytes)
void RemoveBeforeCallEnteredCallback(BeforeCallEnteredCallback callback)
void RestoreOriginalHeapLimit()
void SetWasmLoadSourceMapCallback(WasmLoadSourceMapCallback callback)
void SetWasmExceptionsEnabledCallback(WasmExceptionsEnabledCallback callback)
void RemoveNearHeapLimitCallback(NearHeapLimitCallback callback, size_t heap_limit)
void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallbackWithData callback, void *data=nullptr)
void RemoveCallCompletedCallback(CallCompletedCallback callback)
void SetEmbedderHeapTracer(EmbedderHeapTracer *tracer)
void SetAllowAtomicsWait(bool allow)
void SetAllowWasmCodeGenerationCallback(AllowWasmCodeGenerationCallback callback)
void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback)
void SetPromiseHook(PromiseHook hook)
void SetEmbedderRootsHandler(EmbedderRootsHandler *handler)
Local< Value > ThrowError(Local< String > message)
void SetGetExternallyAllocatedMemoryInBytesCallback(GetExternallyAllocatedMemoryInBytesCallback callback)
void SetCaptureStackTraceForUncaughtExceptions(bool capture, int frame_limit=10, StackTrace::StackTraceOptions options=StackTrace::kOverview)
V8_INLINE void * GetData(uint32_t slot)
void SetMicrotasksPolicy(MicrotasksPolicy policy)
void TerminateExecution()
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
void SetMetricsRecorder(const std::shared_ptr< metrics::Recorder > &metrics_recorder)
void DisableMemorySavingsMode()
bool IsHeapLimitIncreasedForDebugging()
void IsolateInBackgroundNotification()
Local< Value > ThrowException(Local< Value > exception)
Isolate(const Isolate &)=delete
size_t CopyCodePages(size_t capacity, MemoryRange *code_pages_out)
void RemoveGCPrologueCallback(GCCallbackWithData, void *data=nullptr)
void SetUseCounterCallback(UseCounterCallback callback)
void LocaleConfigurationChangeNotification()
void CancelTerminateExecution()
void AddMicrotasksCompletedCallback(MicrotasksCompletedCallbackWithData callback, void *data=nullptr)
void AddGCEpilogueCallback(GCCallbackWithData callback, void *data=nullptr, GCType gc_type_filter=kGCTypeAll)
void SetEventLogger(LogEventCallback that)
EmbedderHeapTracer * GetEmbedderHeapTracer()
void AddNearHeapLimitCallback(NearHeapLimitCallback callback, void *data)
bool IdleNotificationDeadline(double deadline_in_seconds)
void RequestGarbageCollectionForTesting(GarbageCollectionType type, EmbedderHeapTracer::EmbedderStackState stack_state)
void EnqueueMicrotask(Local< Function > microtask)
int ContextDisposedNotification(bool dependant_context=true)
Isolate & operator=(const Isolate &)=delete
void IncreaseHeapLimitForDebugging()
bool IsExecutionTerminating()
static Isolate * New(const CreateParams ¶ms)
void RemoveGCEpilogueCallback(GCCallback callback)
void SetWasmStreamingCallback(WasmStreamingCallback callback)
void InstallConditionalFeatures(Local< Context > context)
void RemoveMessageListeners(MessageCallback that)
static Isolate * Allocate()
void(*)(Isolate *isolate, GCType type, GCCallbackFlags flags) GCCallback
void UpdateLoadStartTime()
void SetAddHistogramSampleFunction(AddHistogramSampleCallback)
void AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback)
void SetModifyCodeGenerationFromStringsCallback(ModifyCodeGenerationFromStringsCallback2 callback)
void PerformMicrotaskCheckpoint()
void SetAbortOnUncaughtExceptionCallback(AbortOnUncaughtExceptionCallback callback)
bool AddMessageListenerWithErrorLevel(MessageCallback that, int message_levels, Local< Value > data=Local< Value >())
bool HasPendingBackgroundTasks()
void SetWasmDynamicTieringEnabledCallback(WasmDynamicTieringEnabledCallback callback)
void IsolateInForegroundNotification()
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 SetFatalErrorHandler(FatalErrorCallback that)
void set_max_young_generation_size_in_bytes(size_t limit)
void set_stack_limit(uint32_t *value)
void set_initial_young_generation_size_in_bytes(size_t initial_size)
size_t max_old_generation_size_in_bytes() const
size_t initial_old_generation_size_in_bytes() const
size_t initial_young_generation_size_in_bytes() const
void set_code_range_size_in_bytes(size_t limit)
size_t code_range_size_in_bytes() const
size_t max_young_generation_size_in_bytes() const
void ConfigureDefaults(uint64_t physical_memory, uint64_t virtual_memory_limit)
void set_max_old_generation_size_in_bytes(size_t limit)
uint32_t * stack_limit() const
void set_initial_old_generation_size_in_bytes(size_t initial_size)
void ConfigureDefaultsFromHeapSize(size_t initial_heap_size_in_bytes, size_t maximum_heap_size_in_bytes)
V8_INLINE void PerformCastCheck(T *data)
void(*)(const char *name, int status) LogEventCallback
bool(*)(const FunctionCallbackInfo< Value > &) ExtensionCallback
void(*)(Local< Message > message, Local< Value > data) MessageCallback
void(*)(Isolate *, void *) MicrotasksCompletedCallbackWithData
void(*)(CrashKeyId id, const std::string &value) AddCrashKeyCallback
bool(*)(Local< Context > context) WasmExceptionsEnabledCallback
void(*)(PromiseRejectMessage message) PromiseRejectCallback
bool(*)(Local< Context > context) WasmSimdEnabledCallback
bool(*)(Local< Context > context, Local< String > source) AllowWasmCodeGenerationCallback
void(*)(PromiseHookType type, Local< Promise > promise, Local< Value > parent) PromiseHook
void(*)(void *data) MicrotaskCallback
ModifyCodeGenerationFromStringsResult(*)(Local< Context > context, Local< Value > source, bool is_code_like) ModifyCodeGenerationFromStringsCallback2
void(*)(Isolate *) CallCompletedCallback
size_t(*)(void *data, size_t current_heap_limit, size_t initial_heap_limit) NearHeapLimitCallback
void(*)(Local< Object > target, AccessType type, Local< Value > data) FailedAccessCheckCallback
void(*)(Isolate *isolate, void *data) InterruptCallback
bool(*)(Local< Context > context) SharedArrayBufferConstructorEnabledCallback
void(*)(const FunctionCallbackInfo< Value > &) WasmStreamingCallback
void(*)(const char *location, const char *message) FatalErrorCallback
void(*)(Isolate *) BeforeCallEnteredCallback
void(*)(void *histogram, int sample) AddHistogramSampleCallback
int *(*)(const char *name) CounterLookupCallback
void(*)(const char *location, bool is_heap_oom) OOMErrorCallback
bool(*)(Local< Context > context) WasmDynamicTieringEnabledCallback
void(*)(Local< Context > context, Local< Module > module, Local< Object > meta) HostInitializeImportMetaObjectCallback
void *(*)(const char *name, int min, int max, size_t buckets) CreateHistogramCallback
void(*)(const JitCodeEvent *event) JitCodeEventHandler
ResourceConstraints constraints
std::shared_ptr< ArrayBuffer::Allocator > array_buffer_allocator_shared
#define V8_DEPRECATED(message)