V8
Static Public Member Functions | Friends | List of all members
v8::V8 Class Reference

#include <v8.h>

Static Public Member Functions

static V8_INLINE void SetFatalErrorHandler (FatalErrorCallback that)
static V8_INLINE void SetAllowCodeGenerationFromStringsCallback (AllowCodeGenerationFromStringsCallback that)
static void SetArrayBufferAllocator (ArrayBuffer::Allocator *allocator)
static V8_INLINE bool IsDead ()
static
StartupData::CompressionAlgorithm 
GetCompressedStartupDataAlgorithm ()
static int GetCompressedStartupDataCount ()
static void GetCompressedStartupData (StartupData *compressed_data)
static void SetDecompressedStartupData (StartupData *decompressed_data)
static void SetNativesDataBlob (StartupData *startup_blob)
static void SetSnapshotDataBlob (StartupData *startup_blob)
static V8_INLINE bool AddMessageListener (MessageCallback that, Handle< Value > data=Handle< Value >())
static V8_INLINE void RemoveMessageListeners (MessageCallback that)
static V8_INLINE 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 void SetFailedAccessCheckCallbackFunction (FailedAccessCheckCallback)
static void AddGCPrologueCallback (GCPrologueCallback callback, GCType gc_type_filter=kGCTypeAll)
static V8_INLINE void RemoveGCPrologueCallback (GCPrologueCallback callback)
static void AddGCEpilogueCallback (GCEpilogueCallback callback, GCType gc_type_filter=kGCTypeAll)
static V8_INLINE void RemoveGCEpilogueCallback (GCEpilogueCallback callback)
static V8_INLINE void AddMemoryAllocationCallback (MemoryAllocationCallback callback, ObjectSpace space, AllocationAction action)
static V8_INLINE void RemoveMemoryAllocationCallback (MemoryAllocationCallback callback)
static bool Initialize ()
static void SetEntropySource (EntropySource source)
static void SetReturnAddressLocationResolver (ReturnAddressLocationResolver return_address_resolver)
static V8_INLINE void TerminateExecution (Isolate *isolate)
static V8_INLINE bool IsExecutionTerminating (Isolate *isolate=NULL)
static V8_INLINE void CancelTerminateExecution (Isolate *isolate)
static bool Dispose ()
static V8_INLINE void VisitExternalResources (ExternalResourceVisitor *visitor)
static V8_INLINE void VisitHandlesWithClassIds (PersistentHandleVisitor *visitor)
static V8_INLINE void VisitHandlesWithClassIds (Isolate *isolate, PersistentHandleVisitor *visitor)
static V8_INLINE void VisitHandlesForPartialDependence (Isolate *isolate, PersistentHandleVisitor *visitor)
static bool InitializeICU (const char *icu_data_file=NULL)
static void InitializePlatform (Platform *platform)
static void ShutdownPlatform ()

Friends

class Handle
class Local
class Eternal
class PersistentBase
class Persistent
class Context

Detailed Description

Container class for static utility functions.

Member Function Documentation

static void v8::V8::AddGCEpilogueCallback ( GCEpilogueCallback  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.

static void v8::V8::AddGCPrologueCallback ( GCPrologueCallback  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.

void v8::V8::AddMemoryAllocationCallback ( MemoryAllocationCallback  callback,
ObjectSpace  space,
AllocationAction  action 
)
static

Enables the host application to provide a mechanism to be notified and perform custom logging when V8 Allocates Executable Memory.

References v8::Isolate::AddMemoryAllocationCallback(), and v8::Isolate::GetCurrent().

bool v8::V8::AddMessageListener ( MessageCallback  that,
Handle< Value data = Handle<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.

References v8::Isolate::AddMessageListener(), and v8::Isolate::GetCurrent().

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

References v8::Isolate::CancelTerminateExecution().

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

static StartupData::CompressionAlgorithm v8::V8::GetCompressedStartupDataAlgorithm ( )
static

The following 4 functions are to be used when V8 is built with the 'compress_startup_data' flag enabled. In this case, the embedder must decompress startup data prior to initializing V8.

This is how interaction with V8 should look like: int compressed_data_count = v8::V8::GetCompressedStartupDataCount(); v8::StartupData* compressed_data = new v8::StartupData[compressed_data_count]; v8::V8::GetCompressedStartupData(compressed_data); ... decompress data (compressed_data can be updated in-place) ... v8::V8::SetDecompressedStartupData(compressed_data); ... now V8 can be initialized ... make sure the decompressed data stays valid until V8 shutdown

A helper class StartupDataDecompressor is provided. It implements the protocol of the interaction described above, and can be used in most cases instead of calling these API functions directly.

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

Get the version string.

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

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

static bool v8::V8::InitializeICU ( const char *  icu_data_file = NULL)
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.

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

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

bool v8::V8::IsDead ( )
static

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

References v8::Isolate::GetCurrent(), and v8::Isolate::IsDead().

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

References v8::Isolate::GetCurrent(), and v8::Isolate::IsExecutionTerminating().

void v8::V8::RemoveGCEpilogueCallback ( GCEpilogueCallback  callback)
static

This function removes callback which was installed by AddGCEpilogueCallback function.

References v8::Isolate::GetCurrent(), and v8::Isolate::RemoveGCEpilogueCallback().

void v8::V8::RemoveGCPrologueCallback ( GCPrologueCallback  callback)
static

This function removes callback which was installed by AddGCPrologueCallback function.

References v8::Isolate::GetCurrent(), and v8::Isolate::RemoveGCPrologueCallback().

void v8::V8::RemoveMemoryAllocationCallback ( MemoryAllocationCallback  callback)
static

Removes callback that was installed by AddMemoryAllocationCallback.

References v8::Isolate::GetCurrent(), and v8::Isolate::RemoveMemoryAllocationCallback().

void v8::V8::RemoveMessageListeners ( MessageCallback  that)
static

Remove all message listeners from the specified callback function.

References v8::Isolate::GetCurrent(), and v8::Isolate::RemoveMessageListeners().

void v8::V8::SetAllowCodeGenerationFromStringsCallback ( AllowCodeGenerationFromStringsCallback  that)
static

Set the callback to invoke to check if code generation from strings should be allowed.

References v8::Isolate::GetCurrent(), and v8::Isolate::SetAllowCodeGenerationFromStringsCallback().

static void v8::V8::SetArrayBufferAllocator ( ArrayBuffer::Allocator allocator)
static

Set allocator to use for ArrayBuffer memory. The allocator should be set only once. The allocator should be set before any code tha uses ArrayBuffers is executed. This allocator is used in all isolates.

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

References v8::Isolate::GetCurrent(), and v8::Isolate::SetCaptureStackTraceForUncaughtExceptions().

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

void v8::V8::SetFailedAccessCheckCallbackFunction ( FailedAccessCheckCallback  callback)
static

Callback function for reporting failed access checks.

References v8::Isolate::GetCurrent(), and v8::Isolate::SetFailedAccessCheckCallbackFunction().

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

Set the callback to invoke in case of fatal errors.

References v8::Isolate::GetCurrent(), and v8::Isolate::SetFatalErrorHandler().

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

Sets V8 flags from the command line.

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

Sets V8 flags from a string.

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

static void v8::V8::ShutdownPlatform ( )
static

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

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

References v8::Isolate::TerminateExecution().

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

References v8::Isolate::GetCurrent(), and v8::Isolate::VisitExternalResources().

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

References v8::Isolate::VisitHandlesForPartialDependence().

void v8::V8::VisitHandlesWithClassIds ( PersistentHandleVisitor visitor)
static

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

References v8::Isolate::GetCurrent(), and v8::Isolate::VisitHandlesWithClassIds().

void v8::V8::VisitHandlesWithClassIds ( Isolate isolate,
PersistentHandleVisitor visitor 
)
static

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

References v8::Isolate::VisitHandlesWithClassIds().


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