v8  8.6.395 (node 15.0.1)
V8 is Google's open source JavaScript engine
V8 Class Reference

#include <v8.h>

Static Public Member Functions

static void SetSnapshotDataBlob (StartupData *startup_blob)
static void SetDcheckErrorHandler (DcheckErrorCallback that)
static void SetFlagsFromString (const char *str)
static void SetFlagsFromString (const char *str, size_t length)
static void SetFlagsFromCommandLine (int *argc, char **argv, bool remove_flags)
static const char * GetVersion ()
static V8_INLINE bool Initialize ()
static void SetEntropySource (EntropySource source)
static void SetReturnAddressLocationResolver (ReturnAddressLocationResolver return_address_resolver)
static bool Dispose ()
static bool InitializeICU (const char *icu_data_file=nullptr)
static bool InitializeICUDefaultLocation (const char *exec_path, const char *icu_data_file=nullptr)
static void InitializeExternalStartupData (const char *directory_path)
static void InitializeExternalStartupDataFromFile (const char *snapshot_blob)
static void InitializePlatform (Platform *platform)
static void ShutdownPlatform ()
static bool EnableWebAssemblyTrapHandler (bool use_v8_signal_handler)
static void GetSharedMemoryStatistics (SharedMemoryStatistics *statistics)


template<class K , class V , class T >
class PersistentValueMapBase
template<class T >
class Global
template<class T >
class Local
template<class T >
class MaybeLocal
template<class T >
class Maybe
template<class T >
class TracedReferenceBase
template<class T >
class TracedGlobal
template<class T >
class TracedReference
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 9606 of file v8.h.

Member Function Documentation

◆ Dispose()

static bool Dispose ( )

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.

◆ EnableWebAssemblyTrapHandler()

static bool EnableWebAssemblyTrapHandler ( bool  use_v8_signal_handler)

Activate trap-based bounds checking for WebAssembly.

use_v8_signal_handlerWhether V8 should install its own signal handler or rely on the embedder's.

◆ GetSharedMemoryStatistics()

static void GetSharedMemoryStatistics ( SharedMemoryStatistics statistics)

Get statistics about the shared memory usage.

◆ GetVersion()

static const char* GetVersion ( )

Get the version string.

◆ Initialize()

static V8_INLINE bool Initialize ( )

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

Definition at line 9649 of file v8.h.

References v8::internal::HeapSandboxIsEnabled(), v8::internal::PointerCompressionIsEnabled(), and v8::internal::SmiValuesAre31Bits().

◆ InitializeExternalStartupData()

static void InitializeExternalStartupData ( const char *  directory_path)

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:

◆ InitializeExternalStartupDataFromFile()

static void InitializeExternalStartupDataFromFile ( const char *  snapshot_blob)

◆ InitializeICU()

static bool InitializeICU ( const 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.

◆ InitializeICUDefaultLocation()

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

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)

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

◆ SetDcheckErrorHandler()

static void SetDcheckErrorHandler ( DcheckErrorCallback  that)

Set the callback to invoke in case of Dcheck failures.

◆ SetEntropySource()

static void SetEntropySource ( EntropySource  source)

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 

Sets V8 flags from the command line.

◆ SetFlagsFromString() [1/2]

static void SetFlagsFromString ( const char *  str)

Sets V8 flags from a string.

◆ SetFlagsFromString() [2/2]

static void SetFlagsFromString ( const char *  str,
size_t  length 

◆ SetReturnAddressLocationResolver()

static void SetReturnAddressLocationResolver ( ReturnAddressLocationResolver  return_address_resolver)

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)

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


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

◆ ShutdownPlatform()

static void ShutdownPlatform ( )

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

Friends And Related Function Documentation

◆ Context

friend class Context

Definition at line 9852 of file v8.h.

◆ Eternal

friend class Eternal

Definition at line 9849 of file v8.h.

◆ Global

friend class Global

Definition at line 9835 of file v8.h.

◆ Local

friend class Local

Definition at line 9836 of file v8.h.

◆ Maybe

friend class Maybe

Definition at line 9840 of file v8.h.

Referenced by v8::Just().

◆ MaybeLocal

friend class MaybeLocal

Definition at line 9838 of file v8.h.

◆ Persistent

friend class Persistent

Persistent is a way to create a strong pointer from an off-heap object to another on-heap object. As long as the Persistent handle is alive the GC will keep the object pointed to alive. The Persistent handle is always a GC root from the point of view of the GC. Persistent must be constructed and destructed in the same thread.

Definition at line 9851 of file v8.h.

◆ PersistentBase

friend class PersistentBase

Definition at line 9850 of file v8.h.

◆ PersistentValueMapBase

friend class PersistentValueMapBase

Definition at line 9829 of file v8.h.

◆ TracedGlobal

friend class TracedGlobal

Definition at line 9844 of file v8.h.

◆ TracedReference

friend class TracedReference

Definition at line 9846 of file v8.h.

◆ TracedReferenceBase

friend class TracedReferenceBase

Definition at line 9842 of file v8.h.

◆ WeakCallbackInfo

friend class WeakCallbackInfo

Definition at line 9848 of file v8.h.

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