v8  7.9.317 (node 13.2.0)
V8 is Google's open source JavaScript engine
v8 Namespace Reference

Namespaces

 base
 
 debug
 
 internal
 
 platform
 

Data Structures

class  Task
 
class  IdleTask
 
class  TaskRunner
 
class  ConvertableToTraceFormat
 
class  TracingController
 
class  PageAllocator
 
class  Platform
 
struct  CpuProfileDeoptFrame
 
struct  CpuProfileDeoptInfo
 
class  CpuProfileNode
 
class  CpuProfile
 
class  CpuProfilingOptions
 
class  CpuProfiler
 
class  HeapGraphEdge
 
class  HeapGraphNode
 
class  OutputStream
 
class  HeapSnapshot
 
class  ActivityControl
 
class  AllocationProfile
 
class  EmbedderGraph
 
class  HeapProfiler
 
struct  HeapStatsUpdate
 
class  CodeEvent
 
class  CodeEventHandler
 
class  Testing
 
class  StdMapTraits
 
class  DefaultPersistentValueMapTraits
 
class  DefaultGlobalMapTraits
 
class  PersistentValueMapBase
 
class  PersistentValueMap
 
class  GlobalValueMap
 
class  StdPersistentValueMap
 
class  StdGlobalValueMap
 
class  DefaultPersistentValueVectorTraits
 
class  PersistentValueVector
 
class  Maybe
 
class  Local
 
class  MaybeLocal
 
class  Eternal
 
class  NonCopyablePersistentTraits
 
class  PersistentBase
 
class  Persistent
 
class  Global
 
class  TracedGlobal
 
class  TracedReference
 
class  TracedReferenceBase
 
class  WeakCallbackObject
 
class  FunctionCallbackInfo
 
class  PropertyCallbackInfo
 
class  ReturnValue
 
class  WeakCallbackInfo
 
struct  CopyablePersistentTraits
 
struct  TracedGlobalTrait
 
class  HandleScope
 
class  EscapableHandleScope
 
class  SealHandleScope
 
class  Data
 
class  ScriptOrModule
 
class  PrimitiveArray
 
class  ScriptOriginOptions
 
class  ScriptOrigin
 
class  UnboundScript
 
class  UnboundModuleScript
 
class  Location
 
class  Module
 
class  Script
 
class  ScriptCompiler
 
class  Message
 
class  StackTrace
 
class  StackFrame
 
struct  RegisterState
 
struct  SampleInfo
 
struct  MemoryRange
 
struct  JSEntryStub
 
struct  UnwindState
 
class  JSON
 
class  ValueSerializer
 
class  ValueDeserializer
 
class  Value
 
class  Primitive
 
class  Boolean
 
class  Name
 
class  String
 
class  Symbol
 
class  Private
 
class  Number
 
class  Integer
 
class  Int32
 
class  Uint32
 
class  BigInt
 
class  Object
 
class  Array
 
class  Map
 
class  Set
 
class  Function
 
class  Promise
 
class  PropertyDescriptor
 
class  Proxy
 
class  MemorySpan
 
struct  OwnedBuffer
 
class  CompiledWasmModule
 
class  WasmModuleObject
 
class  WasmStreaming
 
class  WasmModuleObjectBuilderStreaming
 
class  BackingStore
 
class  ArrayBuffer
 
class  ArrayBufferView
 
class  TypedArray
 
class  Uint8Array
 
class  Uint8ClampedArray
 
class  Int8Array
 
class  Uint16Array
 
class  Int16Array
 
class  Uint32Array
 
class  Int32Array
 
class  Float32Array
 
class  Float64Array
 
class  BigInt64Array
 
class  BigUint64Array
 
class  DataView
 
class  SharedArrayBuffer
 
class  Date
 
class  NumberObject
 
class  BigIntObject
 
class  BooleanObject
 
class  StringObject
 
class  SymbolObject
 
class  RegExp
 
class  FinalizationGroup
 
class  External
 
class  Template
 
class  FunctionTemplate
 
struct  NamedPropertyHandlerConfiguration
 
struct  IndexedPropertyHandlerConfiguration
 
class  ObjectTemplate
 
class  Signature
 
class  AccessorSignature
 
class  Extension
 
class  ResourceConstraints
 
class  Exception
 
class  PromiseRejectMessage
 
class  MicrotaskQueue
 
class  MicrotasksScope
 
class  HeapStatistics
 
class  HeapSpaceStatistics
 
class  HeapObjectStatistics
 
class  HeapCodeStatistics
 
struct  JitCodeEvent
 
class  ExternalResourceVisitor
 
class  PersistentHandleVisitor
 
class  EmbedderHeapTracer
 
struct  SerializeInternalFieldsCallback
 
struct  DeserializeInternalFieldsCallback
 
class  Isolate
 
class  StartupData
 
class  V8
 
class  SnapshotCreator
 
class  Maybe< void >
 
class  TryCatch
 
class  ExtensionConfiguration
 
class  Context
 
class  Unlocker
 
class  Locker
 
class  Unwinder
 

Typedefs

using NativeObject = void *
 
using SnapshotObjectId = uint32_t
 
typedef uintptr_t PersistentContainerValue
 
template<class T >
using Handle = Local< T >
 
template<class T >
using UniquePersistent = Global< T >
 
typedef void(* AccessorGetterCallback) (Local< String > property, const PropertyCallbackInfo< Value > &info)
 
typedef void(* AccessorNameGetterCallback) (Local< Name > property, const PropertyCallbackInfo< Value > &info)
 
typedef void(* AccessorSetterCallback) (Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
 
typedef void(* AccessorNameSetterCallback) (Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
 
typedef void(* FunctionCallback) (const FunctionCallbackInfo< Value > &info)
 
typedef void(* GenericNamedPropertyGetterCallback) (Local< Name > property, const PropertyCallbackInfo< Value > &info)
 
typedef void(* GenericNamedPropertySetterCallback) (Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
 
typedef void(* GenericNamedPropertyQueryCallback) (Local< Name > property, const PropertyCallbackInfo< Integer > &info)
 
typedef void(* GenericNamedPropertyDeleterCallback) (Local< Name > property, const PropertyCallbackInfo< Boolean > &info)
 
typedef void(* GenericNamedPropertyEnumeratorCallback) (const PropertyCallbackInfo< Array > &info)
 
typedef void(* GenericNamedPropertyDefinerCallback) (Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info)
 
typedef void(* GenericNamedPropertyDescriptorCallback) (Local< Name > property, const PropertyCallbackInfo< Value > &info)
 
typedef void(* IndexedPropertyGetterCallback) (uint32_t index, const PropertyCallbackInfo< Value > &info)
 
typedef void(* IndexedPropertySetterCallback) (uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)
 
typedef void(* IndexedPropertyQueryCallback) (uint32_t index, const PropertyCallbackInfo< Integer > &info)
 
typedef void(* IndexedPropertyDeleterCallback) (uint32_t index, const PropertyCallbackInfo< Boolean > &info)
 
typedef void(* IndexedPropertyEnumeratorCallback) (const PropertyCallbackInfo< Array > &info)
 
typedef void(* IndexedPropertyDefinerCallback) (uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info)
 
typedef void(* IndexedPropertyDescriptorCallback) (uint32_t index, const PropertyCallbackInfo< Value > &info)
 
typedef bool(* AccessCheckCallback) (Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data)
 
typedef void(* FatalErrorCallback) (const char *location, const char *message)
 
typedef void(* OOMErrorCallback) (const char *location, bool is_heap_oom)
 
typedef void(* DcheckErrorCallback) (const char *file, int line, const char *message)
 
typedef void(* MessageCallback) (Local< Message > message, Local< Value > data)
 
typedef void(* LogEventCallback) (const char *name, int event)
 
typedef int *(* CounterLookupCallback) (const char *name)
 
typedef void *(* CreateHistogramCallback) (const char *name, int min, int max, size_t buckets)
 
typedef void(* AddHistogramSampleCallback) (void *histogram, int sample)
 
typedef void(* AddCrashKeyCallback) (CrashKeyId id, const std::string &value)
 
typedef void(* BeforeCallEnteredCallback) (Isolate *)
 
typedef void(* CallCompletedCallback) (Isolate *)
 
typedef void(* HostCleanupFinalizationGroupCallback) (Local< Context > context, Local< FinalizationGroup > fg)
 
typedef MaybeLocal< Promise >(* HostImportModuleDynamicallyCallback) (Local< Context > context, Local< ScriptOrModule > referrer, Local< String > specifier)
 
typedef void(* HostInitializeImportMetaObjectCallback) (Local< Context > context, Local< Module > module, Local< Object > meta)
 
typedef MaybeLocal< Value >(* PrepareStackTraceCallback) (Local< Context > context, Local< Value > error, Local< Array > sites)
 
typedef void(* PromiseHook) (PromiseHookType type, Local< Promise > promise, Local< Value > parent)
 
typedef void(* PromiseRejectCallback) (PromiseRejectMessage message)
 
typedef void(* MicrotasksCompletedCallback) (Isolate *)
 
typedef void(* MicrotasksCompletedCallbackWithData) (Isolate *, void *)
 
typedef void(* MicrotaskCallback) (void *data)
 
typedef void(* FailedAccessCheckCallback) (Local< Object > target, AccessType type, Local< Value > data)
 
typedef bool(* AllowCodeGenerationFromStringsCallback) (Local< Context > context, Local< String > source)
 
typedef MaybeLocal< String >(* ModifyCodeGenerationFromStringsCallback) (Local< Context > context, Local< Value > source)
 
typedef bool(* ExtensionCallback) (const FunctionCallbackInfo< Value > &)
 
typedef bool(* AllowWasmCodeGenerationCallback) (Local< Context > context, Local< String > source)
 
typedef void(* ApiImplementationCallback) (const FunctionCallbackInfo< Value > &)
 
typedef void(* WasmStreamingCallback) (const FunctionCallbackInfo< Value > &)
 
typedef bool(* WasmThreadsEnabledCallback) (Local< Context > context)
 
typedef Local< String >(* WasmLoadSourceMapCallback) (Isolate *isolate, const char *name)
 
typedef void(* GCCallback) (GCType type, GCCallbackFlags flags)
 
typedef void(* InterruptCallback) (Isolate *isolate, void *data)
 
typedef size_t(* NearHeapLimitCallback) (void *data, size_t current_heap_limit, size_t initial_heap_limit)
 
typedef void(* JitCodeEventHandler) (const JitCodeEvent *event)
 
typedef SerializeInternalFieldsCallback SerializeEmbedderFieldsCallback
 
typedef DeserializeInternalFieldsCallback DeserializeEmbedderFieldsCallback
 
typedef bool(* EntropySource) (unsigned char *buffer, size_t length)
 
typedef uintptr_t(* ReturnAddressLocationResolver) (uintptr_t return_addr_location)
 

Enumerations

enum  CpuProfilingMode { kLeafNodeLineNumbers , kCallerLineNumbers }
 
enum  CpuProfilingNamingMode { kStandardNaming , kDebugNaming }
 
enum  CpuProfilingLoggingMode { kLazyLogging , kEagerLogging }
 
enum  CodeEventType { kUnknownType }
 
enum  PersistentContainerCallbackType { kNotWeak , kWeakWithParameter , kWeakWithInternalFields }
 
enum class  WeakCallbackType { kParameter , kInternalFields , kFinalizer }
 
enum  StateTag {
  JS , GC , PARSER , BYTECODE_COMPILER ,
  COMPILER , OTHER , EXTERNAL , IDLE
}
 
enum class  NewStringType { kNormal , kInternalized }
 
enum  PropertyAttribute { None = 0 , ReadOnly = 1 << 0 , DontEnum = 1 << 1 , DontDelete = 1 << 2 }
 
enum  AccessControl { DEFAULT = 0 , ALL_CAN_READ = 1 , ALL_CAN_WRITE = 1 << 1 , PROHIBITS_OVERWRITING = 1 << 2 }
 
enum  PropertyFilter {
  ALL_PROPERTIES = 0 , ONLY_WRITABLE = 1 , ONLY_ENUMERABLE = 2 , ONLY_CONFIGURABLE = 4 ,
  SKIP_STRINGS = 8 , SKIP_SYMBOLS = 16
}
 
enum class  SideEffectType { kHasSideEffect , kHasNoSideEffect , kHasSideEffectToReceiver }
 
enum class  KeyCollectionMode { kOwnOnly , kIncludePrototypes }
 
enum class  IndexFilter { kIncludeIndices , kSkipIndices }
 
enum class  KeyConversionMode { kConvertToString , kKeepNumbers , kNoNumbers }
 
enum class  IntegrityLevel { kFrozen , kSealed }
 
enum class  ConstructorBehavior { kThrow , kAllow }
 
enum class  ArrayBufferCreationMode { kInternalized , kExternalized }
 
enum  Intrinsic
 
enum  AccessType {
  ACCESS_GET , ACCESS_SET , ACCESS_HAS , ACCESS_DELETE ,
  ACCESS_KEYS
}
 
enum class  PropertyHandlerFlags {
  kNone = 0 , kAllCanRead = 1 , kNonMasking = 1 << 1 , kOnlyInterceptStrings = 1 << 2 ,
  kHasNoSideEffect = 1 << 3
}
 
enum class  CrashKeyId {
  kIsolateAddress , kReadonlySpaceFirstPageAddress , kMapSpaceFirstPageAddress , kCodeSpaceFirstPageAddress ,
  kDumpType
}
 
enum class  PromiseHookType { kInit , kResolve , kBefore , kAfter }
 
enum  PromiseRejectEvent { kPromiseRejectWithNoHandler = 0 , kPromiseHandlerAddedAfterReject = 1 , kPromiseRejectAfterResolved = 2 , kPromiseResolveAfterResolved = 3 }
 
enum class  MicrotasksPolicy { kExplicit , kScoped , kAuto }
 
enum  GCType {
  kGCTypeScavenge = 1 << 0 , kGCTypeMarkSweepCompact = 1 << 1 , kGCTypeIncrementalMarking = 1 << 2 , kGCTypeProcessWeakCallbacks = 1 << 3 ,
  kGCTypeAll
}
 
enum  GCCallbackFlags {
  kNoGCCallbackFlags = 0 , kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1 , kGCCallbackFlagForced = 1 << 2 , kGCCallbackFlagSynchronousPhantomCallbackProcessing = 1 << 3 ,
  kGCCallbackFlagCollectAllAvailableGarbage = 1 << 4 , kGCCallbackFlagCollectAllExternalMemory = 1 << 5 , kGCCallbackScheduleIdleGarbageCollection = 1 << 6
}
 
enum  RAILMode : unsigned { PERFORMANCE_RESPONSE , PERFORMANCE_ANIMATION , PERFORMANCE_IDLE , PERFORMANCE_LOAD }
 
enum  JitCodeEventOptions { kJitCodeEventDefault = 0 , kJitCodeEventEnumExisting = 1 }
 
enum class  MemoryPressureLevel { kNone , kModerate , kCritical }
 
enum class  MeasureMemoryMode { kSummary , kDetailed }
 

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< PrimitiveUndefined (Isolate *isolate)
 
V8_INLINE Local< PrimitiveNull (Isolate *isolate)
 
V8_INLINE Local< BooleanTrue (Isolate *isolate)
 
V8_INLINE Local< BooleanFalse (Isolate *isolate)
 
template<class T >
Maybe< T > Nothing ()
 
template<class T >
Maybe< T > Just (const T &t)
 
Maybe< void > JustVoid ()
 

Detailed Description

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 Documentation

◆ AccessCheckCallback

typedef bool(* AccessCheckCallback) (Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data)

Returns true if the given context should be allowed to access the given object.

Definition at line 6063 of file v8.h.

◆ AccessorGetterCallback

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.

Definition at line 3439 of file v8.h.

◆ AccessorNameGetterCallback

typedef void(* AccessorNameGetterCallback) (Local< Name > property, const PropertyCallbackInfo< Value > &info)

Definition at line 3442 of file v8.h.

◆ AccessorNameSetterCallback

typedef void(* AccessorNameSetterCallback) (Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)

Definition at line 3451 of file v8.h.

◆ AccessorSetterCallback

typedef void(* AccessorSetterCallback) (Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info)

Definition at line 3447 of file v8.h.

◆ AddCrashKeyCallback

typedef void(* AddCrashKeyCallback) (CrashKeyId id, const std::string &value)

Definition at line 6941 of file v8.h.

◆ AddHistogramSampleCallback

typedef void(* AddHistogramSampleCallback) (void *histogram, int sample)

Definition at line 6930 of file v8.h.

◆ AllowCodeGenerationFromStringsCallback

typedef bool(* AllowCodeGenerationFromStringsCallback) (Local< Context > context, Local< String > source)

Callback to check if code generation from strings is allowed. See Context::AllowCodeGenerationFromStrings.

Definition at line 7210 of file v8.h.

◆ AllowWasmCodeGenerationCallback

typedef bool(* AllowWasmCodeGenerationCallback) (Local< Context > context, Local< String > source)

Definition at line 7218 of file v8.h.

◆ ApiImplementationCallback

typedef void(* ApiImplementationCallback) (const FunctionCallbackInfo< Value > &)

Definition at line 7223 of file v8.h.

◆ BeforeCallEnteredCallback

typedef void(* BeforeCallEnteredCallback) (Isolate *)

Definition at line 6944 of file v8.h.

◆ CallCompletedCallback

typedef void(* CallCompletedCallback) (Isolate *)

Definition at line 6945 of file v8.h.

◆ CounterLookupCallback

typedef int*(* CounterLookupCallback) (const char *name)

Definition at line 6923 of file v8.h.

◆ CreateHistogramCallback

typedef void*(* CreateHistogramCallback) (const char *name, int min, int max, size_t buckets)

Definition at line 6925 of file v8.h.

◆ DcheckErrorCallback

typedef void(* DcheckErrorCallback) (const char *file, int line, const char *message)

Definition at line 6885 of file v8.h.

◆ DeserializeEmbedderFieldsCallback

◆ EntropySource

typedef bool(* EntropySource) (unsigned char *buffer, size_t length)

EntropySource is used as a callback function when v8 needs a source of entropy.

Definition at line 9070 of file v8.h.

◆ ExtensionCallback

typedef bool(* ExtensionCallback) (const FunctionCallbackInfo< Value > &)

Definition at line 7216 of file v8.h.

◆ FailedAccessCheckCallback

typedef void(* FailedAccessCheckCallback) (Local< Object > target, AccessType type, Local< Value > data)

Definition at line 7200 of file v8.h.

◆ FatalErrorCallback

typedef void(* FatalErrorCallback) (const char *location, const char *message)

Definition at line 6881 of file v8.h.

◆ FunctionCallback

typedef void(* FunctionCallback) (const FunctionCallbackInfo< Value > &info)

Definition at line 4288 of file v8.h.

◆ GCCallback

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

Definition at line 7277 of file v8.h.

◆ GenericNamedPropertyDefinerCallback

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().

Parameters
propertyThe name of the property for which the request was intercepted.
descThe property descriptor which is used to define the property if the request is not intercepted.
infoInformation about the intercepted request, such as isolate, receiver, return value, or whether running in ‘'use strict’mode. SeePropertyCallbackInfo`.

See also ObjectTemplate::SetHandler.

Definition at line 5970 of file v8.h.

◆ GenericNamedPropertyDeleterCallback

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.

Parameters
propertyThe name of the property for which the request was intercepted.
infoInformation about the intercepted request, such as isolate, receiver, return value, or whether running in ‘'use strict’mode. SeePropertyCallbackInfo`.
Note
If you need to mimic the behavior of 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.

Definition at line 5938 of file v8.h.

◆ GenericNamedPropertyDescriptorCallback

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.

Parameters
propertyThe 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. SeePropertyCallbackInfo`.
Note
If GetOwnPropertyDescriptor is intercepted, it will always return true, i.e., indicate that the property was found.

See also ObjectTemplate::SetHandler.

Definition at line 5993 of file v8.h.

◆ GenericNamedPropertyEnumeratorCallback

typedef void(* GenericNamedPropertyEnumeratorCallback) (const PropertyCallbackInfo< Array > &info)

Returns an array containing the names of the properties the named property getter intercepts.

Note: The values in the array must be of type v8::Name.

Definition at line 5947 of file v8.h.

◆ GenericNamedPropertyGetterCallback

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.

Parameters
propertyThe name of the property for which the request was intercepted.
infoInformation about the intercepted request, such as isolate, receiver, return value, or whether running in 'use strict' mode. See PropertyCallbackInfo.
void GetterCallback(
Local<Name> name,
info.GetReturnValue().Set(v8_num(42));
}
templ->InstanceTemplate()->SetHandler(
LocalContext env;
env->Global()
->Set(env.local(), v8_str("obj"), templ->GetFunction(env.local())
.ToLocalChecked()
->NewInstance(env.local())
.ToLocalChecked())
.FromJust();
v8::Local<v8::Value> result = CompileRun("obj.a = 17; obj.a");
CHECK(v8_num(42)->Equals(env.local(), result).FromJust());
static Local< FunctionTemplate > New(Isolate *isolate, FunctionCallback callback=nullptr, Local< Value > data=Local< Value >(), Local< Signature > signature=Local< Signature >(), int length=0, ConstructorBehavior behavior=ConstructorBehavior::kAllow, SideEffectType side_effect_type=SideEffectType::kHasSideEffect)
Definition: v8.h:189
V8_INLINE ReturnValue< T > GetReturnValue() const
Definition: v8.h:11346

See also ObjectTemplate::SetHandler.

Definition at line 5865 of file v8.h.

◆ GenericNamedPropertyQueryCallback

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.

Parameters
propertyThe name of the property for which the request was intercepted.
infoInformation about the intercepted request, such as isolate, receiver, return value, or whether running in ‘'use strict’mode. SeePropertyCallbackInfo`.
Note
Some functions query the property attributes internally, even though they do not return the attributes. For example, hasOwnProperty() can trigger this interceptor depending on the state of the object.

See also ObjectTemplate::SetHandler.

Definition at line 5914 of file v8.h.

◆ GenericNamedPropertySetterCallback

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().

Parameters
propertyThe name of the property for which the request was intercepted.
valueThe value which the property will have if the request is not intercepted.
infoInformation about the intercepted request, such as isolate, receiver, return value, or whether running in ‘'use strict’mode. SeePropertyCallbackInfo`.

See also ObjectTemplate::SetHandler.

Definition at line 5889 of file v8.h.

◆ Handle

using Handle = Local<T>

Definition at line 337 of file v8.h.

◆ HostCleanupFinalizationGroupCallback

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.

Definition at line 6958 of file v8.h.

◆ HostImportModuleDynamicallyCallback

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.

Definition at line 6981 of file v8.h.

◆ HostInitializeImportMetaObjectCallback

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.

Definition at line 6995 of file v8.h.

◆ IndexedPropertyDefinerCallback

typedef void(* IndexedPropertyDefinerCallback) (uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info)

See v8::GenericNamedPropertyDefinerCallback.

Definition at line 6037 of file v8.h.

◆ IndexedPropertyDeleterCallback

typedef void(* IndexedPropertyDeleterCallback) (uint32_t index, const PropertyCallbackInfo< Boolean > &info)

See v8::GenericNamedPropertyDeleterCallback.

Definition at line 6021 of file v8.h.

◆ IndexedPropertyDescriptorCallback

typedef void(* IndexedPropertyDescriptorCallback) (uint32_t index, const PropertyCallbackInfo< Value > &info)

See v8::GenericNamedPropertyDescriptorCallback.

Definition at line 6044 of file v8.h.

◆ IndexedPropertyEnumeratorCallback

typedef void(* IndexedPropertyEnumeratorCallback) (const PropertyCallbackInfo< Array > &info)

Returns an array containing the indices of the properties the indexed property getter intercepts.

Note: The values in the array must be uint32_t.

Definition at line 6031 of file v8.h.

◆ IndexedPropertyGetterCallback

typedef void(* IndexedPropertyGetterCallback) (uint32_t index, const PropertyCallbackInfo< Value > &info)

See v8::GenericNamedPropertyGetterCallback.

Definition at line 5999 of file v8.h.

◆ IndexedPropertyQueryCallback

typedef void(* IndexedPropertyQueryCallback) (uint32_t index, const PropertyCallbackInfo< Integer > &info)

See v8::GenericNamedPropertyQueryCallback.

Definition at line 6014 of file v8.h.

◆ IndexedPropertySetterCallback

typedef void(* IndexedPropertySetterCallback) (uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)

See v8::GenericNamedPropertySetterCallback.

Definition at line 6006 of file v8.h.

◆ InterruptCallback

typedef void(* InterruptCallback) (Isolate *isolate, void *data)

Definition at line 7279 of file v8.h.

◆ JitCodeEventHandler

typedef void(* JitCodeEventHandler) (const JitCodeEvent *event)

Callback function passed to SetJitCodeEventHandler.

Parameters
eventcode add, move or removal event.

Definition at line 7501 of file v8.h.

◆ LogEventCallback

typedef void(* LogEventCallback) (const char *name, int event)

Definition at line 6892 of file v8.h.

◆ MessageCallback

typedef void(* MessageCallback) (Local< Message > message, Local< Value > data)

Definition at line 6888 of file v8.h.

◆ MicrotaskCallback

typedef void(* MicrotaskCallback) (void *data)

Definition at line 7061 of file v8.h.

◆ MicrotasksCompletedCallback

typedef void(* MicrotasksCompletedCallback) (Isolate *)

Definition at line 7059 of file v8.h.

◆ MicrotasksCompletedCallbackWithData

typedef void(* MicrotasksCompletedCallbackWithData) (Isolate *, void *)

Definition at line 7060 of file v8.h.

◆ ModifyCodeGenerationFromStringsCallback

typedef MaybeLocal<String>(* ModifyCodeGenerationFromStringsCallback) (Local< Context > context, Local< Value > source)

Definition at line 7212 of file v8.h.

◆ NativeObject

using NativeObject = void*

Definition at line 23 of file v8-profiler.h.

◆ NearHeapLimitCallback

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.

Definition at line 7288 of file v8.h.

◆ OOMErrorCallback

typedef void(* OOMErrorCallback) (const char *location, bool is_heap_oom)

Definition at line 6883 of file v8.h.

◆ PersistentContainerValue

typedef uintptr_t PersistentContainerValue

Definition at line 22 of file v8-util.h.

◆ PrepareStackTraceCallback

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

Definition at line 7006 of file v8.h.

◆ PromiseHook

typedef void(* PromiseHook) (PromiseHookType type, Local< Promise > promise, Local< Value > parent)

Definition at line 7028 of file v8.h.

◆ PromiseRejectCallback

typedef void(* PromiseRejectCallback) (PromiseRejectMessage message)

Definition at line 7055 of file v8.h.

◆ ReturnAddressLocationResolver

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.

Parameters
return_addr_locationA location on stack where a machine return address resides.
Returns
Either return_addr_location, or else a pointer to the profiler's copy of the original return address.
Note
The resolver function must not cause garbage collection.

Definition at line 9085 of file v8.h.

◆ SerializeEmbedderFieldsCallback

◆ SnapshotObjectId

using SnapshotObjectId = uint32_t

Definition at line 24 of file v8-profiler.h.

◆ UniquePersistent

Definition at line 804 of file v8.h.

◆ WasmLoadSourceMapCallback

typedef Local<String>(* WasmLoadSourceMapCallback) (Isolate *isolate, const char *name)

Definition at line 7232 of file v8.h.

◆ WasmStreamingCallback

typedef void(* WasmStreamingCallback) (const FunctionCallbackInfo< Value > &)

Definition at line 7226 of file v8.h.

◆ WasmThreadsEnabledCallback

typedef bool(* WasmThreadsEnabledCallback) (Local< Context > context)

Definition at line 7229 of file v8.h.

Enumeration Type Documentation

◆ 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 

Definition at line 3466 of file v8.h.

◆ AccessType

enum AccessType

Access type specification.

Enumerator
ACCESS_GET 
ACCESS_SET 
ACCESS_HAS 
ACCESS_DELETE 
ACCESS_KEYS 

Definition at line 6050 of file v8.h.

◆ ArrayBufferCreationMode

Enumerator
kInternalized 
kExternalized 

Definition at line 4821 of file v8.h.

◆ 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.

◆ ConstructorBehavior

enum ConstructorBehavior
strong
Enumerator
kThrow 
kAllow 

Definition at line 4290 of file v8.h.

◆ CpuProfilingLoggingMode

Enumerator
kLazyLogging 
kEagerLogging 

Definition at line 246 of file v8-profiler.h.

◆ CpuProfilingMode

Enumerator
kLeafNodeLineNumbers 
kCallerLineNumbers 

Definition at line 227 of file v8-profiler.h.

◆ CpuProfilingNamingMode

Enumerator
kStandardNaming 
kDebugNaming 

Definition at line 238 of file v8-profiler.h.

◆ CrashKeyId

enum CrashKeyId
strong
Enumerator
kIsolateAddress 
kReadonlySpaceFirstPageAddress 
kMapSpaceFirstPageAddress 
kCodeSpaceFirstPageAddress 
kDumpType 

Definition at line 6933 of file v8.h.

◆ GCCallbackFlags

GCCallbackFlags is used to notify additional information about the GC callback.

  • kGCCallbackFlagConstructRetainedObjectInfos: The GC callback is for constructing retained object infos.
  • kGCCallbackFlagForced: The GC callback is for a forced GC for testing.
  • kGCCallbackFlagSynchronousPhantomCallbackProcessing: The GC callback is called synchronously without getting posted to an idle task.
  • kGCCallbackFlagCollectAllAvailableGarbage: The GC callback is called in a phase where V8 is trying to collect all available garbage (e.g., handling a low memory notification).
  • kGCCallbackScheduleIdleGarbageCollection: The GC callback is called to trigger an idle garbage collection.
Enumerator
kNoGCCallbackFlags 
kGCCallbackFlagConstructRetainedObjectInfos 
kGCCallbackFlagForced 
kGCCallbackFlagSynchronousPhantomCallbackProcessing 
kGCCallbackFlagCollectAllAvailableGarbage 
kGCCallbackFlagCollectAllExternalMemory 
kGCCallbackScheduleIdleGarbageCollection 

Definition at line 7267 of file v8.h.

◆ GCType

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 

Definition at line 7244 of file v8.h.

◆ IndexFilter

enum IndexFilter
strong

kIncludesIndices allows for integer indices to be collected, while kSkipIndices will exclude integer indices from being collected.

Enumerator
kIncludeIndices 
kSkipIndices 

Definition at line 3514 of file v8.h.

◆ IntegrityLevel

enum IntegrityLevel
strong

Integrity level for objects.

Enumerator
kFrozen 
kSealed 

Definition at line 3525 of file v8.h.

◆ Intrinsic

enum Intrinsic

Definition at line 5723 of file v8.h.

◆ JitCodeEventOptions

Option flags passed to the SetJitCodeEventHandler function.

Enumerator
kJitCodeEventDefault 
kJitCodeEventEnumExisting 

Definition at line 7489 of file v8.h.

◆ KeyCollectionMode

enum KeyCollectionMode
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 

Definition at line 3508 of file v8.h.

◆ KeyConversionMode

enum KeyConversionMode
strong

kConvertToString will convert integer indices to strings. kKeepNumbers will return numbers for integer indices.

Enumerator
kConvertToString 
kKeepNumbers 
kNoNumbers 

Definition at line 3520 of file v8.h.

◆ MeasureMemoryMode

enum MeasureMemoryMode
strong
Enumerator
kSummary 
kDetailed 

Definition at line 7763 of file v8.h.

◆ MemoryPressureLevel

enum MemoryPressureLevel
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 

Definition at line 7539 of file v8.h.

◆ MicrotasksPolicy

enum MicrotasksPolicy
strong

Policy for running microtasks:

  • explicit: microtasks are invoked with Isolate::RunMicrotasks() method;
  • scoped: microtasks invocation is controlled by MicrotasksScope objects;
  • auto: microtasks are invoked when the script call depth decrements to zero.
Enumerator
kExplicit 
kScoped 
kAuto 

Definition at line 7071 of file v8.h.

◆ NewStringType

enum NewStringType
strong

A flag describing different modes of string creation.

Aside from performance implications there are no differences between the two creation modes.

Enumerator
kNormal 

Create a new string, always allocating new storage memory.

kInternalized 

Acts as a hint that the string should be created in the old generation heap space and be deduplicated if an identical string already exists.

Definition at line 2839 of file v8.h.

◆ PersistentContainerCallbackType

Enumerator
kNotWeak 
kWeakWithParameter 
kWeakWithInternalFields 

Definition at line 24 of file v8-util.h.

◆ PromiseHookType

enum PromiseHookType
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 

Definition at line 7026 of file v8.h.

◆ PromiseRejectEvent

Enumerator
kPromiseRejectWithNoHandler 
kPromiseHandlerAddedAfterReject 
kPromiseRejectAfterResolved 
kPromiseResolveAfterResolved 

Definition at line 7032 of file v8.h.

◆ PropertyAttribute

PropertyAttribute.

Enumerator
None 

None.

ReadOnly 

ReadOnly, i.e., not writable.

DontEnum 

DontEnum, i.e., not enumerable.

DontDelete 

DontDelete, i.e., not configurable.

Definition at line 3423 of file v8.h.

◆ PropertyFilter

Property filter bits. They can be or'ed to build a composite filter.

Enumerator
ALL_PROPERTIES 
ONLY_WRITABLE 
ONLY_ENUMERABLE 
ONLY_CONFIGURABLE 
SKIP_STRINGS 
SKIP_SYMBOLS 

Definition at line 3476 of file v8.h.

◆ PropertyHandlerFlags

enum PropertyHandlerFlags
strong

Configuration flags for v8::NamedPropertyHandlerConfiguration or v8::IndexedPropertyHandlerConfiguration.

Enumerator
kNone 

None.

kAllCanRead 

See ALL_CAN_READ above.

kNonMasking 

Will not call into interceptor for properties on the receiver or prototype chain, i.e., only call into interceptor for properties that do not exist. Currently only valid for named interceptors.

kOnlyInterceptStrings 

Will not call into interceptor for symbol lookup. Only meaningful for named interceptors.

kHasNoSideEffect 

The getter, query, enumerator callbacks do not produce side effects.

Definition at line 6285 of file v8.h.

◆ RAILMode

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 

Definition at line 7469 of file v8.h.

◆ SideEffectType

enum SideEffectType
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 

Definition at line 3495 of file v8.h.

◆ StateTag

enum StateTag
Enumerator
JS 
GC 
PARSER 
BYTECODE_COMPILER 
COMPILER 
OTHER 
EXTERNAL 
IDLE 

Definition at line 2152 of file v8.h.

◆ WeakCallbackType

enum WeakCallbackType
strong
Enumerator
kParameter 
kInternalFields 
kFinalizer 

Definition at line 455 of file v8.h.

Function Documentation

◆ CurrentValueSerializerFormatVersion()

constexpr uint32_t v8::CurrentValueSerializerFormatVersion ( )
constexpr

Definition at line 20 of file v8-value-serializer-version.h.

◆ False()

Local< Boolean > False ( Isolate isolate)

Definition at line 11388 of file v8.h.

◆ Just()

Maybe<T> v8::Just ( const T &  t)
inline

Definition at line 9512 of file v8.h.

References V8::Maybe.

◆ JustVoid()

Maybe<void> v8::JustVoid ( )
inline

Definition at line 9544 of file v8.h.

◆ Nothing()

Maybe<T> v8::Nothing ( )
inline

Definition at line 9507 of file v8.h.

◆ Null()

Local< Primitive > Null ( Isolate isolate)

Definition at line 11370 of file v8.h.

◆ RegisterExtension()

void V8_EXPORT v8::RegisterExtension ( std::unique_ptr< Extension )

◆ True()

Local< Boolean > True ( Isolate isolate)

Definition at line 11379 of file v8.h.

◆ TryHandleWebAssemblyTrapPosix()

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.

Parameters
sig_codeThe signal code, e.g. SIGSEGV.
infoA pointer to the siginfo_t struct provided to the signal handler.
contextA pointer to a ucontext_t struct provided to the signal handler.

◆ TryHandleWebAssemblyTrapWindows()

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.

Parameters
exceptionAn EXCEPTION_POINTERS* as provided to the exception handler.

◆ Undefined()

Local< Primitive > Undefined ( Isolate isolate)

Definition at line 11361 of file v8.h.