v8  8.1.307(node14.1.0)
V8 is Google's open source JavaScript engine
Isolate Class Reference

#include <v8.h>

Data Structures

class  AllowJavascriptExecutionScope
 
class  AtomicsWaitWakeHandle
 
struct  CreateParams
 
class  DisallowJavascriptExecutionScope
 
class  SafeForTerminationScope
 
class  Scope
 
class  SuppressMicrotaskExecutionScope
 

Public Types

enum  GarbageCollectionType { kFullGarbageCollection, kMinorGarbageCollection }
 
enum  UseCounterFeature {
  kUseAsm = 0, kBreakIterator = 1, kLegacyConst = 2, kMarkDequeOverflow = 3,
  kStoreBufferOverflow = 4, kSlotsBufferOverflow = 5, kObjectObserve = 6, kForcedGC = 7,
  kSloppyMode = 8, kStrictMode = 9, kStrongMode = 10, kRegExpPrototypeStickyGetter = 11,
  kRegExpPrototypeToString = 12, kRegExpPrototypeUnicodeGetter = 13, kIntlV8Parse = 14, kIntlPattern = 15,
  kIntlResolved = 16, kPromiseChain = 17, kPromiseAccept = 18, kPromiseDefer = 19,
  kHtmlCommentInExternalScript = 20, kHtmlComment = 21, kSloppyModeBlockScopedFunctionRedefinition = 22, kForInInitializer = 23,
  kArrayProtectorDirtied = 24, kArraySpeciesModified = 25, kArrayPrototypeConstructorModified = 26, kArrayInstanceProtoModified = 27,
  kArrayInstanceConstructorModified = 28, kLegacyFunctionDeclaration = 29, kRegExpPrototypeSourceGetter = 30, kRegExpPrototypeOldFlagGetter = 31,
  kDecimalWithLeadingZeroInStrictMode = 32, kLegacyDateParser = 33, kDefineGetterOrSetterWouldThrow = 34, kFunctionConstructorReturnedUndefined = 35,
  kAssigmentExpressionLHSIsCallInSloppy = 36, kAssigmentExpressionLHSIsCallInStrict = 37, kPromiseConstructorReturnedUndefined = 38, kConstructorNonUndefinedPrimitiveReturn = 39,
  kLabeledExpressionStatement = 40, kLineOrParagraphSeparatorAsLineTerminator = 41, kIndexAccessor = 42, kErrorCaptureStackTrace = 43,
  kErrorPrepareStackTrace = 44, kErrorStackTraceLimit = 45, kWebAssemblyInstantiation = 46, kDeoptimizerDisableSpeculation = 47,
  kArrayPrototypeSortJSArrayModifiedPrototype = 48, kFunctionTokenOffsetTooLongForToString = 49, kWasmSharedMemory = 50, kWasmThreadOpcodes = 51,
  kAtomicsNotify = 52, kAtomicsWake = 53, kCollator = 54, kNumberFormat = 55,
  kDateTimeFormat = 56, kPluralRules = 57, kRelativeTimeFormat = 58, kLocale = 59,
  kListFormat = 60, kSegmenter = 61, kStringLocaleCompare = 62, kStringToLocaleUpperCase = 63,
  kStringToLocaleLowerCase = 64, kNumberToLocaleString = 65, kDateToLocaleString = 66, kDateToLocaleDateString = 67,
  kDateToLocaleTimeString = 68, kAttemptOverrideReadOnlyOnPrototypeSloppy = 69, kAttemptOverrideReadOnlyOnPrototypeStrict = 70, kOptimizedFunctionWithOneShotBytecode = 71,
  kRegExpMatchIsTrueishOnNonJSRegExp = 72, kRegExpMatchIsFalseishOnJSRegExp = 73, kDateGetTimezoneOffset = 74, kStringNormalize = 75,
  kCallSiteAPIGetFunctionSloppyCall = 76, kCallSiteAPIGetThisSloppyCall = 77, kRegExpMatchAllWithNonGlobalRegExp = 78, kRegExpExecCalledOnSlowRegExp = 79,
  kRegExpReplaceCalledOnSlowRegExp = 80, kDisplayNames = 81, kSharedArrayBufferConstructed = 82, kUseCounterFeatureCount
}
 
enum  MessageErrorLevel {
  kMessageLog = (1 << 0), kMessageDebug = (1 << 1), kMessageInfo = (1 << 2), kMessageError = (1 << 3),
  kMessageWarning = (1 << 4), kMessageAll
}
 
enum  AtomicsWaitEvent {
  kStartWait, kWokenUp, kTimedOut, kTerminatedExecution,
  kAPIStopped, kNotEqual
}
 
enum  TimeZoneDetection { kSkip, kRedetect }
 
typedef void(* UseCounterCallback) (Isolate *isolate, UseCounterFeature feature)
 
typedef bool(* AbortOnUncaughtExceptionCallback) (Isolate *)
 
typedef void(* GCCallback) (Isolate *isolate, GCType type, GCCallbackFlags flags)
 
typedef void(* GCCallbackWithData) (Isolate *isolate, GCType type, GCCallbackFlags flags, void *data)
 
typedef void(* AtomicsWaitCallback) (AtomicsWaitEvent event, Local< SharedArrayBuffer > array_buffer, size_t offset_in_bytes, int64_t value, double timeout_in_ms, AtomicsWaitWakeHandle *stop_handle, void *data)
 
typedef size_t(* GetExternallyAllocatedMemoryInBytesCallback) ()
 

Public Member Functions

void ClearKeptObjects ()
 
void SetAbortOnUncaughtExceptionCallback (AbortOnUncaughtExceptionCallback callback)
 
void SetHostCleanupFinalizationGroupCallback (HostCleanupFinalizationGroupCallback callback)
 
void SetHostImportModuleDynamicallyCallback (HostImportModuleDynamicallyCallback callback)
 
void SetHostInitializeImportMetaObjectCallback (HostInitializeImportMetaObjectCallback callback)
 
void SetPrepareStackTraceCallback (PrepareStackTraceCallback callback)
 
void MemoryPressureNotification (MemoryPressureLevel level)
 
void Enter ()
 
void Exit ()
 
void Dispose ()
 
void DumpAndResetStats ()
 
void DiscardThreadSpecificMetadata ()
 
V8_INLINE void SetData (uint32_t slot, void *data)
 
V8_INLINE void * GetData (uint32_t slot)
 
template<class T >
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce (size_t index)
 
void GetHeapStatistics (HeapStatistics *heap_statistics)
 
size_t NumberOfHeapSpaces ()
 
bool GetHeapSpaceStatistics (HeapSpaceStatistics *space_statistics, size_t index)
 
size_t NumberOfTrackedHeapObjectTypes ()
 
bool GetHeapObjectStatisticsAtLastGC (HeapObjectStatistics *object_statistics, size_t type_index)
 
bool GetHeapCodeAndMetadataStatistics (HeapCodeStatistics *object_statistics)
 
bool MeasureMemory (std::unique_ptr< MeasureMemoryDelegate > delegate, MeasureMemoryExecution execution=MeasureMemoryExecution::kDefault)
 
MaybeLocal< PromiseMeasureMemory (Local< Context > context, MeasureMemoryMode mode)
 
void GetStackSample (const RegisterState &state, void **frames, size_t frames_limit, SampleInfo *sample_info)
 
V8_INLINE int64_t AdjustAmountOfExternalAllocatedMemory (int64_t change_in_bytes)
 
size_t NumberOfPhantomHandleResetsSinceLastCall ()
 
HeapProfilerGetHeapProfiler ()
 
void SetIdle (bool is_idle)
 
ArrayBuffer::AllocatorGetArrayBufferAllocator ()
 
bool InContext ()
 
Local< ContextGetCurrentContext ()
 
Local< ContextGetEnteredContext ()
 
Local< ContextGetEnteredOrMicrotaskContext ()
 
Local< ContextGetIncumbentContext ()
 
Local< ValueThrowException (Local< Value > exception)
 
void AddGCPrologueCallback (GCCallbackWithData callback, void *data=nullptr, GCType gc_type_filter=kGCTypeAll)
 
void AddGCPrologueCallback (GCCallback callback, GCType gc_type_filter=kGCTypeAll)
 
void RemoveGCPrologueCallback (GCCallbackWithData, void *data=nullptr)
 
void RemoveGCPrologueCallback (GCCallback callback)
 
void SetEmbedderHeapTracer (EmbedderHeapTracer *tracer)
 
EmbedderHeapTracerGetEmbedderHeapTracer ()
 
void SetAtomicsWaitCallback (AtomicsWaitCallback callback, void *data)
 
void AddGCEpilogueCallback (GCCallbackWithData callback, void *data=nullptr, GCType gc_type_filter=kGCTypeAll)
 
void AddGCEpilogueCallback (GCCallback callback, GCType gc_type_filter=kGCTypeAll)
 
void RemoveGCEpilogueCallback (GCCallbackWithData callback, void *data=nullptr)
 
void RemoveGCEpilogueCallback (GCCallback callback)
 
void SetGetExternallyAllocatedMemoryInBytesCallback (GetExternallyAllocatedMemoryInBytesCallback callback)
 
void TerminateExecution ()
 
bool IsExecutionTerminating ()
 
void CancelTerminateExecution ()
 
void RequestInterrupt (InterruptCallback callback, void *data)
 
void RequestGarbageCollectionForTesting (GarbageCollectionType type)
 
void SetEventLogger (LogEventCallback that)
 
void AddBeforeCallEnteredCallback (BeforeCallEnteredCallback callback)
 
void RemoveBeforeCallEnteredCallback (BeforeCallEnteredCallback callback)
 
void AddCallCompletedCallback (CallCompletedCallback callback)
 
void RemoveCallCompletedCallback (CallCompletedCallback callback)
 
void SetPromiseHook (PromiseHook hook)
 
void SetPromiseRejectCallback (PromiseRejectCallback callback)
 
void RunMicrotasks ()
 
void EnqueueMicrotask (Local< Function > microtask)
 
void EnqueueMicrotask (MicrotaskCallback callback, void *data=nullptr)
 
void SetMicrotasksPolicy (MicrotasksPolicy policy)
 
MicrotasksPolicy GetMicrotasksPolicy () const
 
void AddMicrotasksCompletedCallback (MicrotasksCompletedCallback callback)
 
void AddMicrotasksCompletedCallback (MicrotasksCompletedCallbackWithData callback, void *data=nullptr)
 
void RemoveMicrotasksCompletedCallback (MicrotasksCompletedCallback callback)
 
void RemoveMicrotasksCompletedCallback (MicrotasksCompletedCallbackWithData callback, void *data=nullptr)
 
void SetUseCounterCallback (UseCounterCallback callback)
 
void SetCounterFunction (CounterLookupCallback)
 
void SetCreateHistogramFunction (CreateHistogramCallback)
 
void SetAddHistogramSampleFunction (AddHistogramSampleCallback)
 
void SetAddCrashKeyCallback (AddCrashKeyCallback)
 
bool IdleNotificationDeadline (double deadline_in_seconds)
 
void LowMemoryNotification ()
 
int ContextDisposedNotification (bool dependant_context=true)
 
void IsolateInForegroundNotification ()
 
void IsolateInBackgroundNotification ()
 
void EnableMemorySavingsMode ()
 
void DisableMemorySavingsMode ()
 
void SetRAILMode (RAILMode rail_mode)
 
void IncreaseHeapLimitForDebugging ()
 
void RestoreOriginalHeapLimit ()
 
bool IsHeapLimitIncreasedForDebugging ()
 
void SetJitCodeEventHandler (JitCodeEventOptions options, JitCodeEventHandler event_handler)
 
void SetStackLimit (uintptr_t stack_limit)
 
void GetCodeRange (void **start, size_t *length_in_bytes)
 
UnwindState GetUnwindState ()
 
JSEntryStubs GetJSEntryStubs ()
 
size_t CopyCodePages (size_t capacity, MemoryRange *code_pages_out)
 
void SetFatalErrorHandler (FatalErrorCallback that)
 
void SetOOMErrorHandler (OOMErrorCallback that)
 
void AddNearHeapLimitCallback (NearHeapLimitCallback callback, void *data)
 
void RemoveNearHeapLimitCallback (NearHeapLimitCallback callback, size_t heap_limit)
 
void AutomaticallyRestoreInitialHeapLimit (double threshold_percent=0.5)
 
 V8_DEPRECATED ("Use Isolate::SetModifyCodeGenerationFromStringsCallback instead. " "See http://crbug.com/v8/10096.") void SetAllowCodeGenerationFromStringsCallback(AllowCodeGenerationFromStringsCallback callback)
 
void SetModifyCodeGenerationFromStringsCallback (ModifyCodeGenerationFromStringsCallback callback)
 
void SetAllowWasmCodeGenerationCallback (AllowWasmCodeGenerationCallback callback)
 
void SetWasmModuleCallback (ExtensionCallback callback)
 
void SetWasmInstanceCallback (ExtensionCallback callback)
 
void SetWasmStreamingCallback (WasmStreamingCallback callback)
 
void SetWasmThreadsEnabledCallback (WasmThreadsEnabledCallback callback)
 
void SetWasmLoadSourceMapCallback (WasmLoadSourceMapCallback callback)
 
bool IsDead ()
 
bool AddMessageListener (MessageCallback that, Local< Value > data=Local< Value >())
 
bool AddMessageListenerWithErrorLevel (MessageCallback that, int message_levels, Local< Value > data=Local< Value >())
 
void RemoveMessageListeners (MessageCallback that)
 
void SetFailedAccessCheckCallbackFunction (FailedAccessCheckCallback)
 
void SetCaptureStackTraceForUncaughtExceptions (bool capture, int frame_limit=10, StackTrace::StackTraceOptions options=StackTrace::kOverview)
 
void VisitExternalResources (ExternalResourceVisitor *visitor)
 
void VisitHandlesWithClassIds (PersistentHandleVisitor *visitor)
 
void VisitWeakHandles (PersistentHandleVisitor *visitor)
 
bool IsInUse ()
 
void SetAllowAtomicsWait (bool allow)
 
void DateTimeConfigurationChangeNotification (TimeZoneDetection time_zone_detection=TimeZoneDetection::kSkip)
 
void LocaleConfigurationChangeNotification ()
 
 Isolate ()=delete
 
 ~Isolate ()=delete
 
 Isolate (const Isolate &)=delete
 
Isolateoperator= (const Isolate &)=delete
 
void * operator new (size_t size)=delete
 
void * operator new[] (size_t size)=delete
 
void operator delete (void *, size_t)=delete
 
void operator delete[] (void *, size_t)=delete
 
template<class T >
MaybeLocal< T > GetDataFromSnapshotOnce (size_t index)
 

Static Public Member Functions

static IsolateAllocate ()
 
static void Initialize (Isolate *isolate, const CreateParams &params)
 
static IsolateNew (const CreateParams &params)
 
static IsolateGetCurrent ()
 
static V8_INLINE uint32_t GetNumberOfDataSlots ()
 

Static Public Attributes

static constexpr size_t kMinCodePagesBufferSize = 32
 

Friends

template<class K , class V , class Traits >
class PersistentValueMapBase
 

Detailed Description

Isolate represents an isolated instance of the V8 engine. V8 isolates have completely separate states. Objects from one isolate must not be used in other isolates. The embedder can create multiple isolates and use them in parallel in multiple threads. An isolate can be entered by at most one thread at any given time. The Locker/Unlocker API must be used to synchronize.

Definition at line 8124 of file v8.h.

Member Typedef Documentation

◆ AbortOnUncaughtExceptionCallback

typedef bool(* AbortOnUncaughtExceptionCallback) (Isolate *)

Custom callback used by embedders to help V8 determine if it should abort when it throws and no internal handler is predicted to catch the exception. If –abort-on-uncaught-exception is used on the command line, then V8 will abort if either:

  • no custom callback is set.
  • the custom callback set returns true. Otherwise, the custom callback will not be called and V8 will not abort.

Definition at line 8491 of file v8.h.

◆ AtomicsWaitCallback

typedef void(* AtomicsWaitCallback) (AtomicsWaitEvent event, Local< SharedArrayBuffer > array_buffer, size_t offset_in_bytes, int64_t value, double timeout_in_ms, AtomicsWaitWakeHandle *stop_handle, void *data)

Embedder callback for Atomics.wait() that can be added through |SetAtomicsWaitCallback|.

This will be called just before starting to wait with the |event| value |kStartWait| and after finishing waiting with one of the other values of |AtomicsWaitEvent| inside of an Atomics.wait() call.

|array_buffer| will refer to the underlying SharedArrayBuffer, |offset_in_bytes| to the location of the waited-on memory address inside the SharedArrayBuffer.

|value| and |timeout_in_ms| will be the values passed to the Atomics.wait() call. If no timeout was used, |timeout_in_ms| will be INFINITY.

In the |kStartWait| callback, |stop_handle| will be an object that is only valid until the corresponding finishing callback and that can be used to stop the wait process while it is happening.

This callback may schedule exceptions, unless |event| is equal to |kTerminatedExecution|.

Definition at line 8853 of file v8.h.

◆ GCCallback

typedef void(* GCCallback) (Isolate *isolate, GCType type, GCCallbackFlags flags)

Definition at line 8753 of file v8.h.

◆ GCCallbackWithData

typedef void(* GCCallbackWithData) (Isolate *isolate, GCType type, GCCallbackFlags flags, void *data)

Definition at line 8755 of file v8.h.

◆ GetExternallyAllocatedMemoryInBytesCallback

typedef size_t(* GetExternallyAllocatedMemoryInBytesCallback) ()

Definition at line 8890 of file v8.h.

◆ UseCounterCallback

typedef void(* UseCounterCallback) (Isolate *isolate, UseCounterFeature feature)

Definition at line 8427 of file v8.h.

Member Enumeration Documentation

◆ AtomicsWaitEvent

enum AtomicsWaitEvent
strong

Use for |AtomicsWaitCallback| to indicate the type of event it receives.

Enumerator
kStartWait 

Indicates that this call is happening before waiting.

kWokenUp 

Atomics.wait() finished because of an Atomics.wake() call.

kTimedOut 

Atomics.wait() finished because it timed out.

kTerminatedExecution 

Atomics.wait() was interrupted through |TerminateExecution()|.

kAPIStopped 

Atomics.wait() was stopped through |AtomicsWaitWakeHandle|.

kNotEqual 

Atomics.wait() did not wait, as the initial condition was not met.

Definition at line 8792 of file v8.h.

◆ GarbageCollectionType

Types of garbage collections that can be requested via RequestGarbageCollectionForTesting.

Enumerator
kFullGarbageCollection 
kMinorGarbageCollection 

Definition at line 8316 of file v8.h.

◆ MessageErrorLevel

Enumerator
kMessageLog 
kMessageDebug 
kMessageInfo 
kMessageError 
kMessageWarning 
kMessageAll 

Definition at line 8417 of file v8.h.

◆ TimeZoneDetection

enum TimeZoneDetection
strong

Time zone redetection indicator for DateTimeConfigurationChangeNotification.

kSkip indicates V8 that the notification should not trigger redetecting host time zone. kRedetect indicates V8 that host time zone should be redetected, and used to set the default time zone.

The host time zone detection may require file system access or similar operations unlikely to be available inside a sandbox. If v8 is run inside a sandbox, the host time zone has to be detected outside the sandbox before calling DateTimeConfigurationChangeNotification function.

Enumerator
kSkip 
kRedetect 

Definition at line 9404 of file v8.h.

◆ UseCounterFeature

Features reported via the SetUseCounterCallback callback. Do not change assigned numbers of existing items; add new features to the end of this list.

Enumerator
kUseAsm 
kBreakIterator 
kLegacyConst 
kMarkDequeOverflow 
kStoreBufferOverflow 
kSlotsBufferOverflow 
kObjectObserve 
kForcedGC 
kSloppyMode 
kStrictMode 
kStrongMode 
kRegExpPrototypeStickyGetter 
kRegExpPrototypeToString 
kRegExpPrototypeUnicodeGetter 
kIntlV8Parse 
kIntlPattern 
kIntlResolved 
kPromiseChain 
kPromiseAccept 
kPromiseDefer 
kHtmlCommentInExternalScript 
kHtmlComment 
kSloppyModeBlockScopedFunctionRedefinition 
kForInInitializer 
kArrayProtectorDirtied 
kArraySpeciesModified 
kArrayPrototypeConstructorModified 
kArrayInstanceProtoModified 
kArrayInstanceConstructorModified 
kLegacyFunctionDeclaration 
kRegExpPrototypeSourceGetter 
kRegExpPrototypeOldFlagGetter 
kDecimalWithLeadingZeroInStrictMode 
kLegacyDateParser 
kDefineGetterOrSetterWouldThrow 
kFunctionConstructorReturnedUndefined 
kAssigmentExpressionLHSIsCallInSloppy 
kAssigmentExpressionLHSIsCallInStrict 
kPromiseConstructorReturnedUndefined 
kConstructorNonUndefinedPrimitiveReturn 
kLabeledExpressionStatement 
kLineOrParagraphSeparatorAsLineTerminator 
kIndexAccessor 
kErrorCaptureStackTrace 
kErrorPrepareStackTrace 
kErrorStackTraceLimit 
kWebAssemblyInstantiation 
kDeoptimizerDisableSpeculation 
kArrayPrototypeSortJSArrayModifiedPrototype 
kFunctionTokenOffsetTooLongForToString 
kWasmSharedMemory 
kWasmThreadOpcodes 
kAtomicsNotify 
kAtomicsWake 
kCollator 
kNumberFormat 
kDateTimeFormat 
kPluralRules 
kRelativeTimeFormat 
kLocale 
kListFormat 
kSegmenter 
kStringLocaleCompare 
kStringToLocaleUpperCase 
kStringToLocaleLowerCase 
kNumberToLocaleString 
kDateToLocaleString 
kDateToLocaleDateString 
kDateToLocaleTimeString 
kAttemptOverrideReadOnlyOnPrototypeSloppy 
kAttemptOverrideReadOnlyOnPrototypeStrict 
kOptimizedFunctionWithOneShotBytecode 
kRegExpMatchIsTrueishOnNonJSRegExp 
kRegExpMatchIsFalseishOnJSRegExp 
kDateGetTimezoneOffset 
kStringNormalize 
kCallSiteAPIGetFunctionSloppyCall 
kCallSiteAPIGetThisSloppyCall 
kRegExpMatchAllWithNonGlobalRegExp 
kRegExpExecCalledOnSlowRegExp 
kRegExpReplaceCalledOnSlowRegExp 
kDisplayNames 
kSharedArrayBufferConstructed 
kUseCounterFeatureCount 

Definition at line 8326 of file v8.h.

Constructor & Destructor Documentation

◆ Isolate() [1/2]

Isolate ( )
delete

◆ ~Isolate()

~Isolate ( )
delete

◆ Isolate() [2/2]

Isolate ( const Isolate )
delete

Member Function Documentation

◆ AddBeforeCallEnteredCallback()

void AddBeforeCallEnteredCallback ( BeforeCallEnteredCallback  callback)

Adds a callback to notify the host application right before a script is about to run. If a script re-enters the runtime during executing, the BeforeCallEnteredCallback is invoked for each re-entrance. Executing scripts inside the callback will re-trigger the callback.

◆ AddCallCompletedCallback()

void AddCallCompletedCallback ( CallCompletedCallback  callback)

Adds a callback to notify the host application when a script finished running. If a script re-enters the runtime during executing, the CallCompletedCallback is only invoked when the outer-most script execution ends. Executing scripts inside the callback do not trigger further callbacks.

◆ AddGCEpilogueCallback() [1/2]

void AddGCEpilogueCallback ( GCCallbackWithData  callback,
void *  data = nullptr,
GCType  gc_type_filter = kGCTypeAll 
)

Enables the host application to receive a notification after a garbage collection. Allocations are allowed in the callback function, but the callback is not re-entrant: if the allocation inside it will trigger the garbage collection, the callback won't be called again. It is possible to specify the GCType filter for your callback. But it is not possible to register the same callback function two times with different GCType filters.

◆ AddGCEpilogueCallback() [2/2]

void AddGCEpilogueCallback ( GCCallback  callback,
GCType  gc_type_filter = kGCTypeAll 
)

◆ AddGCPrologueCallback() [1/2]

void AddGCPrologueCallback ( GCCallbackWithData  callback,
void *  data = nullptr,
GCType  gc_type_filter = kGCTypeAll 
)

Enables the host application to receive a notification before a garbage collection. Allocations are allowed in the callback function, but the callback is not re-entrant: if the allocation inside it will trigger the garbage collection, the callback won't be called again. It is possible to specify the GCType filter for your callback. But it is not possible to register the same callback function two times with different GCType filters.

◆ AddGCPrologueCallback() [2/2]

void AddGCPrologueCallback ( GCCallback  callback,
GCType  gc_type_filter = kGCTypeAll 
)

◆ AddMessageListener()

bool AddMessageListener ( MessageCallback  that,
Local< Value data = LocalValue >() 
)

Adds a message listener (errors only).

The same message listener can be added more than once and in that case it will be called more than once for each message.

If data is specified, it will be passed to the callback when it is called. Otherwise, the exception object will be passed to the callback instead.

◆ AddMessageListenerWithErrorLevel()

bool AddMessageListenerWithErrorLevel ( MessageCallback  that,
int  message_levels,
Local< Value data = LocalValue >() 
)

Adds a message listener.

The same message listener can be added more than once and in that case it will be called more than once for each message.

If data is specified, it will be passed to the callback when it is called. Otherwise, the exception object will be passed to the callback instead.

A listener can listen for particular error levels by providing a mask.

◆ AddMicrotasksCompletedCallback() [1/2]

void AddMicrotasksCompletedCallback ( MicrotasksCompletedCallback  callback)

Adds a callback to notify the host application after microtasks were run on the default MicrotaskQueue. The callback is triggered by explicit RunMicrotasks call or automatic microtasks execution (see SetMicrotaskPolicy).

Callback will trigger even if microtasks were attempted to run, but the microtasks queue was empty and no single microtask was actually executed.

Executing scripts inside the callback will not re-trigger microtasks and the callback.

◆ AddMicrotasksCompletedCallback() [2/2]

void AddMicrotasksCompletedCallback ( MicrotasksCompletedCallbackWithData  callback,
void *  data = nullptr 
)

◆ AddNearHeapLimitCallback()

void AddNearHeapLimitCallback ( NearHeapLimitCallback  callback,
void *  data 
)

Add a callback to invoke in case the heap size is close to the heap limit. If multiple callbacks are added, only the most recently added callback is invoked.

◆ AdjustAmountOfExternalAllocatedMemory()

int64_t AdjustAmountOfExternalAllocatedMemory ( int64_t  change_in_bytes)

Adjusts the amount of registered external memory. Used to give V8 an indication of the amount of externally allocated memory that is kept alive by JavaScript objects. V8 uses this to decide when to perform global garbage collections. Registering externally allocated memory will trigger global garbage collections more often than it would otherwise in an attempt to garbage collect the JavaScript objects that keep the externally allocated memory alive.

Parameters
change_in_bytesthe change in externally allocated memory that is kept alive by JavaScript objects.
Returns
the adjusted value.

Definition at line 11849 of file v8.h.

References Internals::kExternalAllocationSoftLimit, Internals::kExternalMemoryAtLastMarkCompactOffset, Internals::kExternalMemoryLimitOffset, and Internals::kExternalMemoryOffset.

◆ Allocate()

static Isolate* Allocate ( )
static

Allocates a new isolate but does not initialize it. Does not change the currently entered isolate.

Only Isolate::GetData() and Isolate::SetData(), which access the embedder-controlled parts of the isolate, are allowed to be called on the uninitialized isolate. To initialize the isolate, call Isolate::Initialize().

When an isolate is no longer used its resources should be freed by calling Dispose(). Using the delete operator is not allowed.

V8::Initialize() must have run prior to this.

◆ AutomaticallyRestoreInitialHeapLimit()

void AutomaticallyRestoreInitialHeapLimit ( double  threshold_percent = 0.5)

If the heap limit was changed by the NearHeapLimitCallback, then the initial heap limit will be restored once the heap size falls below the given threshold percentage of the initial heap limit. The threshold percentage is a number in (0.0, 1.0) range.

◆ CancelTerminateExecution()

void CancelTerminateExecution ( )

Resume execution capability in the given isolate, whose execution was previously forcefully terminated using TerminateExecution().

When execution is forcefully terminated using TerminateExecution(), the isolate can not resume execution until all JavaScript frames have propagated the uncatchable exception which is generated. This method allows the program embedding the engine to handle the termination event and resume execution capability, even if JavaScript frames remain on the stack.

This method can be used by any thread even if that thread has not acquired the V8 lock with a Locker object.

◆ ClearKeptObjects()

void ClearKeptObjects ( )

Clears the set of objects held strongly by the heap. This set of objects are originally built when a WeakRef is created or successfully dereferenced.

The embedder is expected to call this when a synchronous sequence of ECMAScript execution completes. It's the embedders responsiblity to make this call at a time which does not interrupt synchronous ECMAScript code execution.

◆ ContextDisposedNotification()

int ContextDisposedNotification ( bool  dependant_context = true)

Optional notification that a context has been disposed. V8 uses these notifications to guide the GC heuristic. Returns the number of context disposals - including this one - since the last time V8 had a chance to clean up.

The optional parameter |dependant_context| specifies whether the disposed context was depending on state from other contexts or not.

◆ CopyCodePages()

size_t CopyCodePages ( size_t  capacity,
MemoryRange code_pages_out 
)

Copies the code heap pages currently in use by V8 into |code_pages_out|. |code_pages_out| must have at least kMinCodePagesBufferSize capacity and must be empty.

Signal-safe, does not allocate, does not access the V8 heap. No code on the stack can rely on pages that might be missing.

Returns the number of pages available to be copied, which might be greater than |capacity|. In this case, only |capacity| pages will be copied into |code_pages_out|. The caller should provide a bigger buffer on the next call in order to get all available code pages, but this is not required.

◆ DateTimeConfigurationChangeNotification()

void DateTimeConfigurationChangeNotification ( TimeZoneDetection  time_zone_detection = TimeZoneDetection::kSkip)

Notification that the embedder has changed the time zone, daylight savings time or other date / time configuration parameters. V8 keeps a cache of various values used for date / time computation. This notification will reset those cached values for the current context so that date / time configuration changes would be reflected.

This API should not be called more than needed as it will negatively impact the performance of date operations.

◆ DisableMemorySavingsMode()

void DisableMemorySavingsMode ( )

Optional notification which will disable the memory savings mode.

◆ DiscardThreadSpecificMetadata()

void DiscardThreadSpecificMetadata ( )

Discards all V8 thread-specific data for the Isolate. Should be used if a thread is terminating and it has used an Isolate that will outlive the thread – all thread-specific data for an Isolate is discarded when an Isolate is disposed so this call is pointless if an Isolate is about to be Disposed.

◆ Dispose()

void Dispose ( )

Disposes the isolate. The isolate must not be entered by any thread to be disposable.

◆ DumpAndResetStats()

void DumpAndResetStats ( )

Dumps activated low-level V8 internal stats. This can be used instead of performing a full isolate disposal.

◆ EnableMemorySavingsMode()

void EnableMemorySavingsMode ( )

Optional notification which will enable the memory savings mode. V8 uses this notification to guide heuristics which may result in a smaller memory footprint at the cost of reduced runtime performance.

◆ EnqueueMicrotask() [1/2]

void EnqueueMicrotask ( Local< Function microtask)

Enqueues the callback to the default MicrotaskQueue

◆ EnqueueMicrotask() [2/2]

void EnqueueMicrotask ( MicrotaskCallback  callback,
void *  data = nullptr 
)

Enqueues the callback to the default MicrotaskQueue

◆ Enter()

void Enter ( )

Methods below this point require holding a lock (using Locker) in a multi-threaded environment. Sets this isolate as the entered one for the current thread. Saves the previously entered one (if any), so that it can be restored when exiting. Re-entering an isolate is allowed.

Referenced by Isolate::Scope::Scope().

◆ Exit()

void Exit ( )

Exits this isolate by restoring the previously entered one in the current thread. The isolate may still stay the same, if it was entered more than once.

Requires: this == Isolate::GetCurrent().

Referenced by Isolate::Scope::~Scope().

◆ GetArrayBufferAllocator()

ArrayBuffer::Allocator* GetArrayBufferAllocator ( )

Returns the ArrayBuffer::Allocator used in this isolate.

◆ GetCodeRange()

void GetCodeRange ( void **  start,
size_t *  length_in_bytes 
)

Returns a memory range that can potentially contain jitted code. Code for V8's 'builtins' will not be in this range if embedded builtins is enabled.

On Win64, embedders are advised to install function table callbacks for these ranges, as default SEH won't be able to unwind through jitted code. The first page of the code range is reserved for the embedder and is committed, writable, and executable, to be used to store unwind data, as documented in https://docs.microsoft.com/en-us/cpp/build/exception-handling-x64.

Might be empty on other platforms.

https://code.google.com/p/v8/issues/detail?id=3598

◆ GetCurrent()

static Isolate* GetCurrent ( )
static

Returns the entered isolate for the current thread or NULL in case there is no current isolate.

This method must not be invoked before V8::Initialize() was invoked.

◆ GetCurrentContext()

Local<Context> GetCurrentContext ( )

Returns the context of the currently running JavaScript, or the context on the top of the stack if no JavaScript is running.

◆ GetData()

void * GetData ( uint32_t  slot)

Retrieve embedder-specific data from the isolate. Returns NULL if SetData has never been called for the given |slot|.

Definition at line 11831 of file v8.h.

References Internals::GetEmbedderData().

◆ GetDataFromSnapshotOnce() [1/2]

V8_INLINE MaybeLocal<T> GetDataFromSnapshotOnce ( size_t  index)

Return data that was previously attached to the isolate snapshot via SnapshotCreator, and removes the reference to it. Repeated call with the same index returns an empty MaybeLocal.

◆ GetDataFromSnapshotOnce() [2/2]

MaybeLocal<T> GetDataFromSnapshotOnce ( size_t  index)

Definition at line 11843 of file v8.h.

References V8::Local.

◆ GetEmbedderHeapTracer()

EmbedderHeapTracer* GetEmbedderHeapTracer ( )

◆ GetEnteredContext()

Local<Context> GetEnteredContext ( )

Returns the last context entered through V8's C++ API.

◆ GetEnteredOrMicrotaskContext()

Local<Context> GetEnteredOrMicrotaskContext ( )

Returns either the last context entered through V8's C++ API, or the context of the currently running microtask while processing microtasks. If a context is entered while executing a microtask, that context is returned.

◆ GetHeapCodeAndMetadataStatistics()

bool GetHeapCodeAndMetadataStatistics ( HeapCodeStatistics object_statistics)

Get statistics about code and its metadata in the heap.

Parameters
object_statisticsThe HeapCodeStatistics object to fill in statistics of code, bytecode and their metadata.
Returns
true on success.

◆ GetHeapObjectStatisticsAtLastGC()

bool GetHeapObjectStatisticsAtLastGC ( HeapObjectStatistics object_statistics,
size_t  type_index 
)

Get statistics about objects in the heap.

Parameters
object_statisticsThe HeapObjectStatistics object to fill in statistics of objects of given type, which were live in the previous GC.
type_indexThe index of the type of object to fill details about, which ranges from 0 to NumberOfTrackedHeapObjectTypes() - 1.
Returns
true on success.

◆ GetHeapProfiler()

HeapProfiler* GetHeapProfiler ( )

Returns heap profiler for this isolate. Will return NULL until the isolate is initialized.

◆ GetHeapSpaceStatistics()

bool GetHeapSpaceStatistics ( HeapSpaceStatistics space_statistics,
size_t  index 
)

Get the memory usage of a space in the heap.

Parameters
space_statisticsThe HeapSpaceStatistics object to fill in statistics.
indexThe index of the space to get statistics from, which ranges from 0 to NumberOfHeapSpaces() - 1.
Returns
true on success.

◆ GetHeapStatistics()

void GetHeapStatistics ( HeapStatistics heap_statistics)

Get statistics about the heap memory usage.

◆ GetIncumbentContext()

Local<Context> GetIncumbentContext ( )

Returns the Context that corresponds to the Incumbent realm in HTML spec. https://html.spec.whatwg.org/multipage/webappapis.html#incumbent

◆ GetJSEntryStubs()

JSEntryStubs GetJSEntryStubs ( )

Returns the JSEntryStubs necessary for use with the Unwinder API.

◆ GetMicrotasksPolicy()

MicrotasksPolicy GetMicrotasksPolicy ( ) const

Returns the policy controlling how Microtasks are invoked.

◆ GetNumberOfDataSlots()

uint32_t GetNumberOfDataSlots ( )
static

Returns the maximum number of available embedder data slots. Valid slots are in the range of 0 - GetNumberOfDataSlots() - 1.

Definition at line 11837 of file v8.h.

References Internals::kNumIsolateDataSlots.

◆ GetStackSample()

void GetStackSample ( const RegisterState state,
void **  frames,
size_t  frames_limit,
SampleInfo sample_info 
)

Get a call stack sample from the isolate.

Parameters
stateExecution state.
framesCaller allocated buffer to store stack frames.
frames_limitMaximum number of frames to capture. The buffer must be large enough to hold the number of frames.
sample_infoThe sample info is filled up by the function provides number of actual captured stack frames and the current VM state.
Note
GetStackSample should only be called when the JS thread is paused or interrupted. Otherwise the behavior is undefined.

◆ GetUnwindState()

UnwindState GetUnwindState ( )

Returns the UnwindState necessary for use with the Unwinder API.

◆ IdleNotificationDeadline()

bool IdleNotificationDeadline ( double  deadline_in_seconds)

Optional notification that the embedder is idle. V8 uses the notification to perform garbage collection. This call can be used repeatedly if the embedder remains idle. Returns true if the embedder should stop calling IdleNotificationDeadline until real work has been done. This indicates that V8 has done as much cleanup as it will be able to do.

The deadline_in_seconds argument specifies the deadline V8 has to finish garbage collection work. deadline_in_seconds is compared with MonotonicallyIncreasingTime() and should be based on the same timebase as that function. There is no guarantee that the actual work will be done within the time limit.

◆ InContext()

bool InContext ( )

Returns true if this isolate has a current context.

◆ IncreaseHeapLimitForDebugging()

void IncreaseHeapLimitForDebugging ( )

Optional notification to tell V8 the current isolate is used for debugging and requires higher heap limit.

◆ Initialize()

static void Initialize ( Isolate isolate,
const CreateParams params 
)
static

Initialize an Isolate previously allocated by Isolate::Allocate().

◆ IsDead()

bool IsDead ( )

Check if V8 is dead and therefore unusable. This is the case after fatal errors such as out-of-memory situations.

◆ IsExecutionTerminating()

bool IsExecutionTerminating ( )

Is V8 terminating JavaScript execution.

Returns true if JavaScript execution is currently terminating because of a call to TerminateExecution. In that case there are still JavaScript frames on the stack and the termination exception is still active.

◆ IsHeapLimitIncreasedForDebugging()

bool IsHeapLimitIncreasedForDebugging ( )

Returns true if the heap limit was increased for debugging and the original heap limit was not restored yet.

◆ IsInUse()

bool IsInUse ( )

Check if this isolate is in use. True if at least one thread Enter'ed this isolate.

◆ IsolateInBackgroundNotification()

void IsolateInBackgroundNotification ( )

Optional notification that the isolate switched to the background. V8 uses these notifications to guide heuristics.

◆ IsolateInForegroundNotification()

void IsolateInForegroundNotification ( )

Optional notification that the isolate switched to the foreground. V8 uses these notifications to guide heuristics.

◆ LocaleConfigurationChangeNotification()

void LocaleConfigurationChangeNotification ( )

Notification that the embedder has changed the locale. V8 keeps a cache of various values used for locale computation. This notification will reset those cached values for the current context so that locale configuration changes would be reflected.

This API should not be called more than needed as it will negatively impact the performance of locale operations.

◆ LowMemoryNotification()

void LowMemoryNotification ( )

Optional notification that the system is running low on memory. V8 uses these notifications to attempt to free memory.

◆ MeasureMemory() [1/2]

bool MeasureMemory ( std::unique_ptr< MeasureMemoryDelegate delegate,
MeasureMemoryExecution  execution = MeasureMemoryExecution::kDefault 
)

This API is experimental and may change significantly.

Enqueues a memory measurement request and invokes the delegate with the results.

Parameters
delegatethe delegate that defines which contexts to measure and reports the results.
executionpromptness executing the memory measurement. The kEager value is expected to be used only in tests.

◆ MeasureMemory() [2/2]

MaybeLocal<Promise> MeasureMemory ( Local< Context context,
MeasureMemoryMode  mode 
)

◆ MemoryPressureNotification()

void MemoryPressureNotification ( MemoryPressureLevel  level)

Optional notification that the system is running low on memory. V8 uses these notifications to guide heuristics. It is allowed to call this function from another thread while the isolate is executing long running JavaScript code.

◆ New()

static Isolate* New ( const CreateParams params)
static

Creates a new isolate. Does not change the currently entered isolate.

When an isolate is no longer used its resources should be freed by calling Dispose(). Using the delete operator is not allowed.

V8::Initialize() must have run prior to this.

◆ NumberOfHeapSpaces()

size_t NumberOfHeapSpaces ( )

Returns the number of spaces in the heap.

◆ NumberOfPhantomHandleResetsSinceLastCall()

size_t NumberOfPhantomHandleResetsSinceLastCall ( )

Returns the number of phantom handles without callbacks that were reset by the garbage collector since the last call to this function.

◆ NumberOfTrackedHeapObjectTypes()

size_t NumberOfTrackedHeapObjectTypes ( )

Returns the number of types of objects tracked in the heap at GC.

◆ operator delete()

void operator delete ( void *  ,
size_t   
)
delete

◆ operator delete[]()

void operator delete[] ( void *  ,
size_t   
)
delete

◆ operator new()

void* operator new ( size_t  size)
delete

◆ operator new[]()

void* operator new[] ( size_t  size)
delete

◆ operator=()

Isolate& operator= ( const Isolate )
delete

◆ RemoveBeforeCallEnteredCallback()

void RemoveBeforeCallEnteredCallback ( BeforeCallEnteredCallback  callback)

Removes callback that was installed by AddBeforeCallEnteredCallback.

◆ RemoveCallCompletedCallback()

void RemoveCallCompletedCallback ( CallCompletedCallback  callback)

Removes callback that was installed by AddCallCompletedCallback.

◆ RemoveGCEpilogueCallback() [1/2]

void RemoveGCEpilogueCallback ( GCCallbackWithData  callback,
void *  data = nullptr 
)

This function removes callback which was installed by AddGCEpilogueCallback function.

◆ RemoveGCEpilogueCallback() [2/2]

void RemoveGCEpilogueCallback ( GCCallback  callback)

◆ RemoveGCPrologueCallback() [1/2]

void RemoveGCPrologueCallback ( GCCallbackWithData  ,
void *  data = nullptr 
)

This function removes callback which was installed by AddGCPrologueCallback function.

◆ RemoveGCPrologueCallback() [2/2]

void RemoveGCPrologueCallback ( GCCallback  callback)

◆ RemoveMessageListeners()

void RemoveMessageListeners ( MessageCallback  that)

Remove all message listeners from the specified callback function.

◆ RemoveMicrotasksCompletedCallback() [1/2]

void RemoveMicrotasksCompletedCallback ( MicrotasksCompletedCallback  callback)

Removes callback that was installed by AddMicrotasksCompletedCallback.

◆ RemoveMicrotasksCompletedCallback() [2/2]

void RemoveMicrotasksCompletedCallback ( MicrotasksCompletedCallbackWithData  callback,
void *  data = nullptr 
)

◆ RemoveNearHeapLimitCallback()

void RemoveNearHeapLimitCallback ( NearHeapLimitCallback  callback,
size_t  heap_limit 
)

Remove the given callback and restore the heap limit to the given limit. If the given limit is zero, then it is ignored. If the current heap size is greater than the given limit, then the heap limit is restored to the minimal limit that is possible for the current heap size.

◆ RequestGarbageCollectionForTesting()

void RequestGarbageCollectionForTesting ( GarbageCollectionType  type)

Request garbage collection in this Isolate. It is only valid to call this function if –expose_gc was specified.

This should only be used for testing purposes and not to enforce a garbage collection schedule. It has strong negative impact on the garbage collection performance. Use IdleNotificationDeadline() or LowMemoryNotification() instead to influence the garbage collection schedule.

◆ RequestInterrupt()

void RequestInterrupt ( InterruptCallback  callback,
void *  data 
)

Request V8 to interrupt long running JavaScript code and invoke the given |callback| passing the given |data| to it. After |callback| returns control will be returned to the JavaScript code. There may be a number of interrupt requests in flight. Can be called from another thread without acquiring a |Locker|. Registered |callback| must not reenter interrupted Isolate.

◆ RestoreOriginalHeapLimit()

void RestoreOriginalHeapLimit ( )

Restores the original heap limit after IncreaseHeapLimitForDebugging().

◆ RunMicrotasks()

void RunMicrotasks ( )

Runs the default MicrotaskQueue until it gets empty. Any exceptions thrown by microtask callbacks are swallowed.

◆ SetAbortOnUncaughtExceptionCallback()

void SetAbortOnUncaughtExceptionCallback ( AbortOnUncaughtExceptionCallback  callback)

◆ SetAddCrashKeyCallback()

void SetAddCrashKeyCallback ( AddCrashKeyCallback  )

Enables the host application to provide a mechanism for recording a predefined set of data as crash keys to be used in postmortem debugging in case of a crash.

◆ SetAddHistogramSampleFunction()

void SetAddHistogramSampleFunction ( AddHistogramSampleCallback  )

◆ SetAllowAtomicsWait()

void SetAllowAtomicsWait ( bool  allow)

Set whether calling Atomics.wait (a function that may block) is allowed in this isolate. This can also be configured via CreateParams::allow_atomics_wait.

◆ SetAllowWasmCodeGenerationCallback()

void SetAllowWasmCodeGenerationCallback ( AllowWasmCodeGenerationCallback  callback)

Set the callback to invoke to check if wasm code generation should be allowed.

◆ SetAtomicsWaitCallback()

void SetAtomicsWaitCallback ( AtomicsWaitCallback  callback,
void *  data 
)

Set a new |AtomicsWaitCallback|. This overrides an earlier |AtomicsWaitCallback|, if there was any. If |callback| is nullptr, this unsets the callback. |data| will be passed to the callback as its last parameter.

◆ SetCaptureStackTraceForUncaughtExceptions()

void SetCaptureStackTraceForUncaughtExceptions ( bool  capture,
int  frame_limit = 10,
StackTrace::StackTraceOptions  options = StackTrace::kOverview 
)

Tells V8 to capture current stack trace when uncaught exception occurs and report it to the message listeners. The option is off by default.

◆ SetCounterFunction()

void SetCounterFunction ( CounterLookupCallback  )

Enables the host application to provide a mechanism for recording statistics counters.

◆ SetCreateHistogramFunction()

void SetCreateHistogramFunction ( CreateHistogramCallback  )

Enables the host application to provide a mechanism for recording histograms. The CreateHistogram function returns a histogram which will later be passed to the AddHistogramSample function.

◆ SetData()

void SetData ( uint32_t  slot,
void *  data 
)

Associate embedder-specific data with the isolate. |slot| has to be between 0 and GetNumberOfDataSlots() - 1.

Definition at line 11825 of file v8.h.

References Internals::SetEmbedderData().

◆ SetEmbedderHeapTracer()

void SetEmbedderHeapTracer ( EmbedderHeapTracer tracer)

Sets the embedder heap tracer for the isolate.

◆ SetEventLogger()

void SetEventLogger ( LogEventCallback  that)

Set the callback to invoke for logging event.

◆ SetFailedAccessCheckCallbackFunction()

void SetFailedAccessCheckCallbackFunction ( FailedAccessCheckCallback  )

Callback function for reporting failed access checks.

◆ SetFatalErrorHandler()

void SetFatalErrorHandler ( FatalErrorCallback  that)

Set the callback to invoke in case of fatal errors.

◆ SetGetExternallyAllocatedMemoryInBytesCallback()

void SetGetExternallyAllocatedMemoryInBytesCallback ( GetExternallyAllocatedMemoryInBytesCallback  callback)

Set the callback that tells V8 how much memory is currently allocated externally of the V8 heap. Ideally this memory is somehow connected to V8 objects and may get freed-up when the corresponding V8 objects get collected by a V8 garbage collection.

◆ SetHostCleanupFinalizationGroupCallback()

void SetHostCleanupFinalizationGroupCallback ( HostCleanupFinalizationGroupCallback  callback)

This specifies the callback to be called when finalization groups are ready to be cleaned up and require FinalizationGroup::Cleanup() to be called in a future task.

◆ SetHostImportModuleDynamicallyCallback()

void SetHostImportModuleDynamicallyCallback ( HostImportModuleDynamicallyCallback  callback)

This specifies the callback called by the upcoming dynamic import() language feature to load modules.

◆ SetHostInitializeImportMetaObjectCallback()

void SetHostInitializeImportMetaObjectCallback ( HostInitializeImportMetaObjectCallback  callback)

This specifies the callback called by the upcoming importa.meta language feature to retrieve host-defined meta data for a module.

◆ SetIdle()

void SetIdle ( bool  is_idle)

Tells the VM whether the embedder is idle or not.

◆ SetJitCodeEventHandler()

void SetJitCodeEventHandler ( JitCodeEventOptions  options,
JitCodeEventHandler  event_handler 
)

Allows the host application to provide the address of a function that is notified each time code is added, moved or removed.

Parameters
optionsoptions for the JIT code event handler.
event_handlerthe JIT code event handler, which will be invoked each time code is added, moved or removed.
Note
event_handler won't get notified of existent code.
since code removal notifications are not currently issued, the event_handler may get notifications of code that overlaps earlier code notifications. This happens when code areas are reused, and the earlier overlapping code areas should therefore be discarded.
the events passed to event_handler and the strings they point to are not guaranteed to live past each call. The event_handler must copy strings and other parameters it needs to keep around.
the set of events declared in JitCodeEvent::EventType is expected to grow over time, and the JitCodeEvent structure is expected to accrue new members. The event_handler function must ignore event codes it does not recognize to maintain future compatibility.
Use Isolate::CreateParams to get events for code executed during Isolate setup.

◆ SetMicrotasksPolicy()

void SetMicrotasksPolicy ( MicrotasksPolicy  policy)

Controls how Microtasks are invoked. See MicrotasksPolicy for details.

◆ SetModifyCodeGenerationFromStringsCallback()

void SetModifyCodeGenerationFromStringsCallback ( ModifyCodeGenerationFromStringsCallback  callback)

◆ SetOOMErrorHandler()

void SetOOMErrorHandler ( OOMErrorCallback  that)

Set the callback to invoke in case of OOM errors.

◆ SetPrepareStackTraceCallback()

void SetPrepareStackTraceCallback ( PrepareStackTraceCallback  callback)

This specifies the callback called when the stack property of Error is accessed.

◆ SetPromiseHook()

void SetPromiseHook ( PromiseHook  hook)

Set the PromiseHook callback for various promise lifecycle events.

◆ SetPromiseRejectCallback()

void SetPromiseRejectCallback ( PromiseRejectCallback  callback)

Set callback to notify about promise reject with no handler, or revocation of such a previous notification once the handler is added.

◆ SetRAILMode()

void SetRAILMode ( RAILMode  rail_mode)

Optional notification to tell V8 the current performance requirements of the embedder based on RAIL. V8 uses these notifications to guide heuristics. This is an unfinished experimental feature. Semantics and implementation may change frequently.

◆ SetStackLimit()

void SetStackLimit ( uintptr_t  stack_limit)

Modifies the stack limit for this Isolate.

Parameters
stack_limitAn address beyond which the Vm's stack may not grow.
Note
If you are using threads then you should hold the V8::Locker lock while setting the stack limit and you must set a non-default stack limit separately for each thread.

◆ SetUseCounterCallback()

void SetUseCounterCallback ( UseCounterCallback  callback)

Sets a callback for counting the number of times a feature of V8 is used.

◆ SetWasmInstanceCallback()

void SetWasmInstanceCallback ( ExtensionCallback  callback)

◆ SetWasmLoadSourceMapCallback()

void SetWasmLoadSourceMapCallback ( WasmLoadSourceMapCallback  callback)

◆ SetWasmModuleCallback()

void SetWasmModuleCallback ( ExtensionCallback  callback)

Embedder over{ride|load} injection points for wasm APIs. The expectation is that the embedder sets them at most once.

◆ SetWasmStreamingCallback()

void SetWasmStreamingCallback ( WasmStreamingCallback  callback)

◆ SetWasmThreadsEnabledCallback()

void SetWasmThreadsEnabledCallback ( WasmThreadsEnabledCallback  callback)

◆ TerminateExecution()

void TerminateExecution ( )

Forcefully terminate the current thread of JavaScript execution in the given isolate.

This method can be used by any thread even if that thread has not acquired the V8 lock with a Locker object.

◆ ThrowException()

Local<Value> ThrowException ( Local< Value exception)

Schedules an exception to be thrown when returning to JavaScript. When an exception has been scheduled it is illegal to invoke any JavaScript operation; the caller must return immediately and only after the exception has been handled does it become legal to invoke JavaScript operations.

◆ V8_DEPRECATED()

V8_DEPRECATED ( "Use Isolate::SetModifyCodeGenerationFromStringsCallback instead. " "See http://crbug.com/v8/10096."  )

Set the callback to invoke to check if code generation from strings should be allowed.

◆ VisitExternalResources()

void VisitExternalResources ( ExternalResourceVisitor visitor)

Iterates through all external resources referenced from current isolate heap. GC is not invoked prior to iterating, therefore there is no guarantee that visited objects are still alive.

◆ VisitHandlesWithClassIds()

void VisitHandlesWithClassIds ( PersistentHandleVisitor visitor)

Iterates through all the persistent handles in the current isolate's heap that have class_ids.

◆ VisitWeakHandles()

void VisitWeakHandles ( PersistentHandleVisitor visitor)

Iterates through all the persistent handles in the current isolate's heap that have class_ids and are weak to be marked as inactive if there is no pending activity for the handle.

Friends And Related Function Documentation

◆ PersistentValueMapBase

friend class PersistentValueMapBase
friend

Definition at line 9443 of file v8.h.

Field Documentation

◆ kMinCodePagesBufferSize

constexpr size_t kMinCodePagesBufferSize = 32
static

Definition at line 9229 of file v8.h.


The documentation for this class was generated from the following file: