v8  6.2.414 (node 8.16.2)
V8 is Google's open source JavaScript engine
V8 Class Reference

#include <v8.h>

Public Member Functions

 V8_DEPRECATE_SOON ("Use version with default location.", static bool InitializeICU(const char *icu_data_file=nullptr))
 

Static Public Member Functions

static V8_INLINE V8_DEPRECATED ("Use isolate version", void SetFatalErrorHandler(FatalErrorCallback that))
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", bool IsDead())
 
static void SetNativesDataBlob (StartupData *startup_blob)
 
static void SetSnapshotDataBlob (StartupData *startup_blob)
 
static StartupData CreateSnapshotDataBlob (const char *embedded_source=NULL)
 
static StartupData WarmUpSnapshotDataBlob (StartupData cold_startup_blob, const char *warmup_source)
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", bool AddMessageListener(MessageCallback that, Local< Value > data=Local< Value >()))
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", void RemoveMessageListeners(MessageCallback that))
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", void SetCaptureStackTraceForUncaughtExceptions(bool capture, int frame_limit=10, StackTrace::StackTraceOptions options=StackTrace::kOverview))
 
static void SetFlagsFromString (const char *str, int length)
 
static void SetFlagsFromCommandLine (int *argc, char **argv, bool remove_flags)
 
static const char * GetVersion ()
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback))
 
static V8_DEPRECATED ("Use isolate version", void AddGCPrologueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll))
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", void RemoveGCPrologueCallback(GCCallback callback))
 
static V8_DEPRECATED ("Use isolate version", void AddGCEpilogueCallback(GCCallback callback, GCType gc_type_filter=kGCTypeAll))
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", void RemoveGCEpilogueCallback(GCCallback callback))
 
static bool Initialize ()
 
static void SetEntropySource (EntropySource source)
 
static void SetReturnAddressLocationResolver (ReturnAddressLocationResolver return_address_resolver)
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", void TerminateExecution(Isolate *isolate))
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", bool IsExecutionTerminating(Isolate *isolate=NULL))
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", void CancelTerminateExecution(Isolate *isolate))
 
static bool Dispose ()
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", void VisitExternalResources(ExternalResourceVisitor *visitor))
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", void VisitHandlesWithClassIds(PersistentHandleVisitor *visitor))
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", void VisitHandlesWithClassIds(Isolate *isolate, PersistentHandleVisitor *visitor))
 
static V8_INLINE V8_DEPRECATED ("Use isolate version", void VisitHandlesForPartialDependence(Isolate *isolate, PersistentHandleVisitor *visitor))
 
static bool InitializeICUDefaultLocation (const char *exec_path, const char *icu_data_file=nullptr)
 
static void InitializeExternalStartupData (const char *directory_path)
 
static void InitializeExternalStartupData (const char *natives_blob, const char *snapshot_blob)
 
static void InitializePlatform (Platform *platform)
 
static void ShutdownPlatform ()
 
static bool RegisterDefaultSignalHandler ()
 

Friends

template<class K , class V , class T >
class PersistentValueMapBase
 
template<class T >
class Local
 
template<class T >
class MaybeLocal
 
template<class T >
class Maybe
 
template<class T >
class WeakCallbackInfo
 
template<class T >
class Eternal
 
template<class T >
class PersistentBase
 
template<class T , class M >
class Persistent
 
class Context
 

Detailed Description

Container class for static utility functions.

Definition at line 7778 of file v8.h.

Member Function Documentation

◆ CreateSnapshotDataBlob()

static StartupData CreateSnapshotDataBlob ( const char *  embedded_source = NULL)
static

Bootstrap an isolate and a context from scratch to create a startup snapshot. Include the side-effects of running the optional script. Returns { NULL, 0 } on failure. The caller acquires ownership of the data array in the return value.

◆ Dispose()

static bool Dispose ( )
static

Releases any resources used by v8 and stops any utility threads that may be running. Note that disposing v8 is permanent, it cannot be reinitialized.

It should generally not be necessary to dispose v8 before exiting a process, this should happen automatically. It is only necessary to use if the process needs the resources taken up by v8.

◆ GetVersion()

static const char* GetVersion ( )
static

Get the version string.

◆ Initialize()

static bool Initialize ( )
static

Initializes V8. This function needs to be called before the first Isolate is created. It always returns true.

◆ InitializeExternalStartupData() [1/2]

static void InitializeExternalStartupData ( const char *  directory_path)
static

Initialize the external startup data. The embedder only needs to invoke this method when external startup data was enabled in a build.

If V8 was compiled with the startup data in an external file, then V8 needs to be given those external files during startup. There are three ways to do this:

◆ InitializeExternalStartupData() [2/2]

static void InitializeExternalStartupData ( const char *  natives_blob,
const char *  snapshot_blob 
)
static

◆ InitializeICUDefaultLocation()

static bool InitializeICUDefaultLocation ( const char *  exec_path,
const char *  icu_data_file = nullptr 
)
static

Initialize the ICU library bundled with V8. The embedder should only invoke this method when using the bundled ICU. If V8 was compiled with the ICU data in an external file and when the default location of that file should be used, a path to the executable must be provided. Returns true on success.

The default is a file called icudtl.dat side-by-side with the executable.

Optionally, the location of the data file can be provided to override the default.

◆ InitializePlatform()

static void InitializePlatform ( Platform platform)
static

Sets the v8::Platform to use. This should be invoked before V8 is initialized.

◆ RegisterDefaultSignalHandler()

static bool RegisterDefaultSignalHandler ( )
static

Enable the default signal handler rather than using one provided by the embedder.

◆ SetEntropySource()

static void SetEntropySource ( EntropySource  source)
static

Allows the host application to provide a callback which can be used as a source of entropy for random number generators.

◆ SetFlagsFromCommandLine()

static void SetFlagsFromCommandLine ( int *  argc,
char **  argv,
bool  remove_flags 
)
static

Sets V8 flags from the command line.

◆ SetFlagsFromString()

static void SetFlagsFromString ( const char *  str,
int  length 
)
static

Sets V8 flags from a string.

◆ SetNativesDataBlob()

static void SetNativesDataBlob ( StartupData startup_blob)
static

Hand startup data to V8, in case the embedder has chosen to build V8 with external startup data.

Note:

  • By default the startup data is linked into the V8 library, in which case this function is not meaningful.
  • If this needs to be called, it needs to be called before V8 tries to make use of its built-ins.
  • To avoid unnecessary copies of data, V8 will point directly into the given data blob, so pretty please keep it around until V8 exit.
  • Compression of the startup blob might be useful, but needs to handled entirely on the embedders' side.
  • The call will abort if the data is invalid.

◆ SetReturnAddressLocationResolver()

static void SetReturnAddressLocationResolver ( ReturnAddressLocationResolver  return_address_resolver)
static

Allows the host application to provide a callback that allows v8 to cooperate with a profiler that rewrites return addresses on stack.

◆ SetSnapshotDataBlob()

static void SetSnapshotDataBlob ( StartupData startup_blob)
static

◆ ShutdownPlatform()

static void ShutdownPlatform ( )
static

Clears all references to the v8::Platform. This should be invoked after V8 was disposed.

◆ V8_DEPRECATE_SOON()

V8_DEPRECATE_SOON ( "Use version with default location."  ,
static bool   InitializeICUconst char *icu_data_file=nullptr 
)

Initialize the ICU library bundled with V8. The embedder should only invoke this method when using the bundled ICU. Returns true on success.

If V8 was compiled with the ICU data in an external file, the location of the data file has to be provided.

◆ V8_DEPRECATED() [1/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
bool   AddMessageListenerMessageCallback that, Local< Value > data=Local< Value >() 
)
static

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.

◆ V8_DEPRECATED() [2/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
bool   IsDead() 
)
static

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

◆ V8_DEPRECATED() [3/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
bool   IsExecutionTerminatingIsolate *isolate=NULL 
)
static

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.

Parameters
isolateThe isolate in which to check.

◆ V8_DEPRECATED() [4/17]

static V8_DEPRECATED ( "Use isolate version"  ,
void   AddGCEpilogueCallbackGCCallback callback, GCType gc_type_filter=kGCTypeAll 
)
static

Enables the host application to receive a notification after a garbage collection. Allocations are not allowed in the callback function, you therefore cannot manipulate objects (set or delete properties for example) since it is possible such operations will result in the allocation of objects. It is possible to specify the GCType filter for your callback. But it is not possible to register the same callback function two times with different GCType filters.

◆ V8_DEPRECATED() [5/17]

static V8_DEPRECATED ( "Use isolate version"  ,
void   AddGCPrologueCallbackGCCallback callback, GCType gc_type_filter=kGCTypeAll 
)
static

Enables the host application to receive a notification before a garbage collection. Allocations are not allowed in the callback function, you therefore cannot manipulate objects (set or delete properties for example) since it is possible such operations will result in the allocation of objects. It is possible to specify the GCType filter for your callback. But it is not possible to register the same callback function two times with different GCType filters.

◆ V8_DEPRECATED() [6/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   CancelTerminateExecutionIsolate *isolate 
)
static

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.

Parameters
isolateThe isolate in which to resume execution capability.

◆ V8_DEPRECATED() [7/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   RemoveGCEpilogueCallbackGCCallback callback 
)
static

This function removes callback which was installed by AddGCEpilogueCallback function.

◆ V8_DEPRECATED() [8/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   RemoveGCPrologueCallbackGCCallback callback 
)
static

This function removes callback which was installed by AddGCPrologueCallback function.

◆ V8_DEPRECATED() [9/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   RemoveMessageListenersMessageCallback that 
)
static

Remove all message listeners from the specified callback function.

◆ V8_DEPRECATED() [10/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   SetCaptureStackTraceForUncaughtExceptionsbool capture, int frame_limit=10, StackTrace::StackTraceOptions options=StackTrace::kOverview 
)
static

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

◆ V8_DEPRECATED() [11/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   SetFailedAccessCheckCallbackFunctionFailedAccessCheckCallback 
)
static

Callback function for reporting failed access checks.

◆ V8_DEPRECATED() [12/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   SetFatalErrorHandlerFatalErrorCallback that 
)
static

Set the callback to invoke in case of fatal errors.

◆ V8_DEPRECATED() [13/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   TerminateExecutionIsolate *isolate 
)
static

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.

Parameters
isolateThe isolate in which to terminate the current JS execution.

◆ V8_DEPRECATED() [14/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   VisitExternalResourcesExternalResourceVisitor *visitor 
)
static

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

◆ V8_DEPRECATED() [15/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   VisitHandlesForPartialDependenceIsolate *isolate, PersistentHandleVisitor *visitor 
)
static

Iterates through all the persistent handles in the current isolate's heap that have class_ids and are candidates to be marked as partially dependent handles. This will visit handles to young objects created since the last garbage collection but is free to visit an arbitrary superset of these objects.

◆ V8_DEPRECATED() [16/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   VisitHandlesWithClassIdsIsolate *isolate, PersistentHandleVisitor *visitor 
)
static

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

◆ V8_DEPRECATED() [17/17]

static V8_INLINE V8_DEPRECATED ( "Use isolate version"  ,
void   VisitHandlesWithClassIdsPersistentHandleVisitor *visitor 
)
static

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

◆ WarmUpSnapshotDataBlob()

static StartupData WarmUpSnapshotDataBlob ( StartupData  cold_startup_blob,
const char *  warmup_source 
)
static

Bootstrap an isolate and a context from the cold startup blob, run the warm-up script to trigger code compilation. The side effects are then discarded. The resulting startup snapshot will include compiled code. Returns { NULL, 0 } on failure. The caller acquires ownership of the data array in the return value. The argument startup blob is untouched.

Friends And Related Function Documentation

◆ Context

friend class Context
friend

Definition at line 8162 of file v8.h.

◆ Eternal

friend class Eternal
friend

Definition at line 8159 of file v8.h.

◆ Local

friend class Local
friend

Definition at line 8152 of file v8.h.

◆ Maybe

friend class Maybe
friend

Definition at line 8156 of file v8.h.

Referenced by v8::Just().

◆ MaybeLocal

friend class MaybeLocal
friend

Definition at line 8154 of file v8.h.

◆ Persistent

friend class Persistent
friend

Definition at line 8161 of file v8.h.

◆ PersistentBase

friend class PersistentBase
friend

Definition at line 8160 of file v8.h.

◆ PersistentValueMapBase

friend class PersistentValueMapBase
friend

Definition at line 8147 of file v8.h.

◆ WeakCallbackInfo

friend class WeakCallbackInfo
friend

Definition at line 8158 of file v8.h.


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