![]() |
v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
|
#include <v8-isolate.h>
Classes | |
class | AllowJavascriptExecutionScope |
struct | CreateParams |
class | DisallowJavascriptExecutionScope |
class | Scope |
class | SuppressMicrotaskExecutionScope |
Static Public Member Functions | |
static Isolate * | Allocate () |
static Isolate * | Allocate (const IsolateGroup &group) |
static void | Initialize (Isolate *isolate, const CreateParams ¶ms) |
static Isolate * | New (const CreateParams ¶ms) |
static Isolate * | New (const IsolateGroup &group, const CreateParams ¶ms) |
static Isolate * | GetCurrent () |
static Isolate * | TryGetCurrent () |
static V8_INLINE uint32_t | GetNumberOfDataSlots () |
Static Public Attributes | |
static constexpr size_t | kMinCodePagesBufferSize = 32 |
Private Member Functions | |
internal::ValueHelper::InternalRepresentationType | GetDataFromSnapshotOnce (size_t index) |
int64_t | AdjustAmountOfExternalAllocatedMemoryImpl (int64_t change_in_bytes) |
void | HandleExternalMemoryInterrupt () |
Friends | |
template<class K , class V , class Traits > | |
class | PersistentValueMapBase |
class | ExternalMemoryAccounter |
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 274 of file v8-isolate.h.
using v8::Isolate::AbortOnUncaughtExceptionCallback = bool (*)(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:
Definition at line 756 of file v8-isolate.h.
using v8::Isolate::GCCallback |
Definition at line 1092 of file v8-isolate.h.
Definition at line 1094 of file v8-isolate.h.
using v8::Isolate::GetExternallyAllocatedMemoryInBytesCallback = size_t (*)() |
Definition at line 1190 of file v8-isolate.h.
using v8::Isolate::ReleaseCppHeapCallback = void (*)(std::unique_ptr<CppHeap>) |
Definition at line 1175 of file v8-isolate.h.
Definition at line 669 of file v8-isolate.h.
Types of garbage collections that can be requested via RequestGarbageCollectionForTesting.
Enumerator | |
---|---|
kFullGarbageCollection | |
kMinorGarbageCollection |
Definition at line 455 of file v8-isolate.h.
Enumerator | |
---|---|
kMessageLog | |
kMessageDebug | |
kMessageInfo | |
kMessageError | |
kMessageWarning | |
kMessageAll |
Definition at line 644 of file v8-isolate.h.
|
strong |
Enumerator | |
---|---|
kBestEffort | |
kUserVisible | |
kUserBlocking |
Definition at line 655 of file v8-isolate.h.
|
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 1745 of file v8-isolate.h.
Features reported via the SetUseCounterCallback callback. Do not change assigned numbers of existing items; add new features to the end of this list. Dead features can be marked V8_DEPRECATE_SOON
, then V8_DEPRECATED
, and then finally be renamed to kOBSOLETE_...
to stop embedders from using them.
Definition at line 468 of file v8-isolate.h.
|
delete |
|
delete |
|
delete |
void v8::Isolate::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.
Definition at line 10449 of file api.cc.
void v8::Isolate::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.
Definition at line 10461 of file api.cc.
void v8::Isolate::AddGCEpilogueCallback | ( | GCCallback | callback, |
GCType | gc_type_filter = kGCTypeAll ) |
Enables the host application to receive a notification after a garbage collection.
Enables the host application to receive a notification before a garbage collection.
callback | The callback to be invoked. The callback is allowed to allocate but invocation is not re-entrant: a callback triggering garbage collection will not be called again. JS execution is prohibited from these callbacks. A single callback may only be registered once. |
gc_type_filter | A filter in case it should be applied. |
Definition at line 9856 of file api.cc.
void v8::Isolate::AddGCEpilogueCallback | ( | GCCallbackWithData | callback, |
void * | data = nullptr, | ||
GCType | gc_type_filter = kGCTypeAll ) |
Enables the host application to receive a notification after a garbage collection.
Enables the host application to receive a notification before a garbage collection.
callback | The callback to be invoked. The callback is allowed to allocate but invocation is not re-entrant: a callback triggering garbage collection will not be called again. JS execution is prohibited from these callbacks. A single callback may only be registered once. |
gc_type_filter | A filter in case it should be applied. |
data | Additional data that should be passed to the callback. |
Definition at line 9829 of file api.cc.
void v8::Isolate::AddGCPrologueCallback | ( | GCCallback | callback, |
GCType | gc_type_filter = kGCTypeAll ) |
Enables the host application to receive a notification before a garbage collection.
callback | The callback to be invoked. The callback is allowed to allocate but invocation is not re-entrant: a callback triggering garbage collection will not be called again. JS execution is prohibited from these callbacks. A single callback may only be registered once. |
gc_type_filter | A filter in case it should be applied. |
Definition at line 9846 of file api.cc.
void v8::Isolate::AddGCPrologueCallback | ( | GCCallbackWithData | callback, |
void * | data = nullptr, | ||
GCType | gc_type_filter = kGCTypeAll ) |
Enables the host application to receive a notification before a garbage collection.
callback | The callback to be invoked. The callback is allowed to allocate but invocation is not re-entrant: a callback triggering garbage collection will not be called again. JS execution is prohibited from these callbacks. A single callback may only be registered once. |
gc_type_filter | A filter in case it should be applied. |
data | Additional data that should be passed to the callback. |
Definition at line 9817 of file api.cc.
bool v8::Isolate::AddMessageListener | ( | MessageCallback | that, |
Local< Value > | data = Local<Value>() ) |
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.
Definition at line 10830 of file api.cc.
bool v8::Isolate::AddMessageListenerWithErrorLevel | ( | MessageCallback | that, |
int | message_levels, | ||
Local< Value > | data = Local<Value>() ) |
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.
Definition at line 10834 of file api.cc.
void v8::Isolate::AddMicrotasksCompletedCallback | ( | MicrotasksCompletedCallbackWithData | callback, |
void * | data = nullptr ) |
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.
void v8::Isolate::AddNearHeapLimitCallback | ( | v8::NearHeapLimitCallback | callback, |
void * | data ) |
int64_t v8::Isolate::AdjustAmountOfExternalAllocatedMemory | ( | int64_t | change_in_bytes | ) |
|
private |
|
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, as well as Isolate::GetGroup(), are allowed to be called on the uninitialized isolate. To initialize the isolate, call Isolate::Initialize()
or initialize a SnapshotCreator
.
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.
Definition at line 9964 of file api.cc.
|
static |
void v8::Isolate::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.
Definition at line 10818 of file api.cc.
void v8::Isolate::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.
Definition at line 9898 of file api.cc.
void v8::Isolate::ClearCachesForTesting | ( | ) |
void v8::Isolate::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.
This is invoked automatically after microtasks are run. See MicrotasksPolicy for when microtasks are run.
This needs to be manually invoked only if the embedder is manually running microtasks via a custom MicrotaskQueue class's PerformCheckpoint. In that case, it is the embedder's responsibility to make this call at a time which does not interrupt synchronous ECMAScript code execution.
Definition at line 9751 of file api.cc.
int v8::Isolate::ContextDisposedNotification | ( | bool | dependant_context = true | ) |
Optional notification that a context has been disposed. V8 uses these notifications to guide the GC heuristic and cancel FinalizationRegistry cleanup tasks. Returns the number of context disposals - including this one
The optional parameter |dependant_context| specifies whether the disposed context was depending on state from other contexts or not.
Definition at line 10582 of file api.cc.
void v8::Isolate::ContextDisposedNotification | ( | ContextDependants | dependants | ) |
size_t v8::Isolate::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.
Definition at line 10722 of file api.cc.
void v8::Isolate::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.
Definition at line 10900 of file api.cc.
void v8::Isolate::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.
Definition at line 10114 of file api.cc.
void v8::Isolate::Dispose | ( | ) |
void v8::Isolate::DumpAndResetStats | ( | ) |
Enqueues the callback to the default MicrotaskQueue
Definition at line 10496 of file api.cc.
void v8::Isolate::EnqueueMicrotask | ( | MicrotaskCallback | callback, |
void * | data = nullptr ) |
Enqueues the callback to the default MicrotaskQueue
void v8::Isolate::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.
Definition at line 10119 of file api.cc.
void v8::Isolate::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().
Definition at line 10124 of file api.cc.
void v8::Isolate::Freeze | ( | bool | is_frozen | ) |
Optional notification to tell V8 whether the embedder is currently frozen. V8 uses these notifications to guide heuristics. This is an unfinished experimental feature. Semantics and implementation may change frequently.
Definition at line 10658 of file api.cc.
ArrayBuffer::Allocator * v8::Isolate::GetArrayBufferAllocator | ( | ) |
Returns the ArrayBuffer::Allocator used in this isolate.
Definition at line 9741 of file api.cc.
void v8::Isolate::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
Definition at line 10688 of file api.cc.
Returns the value that was set or restored by SetContinuationPreservedEmbedderData(), if any.
Definition at line 10246 of file api.cc.
CppHeap * v8::Isolate::GetCppHeap | ( | ) | const |
|
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.
Definition at line 9949 of file api.cc.
v8::Local< v8::Context > v8::Isolate::GetCurrentContext | ( | ) |
v8::MaybeLocal< v8::Data > v8::Isolate::GetCurrentHostDefinedOptions | ( | ) |
void * v8::Isolate::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 1809 of file v8-isolate.h.
V8_INLINE MaybeLocal< T > v8::Isolate::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.
|
private |
MaybeLocal< T > v8::Isolate::GetDataFromSnapshotOnce | ( | size_t | index | ) |
Definition at line 1820 of file v8-isolate.h.
std::string v8::Isolate::GetDefaultLocale | ( | ) |
void v8::Isolate::GetEmbeddedCodeRange | ( | const void ** | start, |
size_t * | length_in_bytes ) |
v8::Local< v8::Context > v8::Isolate::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.
Definition at line 9765 of file api.cc.
IsolateGroup v8::Isolate::GetGroup | ( | ) | const |
uint64_t v8::Isolate::GetHashSeed | ( | ) |
bool v8::Isolate::GetHeapCodeAndMetadataStatistics | ( | HeapCodeStatistics * | object_statistics | ) |
Get statistics about code and its metadata in the heap.
object_statistics | The HeapCodeStatistics object to fill in statistics of code, bytecode and their metadata. |
Definition at line 10392 of file api.cc.
bool v8::Isolate::GetHeapObjectStatisticsAtLastGC | ( | HeapObjectStatistics * | object_statistics, |
size_t | type_index ) |
Get statistics about objects in the heap.
object_statistics | The HeapObjectStatistics object to fill in statistics of objects of given type, which were live in the previous GC. |
type_index | The index of the type of object to fill details about, which ranges from 0 to NumberOfTrackedHeapObjectTypes() - 1. |
Definition at line 10365 of file api.cc.
HeapProfiler * v8::Isolate::GetHeapProfiler | ( | ) |
bool v8::Isolate::GetHeapSpaceStatistics | ( | HeapSpaceStatistics * | space_statistics, |
size_t | index ) |
Get the memory usage of a space in the heap.
space_statistics | The HeapSpaceStatistics object to fill in statistics. |
index | The index of the space to get statistics from, which ranges from 0 to NumberOfHeapSpaces() - 1. |
Definition at line 10327 of file api.cc.
void v8::Isolate::GetHeapStatistics | ( | HeapStatistics * | heap_statistics | ) |
v8::Local< v8::Context > v8::Isolate::GetIncumbentContext | ( | ) |
Returns the Context that corresponds to the Incumbent realm in HTML spec. https://html.spec.whatwg.org/multipage/webappapis.html#incumbent
Definition at line 9773 of file api.cc.
JSEntryStubs v8::Isolate::GetJSEntryStubs | ( | ) |
Returns the JSEntryStubs necessary for use with the Unwinder API.
Definition at line 10703 of file api.cc.
MicrotasksPolicy v8::Isolate::GetMicrotasksPolicy | ( | ) | const |
|
static |
Returns the maximum number of available embedder data slots. Valid slots are in the range of 0 - GetNumberOfDataSlots() - 1.
Definition at line 1814 of file v8-isolate.h.
void v8::Isolate::GetStackSample | ( | const RegisterState & | state, |
void ** | frames, | ||
size_t | frames_limit, | ||
SampleInfo * | sample_info ) |
Get a call stack sample from the isolate.
state | Execution state. |
frames | Caller allocated buffer to store stack frames. |
frames_limit | Maximum number of frames to capture. The buffer must be large enough to hold the number of frames. |
sample_info | The sample info is filled up by the function provides number of actual captured stack frames and the current VM state. |
int v8::Isolate::GetStackTraceLimit | ( | ) |
|
private |
bool v8::Isolate::HasPendingBackgroundTasks | ( | ) |
bool v8::Isolate::HasPendingException | ( | ) |
Returns true if an exception was thrown but not processed yet by an exception handler on JavaScript side or by v8::TryCatch handler.
This is an experimental feature and may still change significantly.
Definition at line 9807 of file api.cc.
bool v8::Isolate::InContext | ( | ) |
void v8::Isolate::IncreaseHeapLimitForDebugging | ( | ) |
|
static |
Initialize an Isolate previously allocated by Isolate::Allocate().
Definition at line 9985 of file api.cc.
bool v8::Isolate::IsCurrent | ( | ) | const |
bool v8::Isolate::IsDead | ( | ) |
bool v8::Isolate::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.
Definition at line 9893 of file api.cc.
bool v8::Isolate::IsHeapLimitIncreasedForDebugging | ( | ) |
bool v8::Isolate::IsInUse | ( | ) |
void v8::Isolate::IsolateInBackgroundNotification | ( | ) |
void v8::Isolate::IsolateInForegroundNotification | ( | ) |
void v8::Isolate::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.
Definition at line 10917 of file api.cc.
void v8::Isolate::LowMemoryNotification | ( | ) |
bool v8::Isolate::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.
delegate | the delegate that defines which contexts to measure and reports the results. |
execution | promptness executing the memory measurement. The kEager value is expected to be used only in tests. |
Definition at line 10411 of file api.cc.
void v8::Isolate::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.
Definition at line 10627 of file api.cc.
|
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.
Definition at line 10089 of file api.cc.
|
static |
size_t v8::Isolate::NumberOfHeapSpaces | ( | ) |
size_t v8::Isolate::NumberOfTrackedHeapObjectTypes | ( | ) |
|
delete |
|
delete |
|
delete |
|
delete |
void v8::Isolate::PerformMicrotaskCheckpoint | ( | ) |
Runs the default MicrotaskQueue until it gets empty and perform other microtask checkpoint steps, such as calling ClearKeptObjects. Asserts that the MicrotasksPolicy is not kScoped. Any exceptions thrown by microtask callbacks are swallowed.
Definition at line 10490 of file api.cc.
void v8::Isolate::RemoveBeforeCallEnteredCallback | ( | BeforeCallEnteredCallback | callback | ) |
void v8::Isolate::RemoveCallCompletedCallback | ( | CallCompletedCallback | callback | ) |
void v8::Isolate::RemoveGCEpilogueCallback | ( | GCCallback | callback | ) |
void v8::Isolate::RemoveGCEpilogueCallback | ( | GCCallbackWithData | callback, |
void * | data = nullptr ) |
void v8::Isolate::RemoveGCPrologueCallback | ( | GCCallback | callback | ) |
void v8::Isolate::RemoveGCPrologueCallback | ( | GCCallbackWithData | callback, |
void * | data = nullptr ) |
void v8::Isolate::RemoveMessageListeners | ( | MessageCallback | that | ) |
void v8::Isolate::RemoveMicrotasksCompletedCallback | ( | MicrotasksCompletedCallbackWithData | callback, |
void * | data = nullptr ) |
void v8::Isolate::RemoveNearHeapLimitCallback | ( | v8::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.
Definition at line 10812 of file api.cc.
void v8::Isolate::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 MemoryPressureNotification() instead to influence the garbage collection schedule.
Definition at line 9918 of file api.cc.
void v8::Isolate::RequestGarbageCollectionForTesting | ( | GarbageCollectionType | type, |
StackState | stack_state ) |
Request garbage collection with a specific embedderstack state 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 MemoryPressureNotification() instead to influence the garbage collection schedule.
Definition at line 9938 of file api.cc.
void v8::Isolate::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.
Definition at line 9904 of file api.cc.
void v8::Isolate::RestoreOriginalHeapLimit | ( | ) |
Restores the original heap limit after IncreaseHeapLimitForDebugging().
Definition at line 10667 of file api.cc.
void v8::Isolate::SetAbortOnUncaughtExceptionCallback | ( | AbortOnUncaughtExceptionCallback | callback | ) |
void v8::Isolate::SetAddCrashKeyCallback | ( | AddCrashKeyCallback | callback | ) |
void v8::Isolate::SetAddHistogramSampleFunction | ( | AddHistogramSampleCallback | callback | ) |
void v8::Isolate::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.
Definition at line 10895 of file api.cc.
void v8::Isolate::SetAllowWasmCodeGenerationCallback | ( | AllowWasmCodeGenerationCallback | callback | ) |
Set the callback to invoke to check if wasm code generation should be allowed.
void v8::Isolate::SetBatterySaverMode | ( | bool | battery_saver_mode_enabled | ) |
Optional request from the embedder to tune v8 towards energy efficiency rather than speed if battery_saver_mode_enabled
is true, because the embedder is in battery saver mode. If false, the correct tuning is left to v8 to decide.
Definition at line 10636 of file api.cc.
void v8::Isolate::SetCaptureStackTraceForUncaughtExceptions | ( | bool | capture, |
int | frame_limit = 10, | ||
StackTrace::StackTraceOptions | options = StackTrace::kOverview ) |
void v8::Isolate::SetCounterFunction | ( | CounterLookupCallback | callback | ) |
void v8::Isolate::SetCreateHistogramFunction | ( | CreateHistogramCallback | callback | ) |
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.
Definition at line 10547 of file api.cc.
void v8::Isolate::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 1804 of file v8-isolate.h.
void v8::Isolate::SetEmbedderRootsHandler | ( | EmbedderRootsHandler * | handler | ) |
Sets an embedder roots handle that V8 should consider when performing non-unified heap garbage collections. The intended use case is for setting a custom handler after invoking AttachCppHeap()
.
V8 does not take ownership of the handler.
Definition at line 9866 of file api.cc.
void v8::Isolate::SetEventLogger | ( | LogEventCallback | that | ) |
void v8::Isolate::SetExceptionPropagationCallback | ( | ExceptionPropagationCallback | callback | ) |
void v8::Isolate::SetFailedAccessCheckCallbackFunction | ( | FailedAccessCheckCallback | callback | ) |
void v8::Isolate::SetFatalErrorHandler | ( | FatalErrorCallback | that | ) |
void v8::Isolate::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.
Definition at line 9882 of file api.cc.
void v8::Isolate::SetHostCreateShadowRealmContextCallback | ( | HostCreateShadowRealmContextCallback | callback | ) |
void v8::Isolate::SetHostImportModuleDynamicallyCallback | ( | HostImportModuleDynamicallyCallback | callback | ) |
void v8::Isolate::SetHostImportModuleWithPhaseDynamicallyCallback | ( | HostImportModuleWithPhaseDynamicallyCallback | callback | ) |
This specifies the callback called by the upcoming dynamic import() and import.source() language feature to load modules.
This API is experimental and is expected to be changed or removed in the future. The callback is currently only called when for source-phase imports. Evaluation-phase imports use the existing HostImportModuleDynamicallyCallback callback.
Definition at line 10141 of file api.cc.
void v8::Isolate::SetHostInitializeImportMetaObjectCallback | ( | HostInitializeImportMetaObjectCallback | callback | ) |
void v8::Isolate::SetIdle | ( | bool | is_idle | ) |
void v8::Isolate::SetIsJSApiWrapperNativeErrorCallback | ( | IsJSApiWrapperNativeErrorCallback | callback | ) |
Set the callback that checks whether a Error.isError should return true for a JSApiWrapper object, i.e. whether it represents a native JS error. For example, in an HTML embedder, DOMExceptions are considered native errors.
void v8::Isolate::SetIsLoading | ( | bool | is_loading | ) |
Optional notification to tell V8 whether the embedder is currently loading resources. If the embedder uses this notification, it should call SetIsLoading(true) when loading starts and SetIsLoading(false) when it ends. It's valid to call SetIsLoading(true) again while loading, which will update the timestamp when V8 considers the load started. Calling SetIsLoading(false) while not loading does nothing. V8 uses these notifications to guide heuristics. This is an unfinished experimental feature. Semantics and implementation may change frequently.
Definition at line 10653 of file api.cc.
void v8::Isolate::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.
options | options for the JIT code event handler. |
event_handler | the JIT code event handler, which will be invoked each time code is added, moved or removed. |
event_handler
won't get notified of existent code. 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. 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. event_handler
function must ignore event codes it does not recognize to maintain future compatibility. Definition at line 10673 of file api.cc.
void v8::Isolate::SetMemorySaverMode | ( | bool | memory_saver_mode_enabled | ) |
Optional request from the embedder to tune v8 towards memory efficiency rather than speed if memory_saver_mode_enabled
is true, because the embedder is in memory saver mode. If false, the correct tuning is left to v8 to decide.
Definition at line 10641 of file api.cc.
void v8::Isolate::SetMetricsRecorder | ( | const std::shared_ptr< metrics::Recorder > & | metrics_recorder | ) |
Enables the host application to provide a mechanism for recording event based metrics. In order to use this interface include/v8-metrics.h needs to be included and the recorder needs to be derived from the Recorder base class defined there. This method can only be called once per isolate and must happen during isolate initialization before background threads are spawned.
Definition at line 10559 of file api.cc.
void v8::Isolate::SetMicrotasksPolicy | ( | MicrotasksPolicy | policy | ) |
void v8::Isolate::SetModifyCodeGenerationFromStringsCallback | ( | ModifyCodeGenerationFromStringsCallback2 | callback | ) |
Set the callback to invoke to check if code generation from strings should be allowed.
void v8::Isolate::SetOOMErrorHandler | ( | OOMErrorCallback | that | ) |
void v8::Isolate::SetPrepareStackTraceCallback | ( | PrepareStackTraceCallback | callback | ) |
void v8::Isolate::SetPriority | ( | Priority | priority | ) |
void v8::Isolate::SetPromiseHook | ( | PromiseHook | hook | ) |
void v8::Isolate::SetPromiseRejectCallback | ( | PromiseRejectCallback | callback | ) |
void v8::Isolate::SetReleaseCppHeapCallbackForTesting | ( | ReleaseCppHeapCallback | callback | ) |
void v8::Isolate::SetSharedArrayBufferConstructorEnabledCallback | ( | SharedArrayBufferConstructorEnabledCallback | callback | ) |
void v8::Isolate::SetStackLimit | ( | uintptr_t | stack_limit | ) |
Modifies the stack limit for this Isolate.
stack_limit | An address beyond which the Vm's stack may not grow. |
Definition at line 10681 of file api.cc.
void v8::Isolate::SetUseCounterCallback | ( | UseCounterCallback | callback | ) |
void v8::Isolate::SetWasmAsyncResolvePromiseCallback | ( | WasmAsyncResolvePromiseCallback | callback | ) |
void v8::Isolate::SetWasmImportedStringsEnabledCallback | ( | WasmImportedStringsEnabledCallback | callback | ) |
void v8::Isolate::SetWasmInstanceCallback | ( | ExtensionCallback | callback | ) |
void v8::Isolate::SetWasmJSPIEnabledCallback | ( | WasmJSPIEnabledCallback | callback | ) |
void v8::Isolate::SetWasmLoadSourceMapCallback | ( | WasmLoadSourceMapCallback | callback | ) |
void v8::Isolate::SetWasmModuleCallback | ( | ExtensionCallback | callback | ) |
Embedder over{ride|load} injection points for wasm APIs. The expectation is that the embedder sets them at most once.
void v8::Isolate::SetWasmStreamingCallback | ( | WasmStreamingCallback | callback | ) |
void v8::Isolate::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.
Definition at line 9888 of file api.cc.
Schedules a v8::Exception::Error with the given message. See ThrowException for more details. Templatized to provide compile-time errors in case of too long strings (see v8::String::NewFromUtf8Literal).
Definition at line 1071 of file v8-isolate.h.
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.
Definition at line 9793 of file api.cc.
|
static |
v8::Isolate::V8_DEPRECATED | ( | "Will be | removed, |
use ScriptCompiler::CompileOptions for enabling the " "compile hints magic comments" | ) |
Register callback to control whether compile hints magic comments are enabled.
|
friend |
Definition at line 1796 of file v8-isolate.h.
|
friend |
Definition at line 1795 of file v8-isolate.h.
|
staticconstexpr |
Definition at line 1569 of file v8-isolate.h.