![]() |
v8
7.9.317 (node 13.2.0)
V8 is Google's open source JavaScript engine
|
Namespaces | |
base | |
debug | |
internal | |
platform | |
Functions | |
constexpr uint32_t | CurrentValueSerializerFormatVersion () |
V8_EXPORT bool | TryHandleWebAssemblyTrapPosix (int sig_code, siginfo_t *info, void *context) |
V8_EXPORT bool | TryHandleWebAssemblyTrapWindows (EXCEPTION_POINTERS *exception) |
void V8_EXPORT | RegisterExtension (std::unique_ptr< Extension >) |
V8_INLINE Local< Primitive > | Undefined (Isolate *isolate) |
V8_INLINE Local< Primitive > | Null (Isolate *isolate) |
V8_INLINE Local< Boolean > | True (Isolate *isolate) |
V8_INLINE Local< Boolean > | False (Isolate *isolate) |
template<class T > | |
Maybe< T > | Nothing () |
template<class T > | |
Maybe< T > | Just (const T &t) |
Maybe< void > | JustVoid () |
Profiler support for the V8 JavaScript engine.
Testing support for the V8 JavaScript engine.
Support for Persistent containers.
C++11 embedders can use STL containers with Global values, but pre-C++11 does not support the required move semantic and hence may want these container classes.
Compile-time constants.
This header provides access to information about the value serializer at compile time, without declaring or defining any symbols that require linking to V8.
The v8 JavaScript engine.
typedef void(* AccessorGetterCallback) (Local< String > property, const PropertyCallbackInfo< Value > &info) |
Accessor[Getter|Setter] are used as callback functions when setting|getting a particular property. See Object and ObjectTemplate's method SetAccessor.
typedef void(* AccessorNameGetterCallback) (Local< Name > property, const PropertyCallbackInfo< Value > &info) |
typedef void(* AccessorNameSetterCallback) (Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info) |
typedef void(* AccessorSetterCallback) (Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info) |
typedef void(* AddCrashKeyCallback) (CrashKeyId id, const std::string &value) |
typedef void(* AddHistogramSampleCallback) (void *histogram, int sample) |
typedef bool(* AllowCodeGenerationFromStringsCallback) (Local< Context > context, Local< String > source) |
Callback to check if code generation from strings is allowed. See Context::AllowCodeGenerationFromStrings.
typedef void(* ApiImplementationCallback) (const FunctionCallbackInfo< Value > &) |
typedef void*(* CreateHistogramCallback) (const char *name, int min, int max, size_t buckets) |
typedef void(* DcheckErrorCallback) (const char *file, int line, const char *message) |
typedef bool(* EntropySource) (unsigned char *buffer, size_t length) |
typedef bool(* ExtensionCallback) (const FunctionCallbackInfo< Value > &) |
typedef void(* FailedAccessCheckCallback) (Local< Object > target, AccessType type, Local< Value > data) |
typedef void(* FatalErrorCallback) (const char *location, const char *message) |
typedef void(* FunctionCallback) (const FunctionCallbackInfo< Value > &info) |
typedef void(* GCCallback) (GCType type, GCCallbackFlags flags) |
typedef void(* GenericNamedPropertyDefinerCallback) (Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info) |
Interceptor for defineProperty requests on an object.
Use info.GetReturnValue()
to indicate whether the request was intercepted or not. If the definer successfully intercepts the request, i.e., if the request should not be further executed, call info.GetReturnValue().Set(value)
. If the definer did not intercept the request, i.e., if the request should be handled as if no interceptor is present, do not not call Set()
.
property | The name of the property for which the request was intercepted. |
desc | The property descriptor which is used to define the property if the request is not intercepted. |
info | Information about the intercepted request, such as isolate, receiver, return value, or whether running in ‘'use strict’mode. See PropertyCallbackInfo`. |
See also ObjectTemplate::SetHandler
.
typedef void(* GenericNamedPropertyDeleterCallback) (Local< Name > property, const PropertyCallbackInfo< Boolean > &info) |
Interceptor for delete requests on an object.
Use info.GetReturnValue()
to indicate whether the request was intercepted or not. If the deleter successfully intercepts the request, i.e., if the request should not be further executed, call info.GetReturnValue().Set(value)
with a boolean value
. The value
is used as the return value of delete
.
property | The name of the property for which the request was intercepted. |
info | Information about the intercepted request, such as isolate, receiver, return value, or whether running in ‘'use strict’mode. See PropertyCallbackInfo`. |
delete
, i.e., throw in strict mode instead of returning false, use info.ShouldThrowOnError()
to determine if you are in strict mode.See also ObjectTemplate::SetHandler.
typedef void(* GenericNamedPropertyDescriptorCallback) (Local< Name > property, const PropertyCallbackInfo< Value > &info) |
Interceptor for getOwnPropertyDescriptor requests on an object.
Use info.GetReturnValue().Set()
to set the return value of the intercepted request. The return value must be an object that can be converted to a PropertyDescriptor, e.g., a v8::value
returned from v8::Object::getOwnPropertyDescriptor
.
property | The name of the property for which the request was intercepted. \info Information about the intercepted request, such as isolate, receiver, return value, or whether running in ‘'use strict’mode. See PropertyCallbackInfo`. |
See also ObjectTemplate::SetHandler
.
typedef void(* GenericNamedPropertyEnumeratorCallback) (const PropertyCallbackInfo< Array > &info) |
typedef void(* GenericNamedPropertyGetterCallback) (Local< Name > property, const PropertyCallbackInfo< Value > &info) |
Interceptor for get requests on an object.
Use info.GetReturnValue().Set()
to set the return value of the intercepted get request.
property | The name of the property for which the request was intercepted. |
info | Information about the intercepted request, such as isolate, receiver, return value, or whether running in 'use strict ' mode. See PropertyCallbackInfo . |
See also ObjectTemplate::SetHandler
.
typedef void(* GenericNamedPropertyQueryCallback) (Local< Name > property, const PropertyCallbackInfo< Integer > &info) |
Intercepts all requests that query the attributes of the property, e.g., getOwnPropertyDescriptor(), propertyIsEnumerable(), and defineProperty().
Use info.GetReturnValue().Set(value)
to set the property attributes. The value is an integer encoding a v8::PropertyAttribute
.
property | The name of the property for which the request was intercepted. |
info | Information about the intercepted request, such as isolate, receiver, return value, or whether running in ‘'use strict’mode. See PropertyCallbackInfo`. |
hasOwnProperty()
can trigger this interceptor depending on the state of the object.See also ObjectTemplate::SetHandler.
typedef void(* GenericNamedPropertySetterCallback) (Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Value > &info) |
Interceptor for set requests on an object.
Use info.GetReturnValue()
to indicate whether the request was intercepted or not. If the setter successfully intercepts the request, i.e., if the request should not be further executed, call info.GetReturnValue().Set(value)
. If the setter did not intercept the request, i.e., if the request should be handled as if no interceptor is present, do not not call Set()
.
property | The name of the property for which the request was intercepted. |
value | The value which the property will have if the request is not intercepted. |
info | Information about the intercepted request, such as isolate, receiver, return value, or whether running in ‘'use strict’mode. See PropertyCallbackInfo`. |
See also ObjectTemplate::SetHandler.
typedef void(* HostCleanupFinalizationGroupCallback) (Local< Context > context, Local< FinalizationGroup > fg) |
HostCleanupFinalizationGroupCallback is called when we require the embedder to enqueue a task that would call FinalizationGroup::Cleanup().
The FinalizationGroup is the one for which the embedder needs to call FinalizationGroup::Cleanup() on.
The context provided is the one in which the FinalizationGroup was created in.
typedef MaybeLocal<Promise>(* HostImportModuleDynamicallyCallback) (Local< Context > context, Local< ScriptOrModule > referrer, Local< String > specifier) |
HostImportModuleDynamicallyCallback is called when we require the embedder to load a module. This is used as part of the dynamic import syntax.
The referrer contains metadata about the script/module that calls import.
The specifier is the name of the module that should be imported.
The embedder must compile, instantiate, evaluate the Module, and obtain it's namespace object.
The Promise returned from this function is forwarded to userland JavaScript. The embedder must resolve this promise with the module namespace object. In case of an exception, the embedder must reject this promise with the exception. If the promise creation itself fails (e.g. due to stack overflow), the embedder must propagate that exception by returning an empty MaybeLocal.
typedef void(* HostInitializeImportMetaObjectCallback) (Local< Context > context, Local< Module > module, Local< Object > meta) |
HostInitializeImportMetaObjectCallback is called the first time import.meta is accessed for a module. Subsequent access will reuse the same value.
The method combines two implementation-defined abstract operations into one: HostGetImportMetaProperties and HostFinalizeImportMeta.
The embedder should use v8::Object::CreateDataProperty to add properties on the meta object.
typedef void(* IndexedPropertyDefinerCallback) (uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info) |
typedef void(* IndexedPropertyDeleterCallback) (uint32_t index, const PropertyCallbackInfo< Boolean > &info) |
typedef void(* IndexedPropertyDescriptorCallback) (uint32_t index, const PropertyCallbackInfo< Value > &info) |
typedef void(* IndexedPropertyEnumeratorCallback) (const PropertyCallbackInfo< Array > &info) |
typedef void(* IndexedPropertyGetterCallback) (uint32_t index, const PropertyCallbackInfo< Value > &info) |
typedef void(* IndexedPropertyQueryCallback) (uint32_t index, const PropertyCallbackInfo< Integer > &info) |
typedef void(* IndexedPropertySetterCallback) (uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info) |
typedef void(* InterruptCallback) (Isolate *isolate, void *data) |
typedef void(* JitCodeEventHandler) (const JitCodeEvent *event) |
typedef void(* LogEventCallback) (const char *name, int event) |
typedef void(* MicrotasksCompletedCallbackWithData) (Isolate *, void *) |
using NativeObject = void* |
Definition at line 23 of file v8-profiler.h.
typedef size_t(* NearHeapLimitCallback) (void *data, size_t current_heap_limit, size_t initial_heap_limit) |
This callback is invoked when the heap size is close to the heap limit and V8 is likely to abort with out-of-memory error. The callback can extend the heap limit by returning a value that is greater than the current_heap_limit. The initial heap limit is the limit that was set after heap setup.
typedef void(* OOMErrorCallback) (const char *location, bool is_heap_oom) |
typedef uintptr_t PersistentContainerValue |
typedef MaybeLocal<Value>(* PrepareStackTraceCallback) (Local< Context > context, Local< Value > error, Local< Array > sites) |
PrepareStackTraceCallback is called when the stack property of an error is first accessed. The return value will be used as the stack value. If this callback is registed, the |Error.prepareStackTrace| API will be disabled. |sites| is an array of call sites, specified in https://v8.dev/docs/stack-trace-api
typedef void(* PromiseHook) (PromiseHookType type, Local< Promise > promise, Local< Value > parent) |
typedef void(* PromiseRejectCallback) (PromiseRejectMessage message) |
typedef uintptr_t(* ReturnAddressLocationResolver) (uintptr_t return_addr_location) |
ReturnAddressLocationResolver is used as a callback function when v8 is resolving the location of a return address on the stack. Profilers that change the return address on the stack can use this to resolve the stack location to wherever the profiler stashed the original return address.
return_addr_location | A location on stack where a machine return address resides. |
using SnapshotObjectId = uint32_t |
Definition at line 24 of file v8-profiler.h.
using UniquePersistent = Global<T> |
typedef void(* WasmStreamingCallback) (const FunctionCallbackInfo< Value > &) |
enum AccessControl |
Access control specifications.
Some accessors should be accessible across contexts. These accessors have an explicit access control parameter which specifies the kind of cross-context access that should be allowed.
TODO(dcarney): Remove PROHIBITS_OVERWRITING as it is now unused.
Enumerator | |
---|---|
DEFAULT | |
ALL_CAN_READ | |
ALL_CAN_WRITE | |
PROHIBITS_OVERWRITING |
enum AccessType |
|
strong |
enum CodeEventType |
Note that this enum may be extended in the future. Please include a default case if this enum is used in a switch statement.
Enumerator | |
---|---|
kUnknownType |
Definition at line 986 of file v8-profiler.h.
|
strong |
Enumerator | |
---|---|
kLazyLogging | |
kEagerLogging |
Definition at line 246 of file v8-profiler.h.
enum CpuProfilingMode |
Enumerator | |
---|---|
kLeafNodeLineNumbers | |
kCallerLineNumbers |
Definition at line 227 of file v8-profiler.h.
Enumerator | |
---|---|
kStandardNaming | |
kDebugNaming |
Definition at line 238 of file v8-profiler.h.
|
strong |
enum GCCallbackFlags |
GCCallbackFlags is used to notify additional information about the GC callback.
enum GCType |
Applications can register callback functions which will be called before and after certain garbage collection operations. Allocations are not allowed in the callback functions, you therefore cannot manipulate objects (set or delete properties for example) since it is possible such operations will result in the allocation of objects.
Enumerator | |
---|---|
kGCTypeScavenge | |
kGCTypeMarkSweepCompact | |
kGCTypeIncrementalMarking | |
kGCTypeProcessWeakCallbacks | |
kGCTypeAll |
|
strong |
|
strong |
enum JitCodeEventOptions |
|
strong |
Keys/Properties filter enums:
KeyCollectionMode limits the range of collected properties. kOwnOnly limits the collected properties to the given Object only. kIncludesPrototypes will include all keys of the objects's prototype chain as well.
Enumerator | |
---|---|
kOwnOnly | |
kIncludePrototypes |
|
strong |
|
strong |
|
strong |
Memory pressure level for the MemoryPressureNotification. kNone hints V8 that there is no memory pressure. kModerate hints V8 to speed up incremental garbage collection at the cost of of higher latency due to garbage collection pauses. kCritical hints V8 to free memory as soon as possible. Garbage collection pauses at this level will be large.
Enumerator | |
---|---|
kNone | |
kModerate | |
kCritical |
|
strong |
Policy for running microtasks:
Enumerator | |
---|---|
kExplicit | |
kScoped | |
kAuto |
|
strong |
A flag describing different modes of string creation.
Aside from performance implications there are no differences between the two creation modes.
|
strong |
PromiseHook with type kInit is called when a new promise is created. When a new promise is created as part of the chain in the case of Promise.then or in the intermediate promises created by Promise.{race, all}/AsyncFunctionAwait, we pass the parent promise otherwise we pass undefined.
PromiseHook with type kResolve is called at the beginning of resolve or reject function defined by CreateResolvingFunctions.
PromiseHook with type kBefore is called at the beginning of the PromiseReactionJob.
PromiseHook with type kAfter is called right at the end of the PromiseReactionJob.
Enumerator | |
---|---|
kInit | |
kResolve | |
kBefore | |
kAfter |
enum PromiseRejectEvent |
enum PropertyAttribute |
enum PropertyFilter |
|
strong |
Configuration flags for v8::NamedPropertyHandlerConfiguration or v8::IndexedPropertyHandlerConfiguration.
enum RAILMode : unsigned |
Option flags passed to the SetRAILMode function. See documentation https://developers.google.com/web/tools/chrome-devtools/ profile/evaluate-performance/rail
Enumerator | |
---|---|
PERFORMANCE_RESPONSE | |
PERFORMANCE_ANIMATION | |
PERFORMANCE_IDLE | |
PERFORMANCE_LOAD |
|
strong |
Options for marking whether callbacks may trigger JS-observable side effects. Side-effect-free callbacks are whitelisted during debug evaluation with throwOnSideEffect. It applies when calling a Function, FunctionTemplate, or an Accessor callback. For Interceptors, please see PropertyHandlerFlags's kHasNoSideEffect. Callbacks that only cause side effects to the receiver are whitelisted if invoked on receiver objects that are created within the same debug-evaluate call, as these objects are temporary and the side effect does not escape.
Enumerator | |
---|---|
kHasSideEffect | |
kHasNoSideEffect | |
kHasSideEffectToReceiver |
enum StateTag |
|
strong |
|
constexpr |
Definition at line 20 of file v8-value-serializer-version.h.
V8_EXPORT bool v8::TryHandleWebAssemblyTrapPosix | ( | int | sig_code, |
siginfo_t * | info, | ||
void * | context | ||
) |
This function determines whether a memory access violation has been an out-of-bounds memory access in WebAssembly. If so, it will modify the context parameter and add a return address where the execution can continue after the signal handling, and return true. Otherwise, false will be returned.
The parameters to this function correspond to those passed to a Posix signal handler. Use this function only on Linux and Mac.
sig_code | The signal code, e.g. SIGSEGV. |
info | A pointer to the siginfo_t struct provided to the signal handler. |
context | A pointer to a ucontext_t struct provided to the signal handler. |
V8_EXPORT bool v8::TryHandleWebAssemblyTrapWindows | ( | EXCEPTION_POINTERS * | exception | ) |
This function determines whether a memory access violation has been an out-of-bounds memory access in WebAssembly. If so, it will modify the exception parameter and add a return address where the execution can continue after the exception handling, and return true. Otherwise the return value will be false.
The parameter to this function corresponds to the one passed to a Windows vectored exception handler. Use this function only on Windows.
exception | An EXCEPTION_POINTERS* as provided to the exception handler. |