v8  3.14.5(node0.10.28)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Isolate Class Reference

#include <v8.h>

Data Structures

class  Scope
 

Public Member Functions

void Enter ()
 
void Exit ()
 
void Dispose ()
 
void SetData (void *data)
 
void * GetData ()
 

Static Public Member Functions

static IsolateNew ()
 
static IsolateGetCurrent ()
 

Detailed Description

Isolate represents an isolated instance of the V8 engine. V8 isolates have completely separate states. Objects from one isolate must not be used in other isolates. When V8 is initialized a default isolate is implicitly created and entered. The embedder can create additional isolates and use them in parallel in multiple threads. An isolate can be entered by at most one thread at any given time. The Locker/Unlocker API must be used to synchronize.

Definition at line 2807 of file v8.h.

Member Function Documentation

void Dispose ( )

Disposes the isolate. The isolate must not be entered by any thread to be disposable.

Definition at line 5532 of file api.cc.

References Isolate::IsInUse(), and Isolate::TearDown().

Referenced by KangarooThread::Run(), IsolateNonlockingThread::Run(), IsolateGenesisThread::Run(), and TEST().

void Enter ( )

Methods below this point require holding a lock (using Locker) in a multi-threaded environment. Sets this isolate as the entered one for the current thread. Saves the previously entered one (if any), so that it can be restored when exiting. Re-entering an isolate is allowed.

Definition at line 5543 of file api.cc.

Referenced by LockerUnlockerThread::Run(), LockTwiceAndUnlockThread::Run(), Isolate::Scope::Scope(), and TEST().

void Exit ( )

Exits this isolate by restoring the previously entered one in the current thread. The isolate may still stay the same, if it was entered more than once.

Requires: this == Isolate::GetCurrent().

Definition at line 5549 of file api.cc.

Referenced by LockerUnlockerThread::Run(), LockTwiceAndUnlockThread::Run(), and TEST().

Isolate * GetCurrent ( )
static

Returns the entered isolate for the current thread or NULL in case there is no current isolate.

Definition at line 5520 of file api.cc.

Referenced by ReadLineEditor::Prompt(), Shell::ReadFromStdin(), Shell::RunMain(), TEST(), and THREADED_TEST().

void * GetData ( )
inline

Retrieve embedder-specific data from the isolate. Returns NULL if SetData has never been called.

Definition at line 4675 of file v8.h.

References I.

Referenced by TEST().

Isolate * New ( )
static

Creates a new isolate. Does not change the currently entered isolate.

When an isolate is no longer used its resources should be freed by calling Dispose(). Using the delete operator is not allowed.

Definition at line 5526 of file api.cc.

Referenced by IsolateNonlockingThread::Run(), IsolateGenesisThread::Run(), and TEST().

void SetData ( void *  data)
inline

Associate embedder-specific data with the isolate

Definition at line 4669 of file v8.h.

References I.

Referenced by TEST().


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