v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8::V8 Class Reference

#include <v8-initialization.h>

Collaboration diagram for v8::V8:

Static Public Member Functions

static void SetSnapshotDataBlob (StartupData *startup_blob)
 
static void SetDcheckErrorHandler (DcheckErrorCallback that)
 
static void SetFatalErrorHandler (V8FatalErrorCallback 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 DisposePlatform ()
 
static bool EnableWebAssemblyTrapHandler (bool use_v8_signal_handler)
 
static void SetFatalMemoryErrorCallback (OOMErrorCallback callback)
 
static void GetSharedMemoryStatistics (SharedMemoryStatistics *statistics)
 

Private Types

enum  BuildConfigurationFeatures {
  kPointerCompression = 1 << 0 , k31BitSmis = 1 << 1 , kSandbox = 1 << 2 , kTargetOsIsAndroid = 1 << 3 ,
  kEnableChecks = 1 << 4
}
 

Private Member Functions

 V8 ()
 

Static Private Member Functions

static bool Initialize (int build_config)
 

Friends

class Context
 
template<class K , class V , class T >
class PersistentValueMapBase
 

Detailed Description

Container class for static utility functions.

Definition at line 61 of file v8-initialization.h.

Member Enumeration Documentation

◆ BuildConfigurationFeatures

Enumerator
kPointerCompression 
k31BitSmis 
kSandbox 
kTargetOsIsAndroid 
kEnableChecks 

Definition at line 293 of file v8-initialization.h.

Constructor & Destructor Documentation

◆ V8()

v8::V8::V8 ( )
private

Member Function Documentation

◆ Dispose()

bool v8::V8::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.

Definition at line 6513 of file api.cc.

Here is the caller graph for this function:

◆ DisposePlatform()

void v8::V8::DisposePlatform ( )
static

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

Definition at line 6389 of file api.cc.

Here is the caller graph for this function:

◆ EnableWebAssemblyTrapHandler()

bool v8::V8::EnableWebAssemblyTrapHandler ( bool use_v8_signal_handler)
static

Activate trap-based bounds checking for WebAssembly.

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

Definition at line 6479 of file api.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetSharedMemoryStatistics()

void v8::V8::GetSharedMemoryStatistics ( SharedMemoryStatistics * statistics)
static

Get statistics about the shared memory usage.

Definition at line 6609 of file api.cc.

◆ GetVersion()

const char * v8::V8::GetVersion ( )
static

Get the version string.

Definition at line 6574 of file api.cc.

Here is the caller graph for this function:

◆ Initialize() [1/2]

static V8_INLINE bool v8::V8::Initialize ( )
inlinestatic

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

Definition at line 108 of file v8-initialization.h.

Here is the caller graph for this function:

◆ Initialize() [2/2]

bool v8::V8::Initialize ( int build_config)
staticprivate

Checks that the embedder build configuration is compatible with the V8 binary and if so initializes V8.

Definition at line 6391 of file api.cc.

Here is the call graph for this function:

◆ InitializeExternalStartupData()

void v8::V8::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:

Definition at line 6565 of file api.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeExternalStartupDataFromFile()

void v8::V8::InitializeExternalStartupDataFromFile ( const char * snapshot_blob)
static

Definition at line 6570 of file api.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeICU()

bool v8::V8::InitializeICU ( 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. 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.

Definition at line 6556 of file api.cc.

Here is the call graph for this function:

◆ InitializeICUDefaultLocation()

bool v8::V8::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.

Definition at line 6560 of file api.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializePlatform()

void v8::V8::InitializePlatform ( Platform * platform)
static

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

Definition at line 6385 of file api.cc.

Here is the caller graph for this function:

◆ SetDcheckErrorHandler()

void v8::V8::SetDcheckErrorHandler ( DcheckErrorCallback that)
static

Set the callback to invoke in case of Dcheck failures.

Definition at line 424 of file api.cc.

Here is the call graph for this function:

◆ SetEntropySource()

void v8::V8::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.

Definition at line 6504 of file api.cc.

Here is the call graph for this function:

◆ SetFatalErrorHandler()

void v8::V8::SetFatalErrorHandler ( V8FatalErrorCallback that)
static

Set the callback to invoke in the case of CHECK failures or fatal errors. This is distinct from Isolate::SetFatalErrorHandler, which is invoked in response to API usage failures.

Definition at line 428 of file api.cc.

Here is the call graph for this function:

◆ SetFatalMemoryErrorCallback()

void v8::V8::SetFatalMemoryErrorCallback ( v8::OOMErrorCallback oom_error_callback)
static

Allows the host application to provide a callback that will be called when v8 has encountered a fatal failure to allocate memory and is about to terminate.

Definition at line 6499 of file api.cc.

◆ SetFlagsFromCommandLine()

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

Sets V8 flags from the command line.

Definition at line 440 of file api.cc.

◆ SetFlagsFromString() [1/2]

void v8::V8::SetFlagsFromString ( const char * str)
static

Sets V8 flags from a string.

Definition at line 432 of file api.cc.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ SetFlagsFromString() [2/2]

void v8::V8::SetFlagsFromString ( const char * str,
size_t length )
static

Definition at line 436 of file api.cc.

◆ SetReturnAddressLocationResolver()

void v8::V8::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.

Definition at line 6508 of file api.cc.

◆ SetSnapshotDataBlob()

void v8::V8::SetSnapshotDataBlob ( 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.

Definition at line 295 of file api.cc.

Friends And Related Symbol Documentation

◆ Context

friend class Context
friend

Definition at line 307 of file v8-initialization.h.

◆ PersistentValueMapBase

template<class K , class V , class T >
friend class PersistentValueMapBase
friend

Definition at line 309 of file v8-initialization.h.


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