V8 Project
v8::Isolate Class Reference

Isolate represents an isolated instance of the V8 engine. More...

#include <v8.h>

+ Collaboration diagram for v8::Isolate:

Classes

class  AllowJavascriptExecutionScope
 Introduce exception to DisallowJavascriptExecutionScope. More...
 
struct  CreateParams
 Initial configuration parameters for a new Isolate. More...
 
class  DisallowJavascriptExecutionScope
 Assert that no Javascript code is invoked. More...
 
class  Scope
 Stack-allocated class which sets the isolate for all operations executed within a local scope. More...
 
class  SuppressMicrotaskExecutionScope
 Do not run microtasks while this scope is active, even if microtasks are automatically executed otherwise. More...
 

Public Types

enum  GarbageCollectionType { kFullGarbageCollection , kMinorGarbageCollection }
 Types of garbage collections that can be requested via RequestGarbageCollectionForTesting. More...
 
enum  UseCounterFeature { kUseAsm = 0 , kUseCounterFeatureCount }
 Features reported via the SetUseCounterCallback callback. More...
 
typedef void(* UseCounterCallback) (Isolate *isolate, UseCounterFeature feature)
 
typedef void(* GCPrologueCallback) (Isolate *isolate, GCType type, GCCallbackFlags flags)
 
typedef void(* GCEpilogueCallback) (Isolate *isolate, GCType type, GCCallbackFlags flags)
 

Public Member Functions

void Enter ()
 Methods below this point require holding a lock (using Locker) in a multi-threaded environment. More...
 
void Exit ()
 Exits this isolate by restoring the previously entered one in the current thread. More...
 
void Dispose ()
 Disposes the isolate. More...
 
void SetData (uint32_t slot, void *data)
 Associate embedder-specific data with the isolate. More...
 
void * GetData (uint32_t slot)
 Retrieve embedder-specific data from the isolate. More...
 
void GetHeapStatistics (HeapStatistics *heap_statistics)
 Get statistics about the heap memory usage. More...
 
int64_t AdjustAmountOfExternalAllocatedMemory (int64_t change_in_bytes)
 Adjusts the amount of registered external memory. More...
 
HeapProfilerGetHeapProfiler ()
 Returns heap profiler for this isolate. More...
 
CpuProfilerGetCpuProfiler ()
 Returns CPU profiler for this isolate. More...
 
bool InContext ()
 Returns true if this isolate has a current context. More...
 
Local< ContextGetCurrentContext ()
 Returns the context that is on the top of the stack. More...
 
Local< ContextGetCallingContext ()
 Returns the context of the calling JavaScript code. More...
 
Local< ContextGetEnteredContext ()
 Returns the last entered context. More...
 
Local< ValueThrowException (Local< Value > exception)
 Schedules an exception to be thrown when returning to JavaScript. More...
 
template<typename T >
void SetObjectGroupId (const Persistent< T > &object, UniqueId id)
 Allows the host application to group objects together. More...
 
template<typename T >
void SetReferenceFromGroup (UniqueId id, const Persistent< T > &child)
 Allows the host application to declare implicit references from an object group to an object. More...
 
template<typename T , typename S >
void SetReference (const Persistent< T > &parent, const Persistent< S > &child)
 Allows the host application to declare implicit references from an object to another object. More...
 
void AddGCPrologueCallback (GCPrologueCallback callback, GCType gc_type_filter=kGCTypeAll)
 Enables the host application to receive a notification before a garbage collection. More...
 
void RemoveGCPrologueCallback (GCPrologueCallback callback)
 This function removes callback which was installed by AddGCPrologueCallback function. More...
 
void AddGCEpilogueCallback (GCEpilogueCallback callback, GCType gc_type_filter=kGCTypeAll)
 Enables the host application to receive a notification after a garbage collection. More...
 
void RemoveGCEpilogueCallback (GCEpilogueCallback callback)
 This function removes callback which was installed by AddGCEpilogueCallback function. More...
 
void RequestInterrupt (InterruptCallback callback, void *data)
 Request V8 to interrupt long running JavaScript code and invoke the given |callback| passing the given |data| to it. More...
 
void ClearInterrupt ()
 Clear interrupt request created by |RequestInterrupt|. More...
 
void RequestGarbageCollectionForTesting (GarbageCollectionType type)
 Request garbage collection in this Isolate. More...
 
void SetEventLogger (LogEventCallback that)
 Set the callback to invoke for logging event. More...
 
void AddCallCompletedCallback (CallCompletedCallback callback)
 Adds a callback to notify the host application when a script finished running. More...
 
void RemoveCallCompletedCallback (CallCompletedCallback callback)
 Removes callback that was installed by AddCallCompletedCallback. More...
 
void RunMicrotasks ()
 Experimental: Runs the Microtask Work Queue until empty Any exceptions thrown by microtask callbacks are swallowed. More...
 
void EnqueueMicrotask (Handle< Function > microtask)
 Experimental: Enqueues the callback to the Microtask Work Queue. More...
 
void EnqueueMicrotask (MicrotaskCallback microtask, void *data=NULL)
 Experimental: Enqueues the callback to the Microtask Work Queue. More...
 
void SetAutorunMicrotasks (bool autorun)
 Experimental: Controls whether the Microtask Work Queue is automatically run when the script call depth decrements to zero. More...
 
bool WillAutorunMicrotasks () const
 Experimental: Returns whether the Microtask Work Queue is automatically run when the script call depth decrements to zero. More...
 
void SetUseCounterCallback (UseCounterCallback callback)
 Sets a callback for counting the number of times a feature of V8 is used. More...
 
void SetCounterFunction (CounterLookupCallback)
 Enables the host application to provide a mechanism for recording statistics counters. More...
 
void SetCreateHistogramFunction (CreateHistogramCallback)
 Enables the host application to provide a mechanism for recording histograms. More...
 
void SetAddHistogramSampleFunction (AddHistogramSampleCallback)
 
bool IdleNotification (int idle_time_in_ms)
 Optional notification that the embedder is idle. More...
 
void LowMemoryNotification ()
 Optional notification that the system is running low on memory. More...
 
int ContextDisposedNotification ()
 Optional notification that a context has been disposed. More...
 
void SetJitCodeEventHandler (JitCodeEventOptions options, JitCodeEventHandler event_handler)
 Allows the host application to provide the address of a function that is notified each time code is added, moved or removed. More...
 
void SetStackLimit (uintptr_t stack_limit)
 Modifies the stack limit for this Isolate. More...
 
void GetCodeRange (void **start, size_t *length_in_bytes)
 Returns a memory range that can potentially contain jitted code. More...
 

Static Public Member Functions

static IsolateNew (const CreateParams &params=CreateParams())
 Creates a new isolate. More...
 
static IsolateGetCurrent ()
 Returns the entered isolate for the current thread or NULL in case there is no current isolate. More...
 
static uint32_t GetNumberOfDataSlots ()
 Returns the maximum number of available embedder data slots. More...
 

Private Member Functions

 Isolate ()
 
 Isolate (const Isolate &)
 
 ~Isolate ()
 
Isolateoperator= (const Isolate &)
 
void * operator new (size_t size)
 
void operator delete (void *, size_t)
 
void SetObjectGroupId (internal::Object **object, UniqueId id)
 
void SetReferenceFromGroup (UniqueId id, internal::Object **object)
 
void SetReference (internal::Object **parent, internal::Object **child)
 
void CollectAllGarbage (const char *gc_reason)
 

Friends

template<class K , class V , class Traits >
class PersistentValueMap
 

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. The embedder can create multiple 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 4356 of file v8.h.

Member Typedef Documentation

◆ GCEpilogueCallback

typedef void(* v8::Isolate::GCEpilogueCallback) (Isolate *isolate, GCType type, GCCallbackFlags flags)

Definition at line 4651 of file v8.h.

◆ GCPrologueCallback

typedef void(* v8::Isolate::GCPrologueCallback) (Isolate *isolate, GCType type, GCCallbackFlags flags)

Definition at line 4648 of file v8.h.

◆ UseCounterCallback

typedef void(* v8::Isolate::UseCounterCallback) (Isolate *isolate, UseCounterFeature feature)

Definition at line 4491 of file v8.h.

Member Enumeration Documentation

◆ GarbageCollectionType

Types of garbage collections that can be requested via RequestGarbageCollectionForTesting.

Enumerator
kFullGarbageCollection 
kMinorGarbageCollection 

Definition at line 4476 of file v8.h.

4476  {
4479  };
@ kFullGarbageCollection
Definition: v8.h:4477
@ kMinorGarbageCollection
Definition: v8.h:4478

◆ UseCounterFeature

Features reported via the SetUseCounterCallback callback.

Do not chang assigned numbers of existing items; add new features to the end of this list.

Enumerator
kUseAsm 
kUseCounterFeatureCount 

Definition at line 4486 of file v8.h.

4486  {
4487  kUseAsm = 0,
4488  kUseCounterFeatureCount // This enum value must be last.
4489  };
@ kUseCounterFeatureCount
Definition: v8.h:4488
@ kUseAsm
Definition: v8.h:4487

Constructor & Destructor Documentation

◆ Isolate() [1/2]

v8::Isolate::Isolate ( )
private

◆ Isolate() [2/2]

v8::Isolate::Isolate ( const Isolate )
private

◆ ~Isolate()

v8::Isolate::~Isolate ( )
private

Member Function Documentation

◆ AddCallCompletedCallback()

void v8::Isolate::AddCallCompletedCallback ( CallCompletedCallback  callback)

Adds a callback to notify the host application when a script finished running.

If a script re-enters the runtime during executing, the CallCompletedCallback is only invoked when the outer-most script execution ends. Executing scripts inside the callback do not trigger further callbacks.

Definition at line 6713 of file api.cc.

6713  {
6714  if (callback == NULL) return;
6715  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6716  isolate->AddCallCompletedCallback(callback);
6717 }
void AddCallCompletedCallback(CallCompletedCallback callback)
Definition: isolate.cc:2248
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL

References v8::internal::Isolate::AddCallCompletedCallback(), and NULL.

+ Here is the call graph for this function:

◆ AddGCEpilogueCallback()

void v8::Isolate::AddGCEpilogueCallback ( GCEpilogueCallback  callback,
GCType  gc_type_filter = kGCTypeAll 
)

Enables the host application to receive a notification after a garbage collection.

Allocations are allowed in the callback function, but the callback is not re-entrant: if the allocation inside it will trigger the garbage collection, the callback won't be called again. 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.

Definition at line 6465 of file api.cc.

6466  {
6467  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6468  isolate->heap()->AddGCEpilogueCallback(callback, gc_type);
6469 }
void AddGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback, GCType gc_type_filter, bool pass_isolate=true)
Definition: heap.cc:5319

References v8::internal::Heap::AddGCEpilogueCallback(), and v8::internal::Isolate::heap().

+ Here is the call graph for this function:

◆ AddGCPrologueCallback()

void v8::Isolate::AddGCPrologueCallback ( GCPrologueCallback  callback,
GCType  gc_type_filter = kGCTypeAll 
)

Enables the host application to receive a notification before a garbage collection.

Allocations are allowed in the callback function, but the callback is not re-entrant: if the allocation inside it will trigger the garbage collection, the callback won't be called again. 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.

Definition at line 6452 of file api.cc.

6453  {
6454  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6455  isolate->heap()->AddGCPrologueCallback(callback, gc_type);
6456 }
void AddGCPrologueCallback(v8::Isolate::GCPrologueCallback callback, GCType gc_type_filter, bool pass_isolate=true)
Definition: heap.cc:5298

References v8::internal::Heap::AddGCPrologueCallback(), and v8::internal::Isolate::heap().

+ Here is the call graph for this function:

◆ AdjustAmountOfExternalAllocatedMemory()

int64_t v8::Isolate::AdjustAmountOfExternalAllocatedMemory ( int64_t  change_in_bytes)
inline

Adjusts the amount of registered external memory.

Used to give V8 an indication of the amount of externally allocated memory that is kept alive by JavaScript objects. V8 uses this to decide when to perform global garbage collections. Registering externally allocated memory will trigger global garbage collections more often than it would otherwise in an attempt to garbage collect the JavaScript objects that keep the externally allocated memory alive.

Parameters
change_in_bytesthe change in externally allocated memory that is kept alive by JavaScript objects.
Returns
the adjusted value.

Definition at line 6890 of file v8.h.

6891  {
6892  typedef internal::Internals I;
6893  int64_t* amount_of_external_allocated_memory =
6894  reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(this) +
6895  I::kAmountOfExternalAllocatedMemoryOffset);
6896  int64_t* amount_of_external_allocated_memory_at_last_global_gc =
6897  reinterpret_cast<int64_t*>(
6898  reinterpret_cast<uint8_t*>(this) +
6899  I::kAmountOfExternalAllocatedMemoryAtLastGlobalGCOffset);
6900  int64_t amount = *amount_of_external_allocated_memory + change_in_bytes;
6901  if (change_in_bytes > 0 &&
6902  amount - *amount_of_external_allocated_memory_at_last_global_gc >
6903  I::kExternalAllocationLimit) {
6904  CollectAllGarbage("external memory allocation limit reached.");
6905  } else {
6906  *amount_of_external_allocated_memory = amount;
6907  }
6908  return *amount_of_external_allocated_memory;
6909 }
void CollectAllGarbage(const char *gc_reason)
Definition: api.cc:6358
#define I(name, number_of_args, result_size)
Definition: runtime.cc:9248

References I.

Referenced by v8::Shell::ReadBuffer(), and v8::ReadBufferWeakCallback().

+ Here is the caller graph for this function:

◆ ClearInterrupt()

void v8::Isolate::ClearInterrupt ( )

Clear interrupt request created by |RequestInterrupt|.

Can be called from another thread without acquiring a |Locker|.

Definition at line 6554 of file api.cc.

6554  {
6555  i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
6556  i_isolate->stack_guard()->ClearApiInterrupt();
6557  i_isolate->set_api_interrupt_callback(NULL);
6558  i_isolate->set_api_interrupt_callback_data(NULL);
6559 }
StackGuard * stack_guard()
Definition: isolate.h:872

References NULL, and v8::internal::Isolate::stack_guard().

+ Here is the call graph for this function:

◆ CollectAllGarbage()

void v8::Isolate::CollectAllGarbage ( const char *  gc_reason)
private

Definition at line 6358 of file api.cc.

6358  {
6359  reinterpret_cast<i::Isolate*>(this)->heap()->CollectAllGarbage(
6360  i::Heap::kNoGCFlags, gc_reason);
6361 }
static const int kNoGCFlags
Definition: heap.h:716

References v8::internal::Heap::kNoGCFlags.

◆ ContextDisposedNotification()

int v8::Isolate::ContextDisposedNotification ( )

Optional notification that a context has been disposed.

V8 uses these notifications to guide the GC heuristic. Returns the number of context disposals - including this one - since the last time V8 had a chance to clean up.

Definition at line 6807 of file api.cc.

6807  {
6808  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6809  return isolate->heap()->NotifyContextDisposed();
6810 }
int NotifyContextDisposed()
Definition: heap.cc:857

References v8::internal::Isolate::heap(), and v8::internal::Heap::NotifyContextDisposed().

Referenced by v8::SourceGroup::ExecuteInThread(), and v8::Shell::RunMain().

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

◆ Dispose()

void v8::Isolate::Dispose ( )

Disposes the isolate.

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

Definition at line 6609 of file api.cc.

6609  {
6610  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6611  if (!Utils::ApiCheck(!isolate->IsInUse(),
6612  "v8::Isolate::Dispose()",
6613  "Disposing the isolate that is entered by a thread.")) {
6614  return;
6615  }
6616  isolate->TearDown();
6617 }
static bool ApiCheck(bool condition, const char *location, const char *message)
Definition: api.h:177

References v8::Utils::ApiCheck(), v8::internal::Isolate::IsInUse(), and v8::internal::Isolate::TearDown().

Referenced by v8::SourceGroup::ExecuteInThread(), main(), v8::Shell::Main(), and v8::TestWithIsolate::TearDownTestCase().

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

◆ EnqueueMicrotask() [1/2]

void v8::Isolate::EnqueueMicrotask ( Handle< Function microtask)

Experimental: Enqueues the callback to the Microtask Work Queue.

Definition at line 6731 of file api.cc.

6731  {
6732  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6733  isolate->EnqueueMicrotask(Utils::OpenHandle(*microtask));
6734 }
static v8::internal::Handle< To > OpenHandle(v8::Local< From > handle)
Definition: api.h:288
void EnqueueMicrotask(Handle< Object > microtask)
Definition: isolate.cc:2281

References v8::internal::Isolate::EnqueueMicrotask(), and v8::Utils::OpenHandle().

+ Here is the call graph for this function:

◆ EnqueueMicrotask() [2/2]

void v8::Isolate::EnqueueMicrotask ( MicrotaskCallback  microtask,
void *  data = NULL 
)

Experimental: Enqueues the callback to the Microtask Work Queue.

Definition at line 6737 of file api.cc.

6737  {
6738  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6739  i::HandleScope scope(isolate);
6740  i::Handle<i::CallHandlerInfo> callback_info =
6742  isolate->factory()->NewStruct(i::CALL_HANDLER_INFO_TYPE));
6743  SET_FIELD_WRAPPED(callback_info, set_callback, microtask);
6744  SET_FIELD_WRAPPED(callback_info, set_data, data);
6745  isolate->EnqueueMicrotask(callback_info);
6746 }
#define SET_FIELD_WRAPPED(obj, setter, cdata)
Definition: api.cc:1101
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
Factory * factory()
Definition: isolate.h:982
@ CALL_HANDLER_INFO_TYPE
Definition: objects.h:702

References v8::internal::CALL_HANDLER_INFO_TYPE, v8::internal::Handle< T >::cast(), v8::internal::Isolate::EnqueueMicrotask(), v8::internal::Isolate::factory(), and SET_FIELD_WRAPPED.

+ Here is the call graph for this function:

◆ Enter()

void v8::Isolate::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 6620 of file api.cc.

6620  {
6621  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6622  isolate->Enter();
6623 }

References v8::internal::Isolate::Enter().

Referenced by v8::Isolate::Scope::Scope().

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

◆ Exit()

void v8::Isolate::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 6626 of file api.cc.

6626  {
6627  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6628  isolate->Exit();
6629 }

References v8::internal::Isolate::Exit().

+ Here is the call graph for this function:

◆ GetCallingContext()

v8::Local< v8::Context > v8::Isolate::GetCallingContext ( )

Returns the context of the calling JavaScript code.

That is the context of the top-most JavaScript frame. If there are no JavaScript frames an empty handle is returned.

Definition at line 6394 of file api.cc.

6394  {
6395  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6396  i::Handle<i::Object> calling = isolate->GetCallingNativeContext();
6397  if (calling.is_null()) return Local<Context>();
6399 }
static Local< Context > ToLocal(v8::internal::Handle< v8::internal::Context > obj)
bool is_null() const
Definition: handles.h:124
Handle< Context > GetCallingNativeContext()
Definition: isolate.cc:1349

References v8::internal::Isolate::GetCallingNativeContext(), v8::internal::Handle< T >::is_null(), and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetCodeRange()

void v8::Isolate::GetCodeRange ( void **  start,
size_t *  length_in_bytes 
)

Returns a memory range that can potentially contain jitted code.

On Win64, embedders are advised to install function table callbacks for these ranges, as default SEH won't be able to unwind through jitted code.

Might be empty on other platforms.

https://code.google.com/p/v8/issues/detail?id=3598

Definition at line 6829 of file api.cc.

6829  {
6830  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6831  if (isolate->code_range()->valid()) {
6832  *start = isolate->code_range()->start();
6833  *length_in_bytes = isolate->code_range()->size();
6834  } else {
6835  *start = NULL;
6836  *length_in_bytes = 0;
6837  }
6838 }
CodeRange * code_range()
Definition: isolate.h:863

References v8::internal::Isolate::code_range(), NULL, v8::internal::CodeRange::size(), v8::internal::CodeRange::start(), and v8::internal::CodeRange::valid().

+ Here is the call graph for this function:

◆ GetCpuProfiler()

CpuProfiler * v8::Isolate::GetCpuProfiler ( )

Returns CPU profiler for this isolate.

Will return NULL unless the isolate is initialized. It is the embedder's responsibility to stop all CPU profiling activities if it has started any.

Definition at line 6371 of file api.cc.

6371  {
6372  i::CpuProfiler* cpu_profiler =
6373  reinterpret_cast<i::Isolate*>(this)->cpu_profiler();
6374  return reinterpret_cast<CpuProfiler*>(cpu_profiler);
6375 }

◆ GetCurrent()

Isolate * v8::Isolate::GetCurrent ( )
static

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

Definition at line 6577 of file api.cc.

6577  {
6578  i::Isolate* isolate = i::Isolate::Current();
6579  return reinterpret_cast<Isolate*>(isolate);
6580 }

Referenced by v8::HandleDebugEvent().

+ Here is the caller graph for this function:

◆ GetCurrentContext()

v8::Local< v8::Context > v8::Isolate::GetCurrentContext ( )

Returns the context that is on the top of the stack.

Definition at line 6384 of file api.cc.

6384  {
6385  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6386  i::Context* context = isolate->context();
6387  if (context == NULL) return Local<Context>();
6388  i::Context* native_context = context->native_context();
6389  if (native_context == NULL) return Local<Context>();
6390  return Utils::ToLocal(i::Handle<i::Context>(native_context));
6391 }
Context * native_context()
Definition: contexts.cc:44
Context * context()
Definition: isolate.h:548

References v8::internal::Isolate::context(), v8::internal::Context::native_context(), NULL, and v8::Utils::ToLocal().

+ Here is the call graph for this function:

◆ GetData()

void * v8::Isolate::GetData ( uint32_t  slot)
inline

Retrieve embedder-specific data from the isolate.

Returns NULL if SetData has never been called for the given |slot|.

Definition at line 6878 of file v8.h.

6878  {
6879  typedef internal::Internals I;
6880  return I::GetEmbedderData(this, slot);
6881 }

References I.

Referenced by v8::PerIsolateData::Get().

+ Here is the caller graph for this function:

◆ GetEnteredContext()

v8::Local< v8::Context > v8::Isolate::GetEnteredContext ( )

Returns the last entered context.

Definition at line 6402 of file api.cc.

6402  {
6403  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6404  i::Handle<i::Object> last =
6406  if (last.is_null()) return Local<Context>();
6408 }
Handle< Context > LastEnteredContext()
Definition: api.h:629
HandleScopeImplementer * handle_scope_implementer()
Definition: isolate.h:901

References v8::internal::Isolate::handle_scope_implementer(), v8::internal::Handle< T >::is_null(), v8::internal::HandleScopeImplementer::LastEnteredContext(), and v8::Utils::ToLocal().

Referenced by v8::Shell::RealmCurrent(), and v8::PerIsolateData::RealmScope::RealmScope().

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

◆ GetHeapProfiler()

HeapProfiler * v8::Isolate::GetHeapProfiler ( )

Returns heap profiler for this isolate.

Will return NULL until the isolate is initialized.

Definition at line 6364 of file api.cc.

6364  {
6365  i::HeapProfiler* heap_profiler =
6366  reinterpret_cast<i::Isolate*>(this)->heap_profiler();
6367  return reinterpret_cast<HeapProfiler*>(heap_profiler);
6368 }

◆ GetHeapStatistics()

void v8::Isolate::GetHeapStatistics ( HeapStatistics heap_statistics)

Get statistics about the heap memory usage.

Definition at line 6685 of file api.cc.

6685  {
6686  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6687  if (!isolate->IsInitialized()) {
6688  heap_statistics->total_heap_size_ = 0;
6689  heap_statistics->total_heap_size_executable_ = 0;
6690  heap_statistics->total_physical_size_ = 0;
6691  heap_statistics->used_heap_size_ = 0;
6692  heap_statistics->heap_size_limit_ = 0;
6693  return;
6694  }
6695  i::Heap* heap = isolate->heap();
6696  heap_statistics->total_heap_size_ = heap->CommittedMemory();
6697  heap_statistics->total_heap_size_executable_ =
6698  heap->CommittedMemoryExecutable();
6699  heap_statistics->total_physical_size_ = heap->CommittedPhysicalMemory();
6700  heap_statistics->used_heap_size_ = heap->SizeOfObjects();
6701  heap_statistics->heap_size_limit_ = heap->MaxReserved();
6702 }
size_t CommittedPhysicalMemory()
Definition: heap.cc:180
intptr_t CommittedMemoryExecutable()
Definition: heap.cc:194
intptr_t MaxReserved()
Definition: heap.h:549
intptr_t CommittedMemory()
Definition: heap.cc:170
intptr_t SizeOfObjects()
Definition: heap.cc:460

References v8::internal::Heap::CommittedMemory(), v8::internal::Heap::CommittedMemoryExecutable(), v8::internal::Heap::CommittedPhysicalMemory(), v8::internal::Isolate::heap(), v8::HeapStatistics::heap_size_limit_, v8::internal::Isolate::IsInitialized(), v8::internal::Heap::MaxReserved(), v8::internal::Heap::SizeOfObjects(), v8::HeapStatistics::total_heap_size_, v8::HeapStatistics::total_heap_size_executable_, v8::HeapStatistics::total_physical_size_, and v8::HeapStatistics::used_heap_size_.

+ Here is the call graph for this function:

◆ GetNumberOfDataSlots()

uint32_t v8::Isolate::GetNumberOfDataSlots ( )
inlinestatic

Returns the maximum number of available embedder data slots.

Valid slots are in the range of 0 - GetNumberOfDataSlots() - 1.

Definition at line 6884 of file v8.h.

6884  {
6885  typedef internal::Internals I;
6886  return I::kNumIsolateDataSlots;
6887 }

References I.

◆ IdleNotification()

bool v8::Isolate::IdleNotification ( int  idle_time_in_ms)

Optional notification that the embedder is idle.

V8 uses the notification to reduce memory footprint. This call can be used repeatedly if the embedder remains idle. Returns true if the embedder should stop calling IdleNotification until real work has been done. This indicates that V8 has done as much cleanup as it will be able to do.

The idle_time_in_ms argument specifies the time V8 has to do reduce the memory footprint. There is no guarantee that the actual work will be done within the time limit.

Definition at line 6788 of file api.cc.

6788  {
6789  // Returning true tells the caller that it need not
6790  // continue to call IdleNotification.
6791  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6792  if (!i::FLAG_use_idle_notification) return true;
6793  return isolate->heap()->IdleNotification(idle_time_in_ms);
6794 }
bool IdleNotification(int idle_time_in_ms)
Definition: heap.cc:4296

References v8::internal::Isolate::heap(), and v8::internal::Heap::IdleNotification().

Referenced by v8::SourceGroup::ExecuteInThread(), and v8::Shell::RunMain().

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

◆ InContext()

bool v8::Isolate::InContext ( )

Returns true if this isolate has a current context.

Definition at line 6378 of file api.cc.

6378  {
6379  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6380  return isolate->context() != NULL;
6381 }

References v8::internal::Isolate::context(), and NULL.

Referenced by v8::Shell::ReportException().

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

◆ LowMemoryNotification()

void v8::Isolate::LowMemoryNotification ( )

Optional notification that the system is running low on memory.

V8 uses these notifications to attempt to free memory.

Definition at line 6797 of file api.cc.

6797  {
6798  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6799  {
6800  i::HistogramTimerScope idle_notification_scope(
6801  isolate->counters()->gc_low_memory_notification());
6802  isolate->heap()->CollectAllAvailableGarbage("low memory notification");
6803  }
6804 }
void CollectAllAvailableGarbage(const char *gc_reason=NULL)
Definition: heap.cc:735
Counters * counters()
Definition: isolate.h:857

References v8::internal::Heap::CollectAllAvailableGarbage(), v8::internal::Isolate::counters(), and v8::internal::Isolate::heap().

Referenced by v8::SourceGroup::ExecuteInThread(), and v8::Shell::RunMain().

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

◆ New()

Isolate * v8::Isolate::New ( const CreateParams params = CreateParams())
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.

V8::Initialize() must have run prior to this.

Definition at line 6583 of file api.cc.

6583  {
6584  i::Isolate* isolate = new i::Isolate();
6585  Isolate* v8_isolate = reinterpret_cast<Isolate*>(isolate);
6586  if (params.entry_hook) {
6587  isolate->set_function_entry_hook(params.entry_hook);
6588  }
6589  if (params.code_event_handler) {
6590  isolate->InitializeLoggingAndCounters();
6592  params.code_event_handler);
6593  }
6594  SetResourceConstraints(isolate, params.constraints);
6595  if (params.enable_serializer) {
6596  isolate->enable_serializer();
6597  }
6598  // TODO(jochen): Once we got rid of Isolate::Current(), we can remove this.
6599  Isolate::Scope isolate_scope(v8_isolate);
6600  if (params.entry_hook || !i::Snapshot::Initialize(isolate)) {
6601  // If the isolate has a function entry hook, it needs to re-build all its
6602  // code stubs with entry hooks embedded, so don't deserialize a snapshot.
6603  isolate->Init(NULL);
6604  }
6605  return v8_isolate;
6606 }
void enable_serializer()
Definition: isolate.h:1001
void InitializeLoggingAndCounters()
Definition: isolate.cc:1818
void set_function_entry_hook(FunctionEntryHook function_entry_hook)
Definition: isolate.h:1079
bool Init(Deserializer *des)
Definition: isolate.cc:1828
Logger * logger()
Definition: isolate.h:866
void SetCodeEventHandler(uint32_t options, JitCodeEventHandler event_handler)
Definition: log.cc:1877
static bool Initialize(Isolate *isolate)
@ kJitCodeEventDefault
Definition: v8.h:4334
void SetResourceConstraints(i::Isolate *isolate, const ResourceConstraints &constraints)
Definition: api.cc:474

References v8::Isolate::CreateParams::code_event_handler, v8::Isolate::CreateParams::constraints, v8::Isolate::CreateParams::enable_serializer, v8::internal::Isolate::enable_serializer(), v8::Isolate::CreateParams::entry_hook, v8::internal::Isolate::Init(), v8::internal::Snapshot::Initialize(), v8::internal::Isolate::InitializeLoggingAndCounters(), v8::kJitCodeEventDefault, v8::internal::Isolate::logger(), NULL, v8::internal::Isolate::set_function_entry_hook(), v8::internal::Logger::SetCodeEventHandler(), and v8::SetResourceConstraints().

Referenced by v8::SourceGroup::ExecuteInThread(), main(), v8::Shell::Main(), and v8::TestWithIsolate::SetUpTestCase().

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

◆ operator delete()

void v8::Isolate::operator delete ( void *  ,
size_t   
)
private

◆ operator new()

void* v8::Isolate::operator new ( size_t  size)
private

◆ operator=()

Isolate& v8::Isolate::operator= ( const Isolate )
private

◆ RemoveCallCompletedCallback()

void v8::Isolate::RemoveCallCompletedCallback ( CallCompletedCallback  callback)

Removes callback that was installed by AddCallCompletedCallback.

Definition at line 6720 of file api.cc.

6720  {
6721  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6722  isolate->RemoveCallCompletedCallback(callback);
6723 }
void RemoveCallCompletedCallback(CallCompletedCallback callback)
Definition: isolate.cc:2256

References v8::internal::Isolate::RemoveCallCompletedCallback().

+ Here is the call graph for this function:

◆ RemoveGCEpilogueCallback()

void v8::Isolate::RemoveGCEpilogueCallback ( GCEpilogueCallback  callback)

This function removes callback which was installed by AddGCEpilogueCallback function.

Definition at line 6472 of file api.cc.

6472  {
6473  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6474  isolate->heap()->RemoveGCEpilogueCallback(callback);
6475 }
void RemoveGCEpilogueCallback(v8::Isolate::GCEpilogueCallback callback)
Definition: heap.cc:5328

References v8::internal::Isolate::heap(), and v8::internal::Heap::RemoveGCEpilogueCallback().

+ Here is the call graph for this function:

◆ RemoveGCPrologueCallback()

void v8::Isolate::RemoveGCPrologueCallback ( GCPrologueCallback  callback)

This function removes callback which was installed by AddGCPrologueCallback function.

Definition at line 6459 of file api.cc.

6459  {
6460  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6461  isolate->heap()->RemoveGCPrologueCallback(callback);
6462 }
void RemoveGCPrologueCallback(v8::Isolate::GCPrologueCallback callback)
Definition: heap.cc:5307

References v8::internal::Isolate::heap(), and v8::internal::Heap::RemoveGCPrologueCallback().

+ Here is the call graph for this function:

◆ RequestGarbageCollectionForTesting()

void v8::Isolate::RequestGarbageCollectionForTesting ( GarbageCollectionType  type)

Request garbage collection in this Isolate.

It is only valid to call this function if –expose_gc was specified.

This should only be used for testing purposes and not to enforce a garbage collection schedule. It has strong negative impact on the garbage collection performance. Use IdleNotification() or LowMemoryNotification() instead to influence the garbage collection schedule.

Definition at line 6562 of file api.cc.

6562  {
6563  CHECK(i::FLAG_expose_gc);
6564  if (type == kMinorGarbageCollection) {
6565  reinterpret_cast<i::Isolate*>(this)->heap()->CollectGarbage(
6566  i::NEW_SPACE, "Isolate::RequestGarbageCollection",
6568  } else {
6570  reinterpret_cast<i::Isolate*>(this)->heap()->CollectAllGarbage(
6572  "Isolate::RequestGarbageCollection", kGCCallbackFlagForced);
6573  }
6574 }
static const int kAbortIncrementalMarkingMask
Definition: heap.h:718
#define CHECK(condition)
Definition: logging.h:36
#define DCHECK_EQ(v1, v2)
Definition: logging.h:206
@ kGCCallbackFlagForced
Definition: v8.h:4213

References CHECK, DCHECK_EQ, v8::internal::Heap::kAbortIncrementalMarkingMask, v8::kGCCallbackFlagForced, and v8::internal::NEW_SPACE.

Referenced by v8::internal::GCExtension::GC().

+ Here is the caller graph for this function:

◆ RequestInterrupt()

void v8::Isolate::RequestInterrupt ( InterruptCallback  callback,
void *  data 
)

Request V8 to interrupt long running JavaScript code and invoke the given |callback| passing the given |data| to it.

After |callback| returns control will be returned to the JavaScript code. At any given moment V8 can remember only a single callback for the very last interrupt request. Can be called from another thread without acquiring a |Locker|. Registered |callback| must not reenter interrupted Isolate.

Definition at line 6546 of file api.cc.

6546  {
6547  i::Isolate* i_isolate = reinterpret_cast<i::Isolate*>(this);
6548  i_isolate->set_api_interrupt_callback(callback);
6549  i_isolate->set_api_interrupt_callback_data(data);
6550  i_isolate->stack_guard()->RequestApiInterrupt();
6551 }

References v8::internal::Isolate::stack_guard().

+ Here is the call graph for this function:

◆ RunMicrotasks()

void v8::Isolate::RunMicrotasks ( )

Experimental: Runs the Microtask Work Queue until empty Any exceptions thrown by microtask callbacks are swallowed.

Definition at line 6726 of file api.cc.

6726  {
6727  reinterpret_cast<i::Isolate*>(this)->RunMicrotasks();
6728 }
void RunMicrotasks()
Experimental: Runs the Microtask Work Queue until empty Any exceptions thrown by microtask callbacks ...
Definition: api.cc:6726

◆ SetAddHistogramSampleFunction()

void v8::Isolate::SetAddHistogramSampleFunction ( AddHistogramSampleCallback  callback)

Definition at line 6780 of file api.cc.

6781  {
6782  reinterpret_cast<i::Isolate*>(this)
6783  ->stats_table()
6784  ->SetAddHistogramSampleFunction(callback);
6785 }

Referenced by v8::Shell::Initialize(), and v8::Shell::MapCounters().

+ Here is the caller graph for this function:

◆ SetAutorunMicrotasks()

void v8::Isolate::SetAutorunMicrotasks ( bool  autorun)

Experimental: Controls whether the Microtask Work Queue is automatically run when the script call depth decrements to zero.

Definition at line 6749 of file api.cc.

6749  {
6750  reinterpret_cast<i::Isolate*>(this)->set_autorun_microtasks(autorun);
6751 }

◆ SetCounterFunction()

void v8::Isolate::SetCounterFunction ( CounterLookupCallback  callback)

Enables the host application to provide a mechanism for recording statistics counters.

Definition at line 6764 of file api.cc.

6764  {
6765  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6766  isolate->stats_table()->SetCounterFunction(callback);
6767  isolate->InitializeLoggingAndCounters();
6768  isolate->counters()->ResetCounters();
6769 }
StatsTable * stats_table()
Definition: isolate.cc:2039
void SetCounterFunction(CounterLookupCallback f)
Definition: counters.h:25

References v8::internal::Isolate::counters(), v8::internal::Isolate::InitializeLoggingAndCounters(), v8::internal::Counters::ResetCounters(), v8::internal::StatsTable::SetCounterFunction(), and v8::internal::Isolate::stats_table().

Referenced by v8::Shell::Initialize(), and v8::Shell::MapCounters().

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

◆ SetCreateHistogramFunction()

void v8::Isolate::SetCreateHistogramFunction ( CreateHistogramCallback  callback)

Enables the host application to provide a mechanism for recording histograms.

The CreateHistogram function returns a histogram which will later be passed to the AddHistogramSample function.

Definition at line 6772 of file api.cc.

6772  {
6773  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6774  isolate->stats_table()->SetCreateHistogramFunction(callback);
6775  isolate->InitializeLoggingAndCounters();
6776  isolate->counters()->ResetHistograms();
6777 }
void SetCreateHistogramFunction(CreateHistogramCallback f)
Definition: counters.h:31

References v8::internal::Isolate::counters(), v8::internal::Isolate::InitializeLoggingAndCounters(), v8::internal::Counters::ResetHistograms(), v8::internal::StatsTable::SetCreateHistogramFunction(), and v8::internal::Isolate::stats_table().

Referenced by v8::Shell::Initialize(), and v8::Shell::MapCounters().

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

◆ SetData()

void v8::Isolate::SetData ( uint32_t  slot,
void *  data 
)
inline

Associate embedder-specific data with the isolate.

|slot| has to be between 0 and GetNumberOfDataSlots() - 1.

Definition at line 6872 of file v8.h.

6872  {
6873  typedef internal::Internals I;
6874  I::SetEmbedderData(this, slot, data);
6875 }

References I.

Referenced by v8::PerIsolateData::PerIsolateData(), and v8::PerIsolateData::~PerIsolateData().

+ Here is the caller graph for this function:

◆ SetEventLogger()

void v8::Isolate::SetEventLogger ( LogEventCallback  that)

Set the callback to invoke for logging event.

Definition at line 6705 of file api.cc.

6705  {
6706  // Do not overwrite the event logger if we want to log explicitly.
6707  if (i::FLAG_log_timer_events) return;
6708  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6709  isolate->set_event_logger(that);
6710 }

◆ SetJitCodeEventHandler()

void v8::Isolate::SetJitCodeEventHandler ( JitCodeEventOptions  options,
JitCodeEventHandler  event_handler 
)

Allows the host application to provide the address of a function that is notified each time code is added, moved or removed.

Parameters
optionsoptions for the JIT code event handler.
event_handlerthe JIT code event handler, which will be invoked each time code is added, moved or removed.
Note
event_handler won't get notified of existent code.
since code removal notifications are not currently issued, the event_handler may get notifications of code that overlaps earlier code notifications. This happens when code areas are reused, and the earlier overlapping code areas should therefore be discarded.
the events passed to event_handler and the strings they point to are not guaranteed to live past each call. The event_handler must copy strings and other parameters it needs to keep around.
the set of events declared in JitCodeEvent::EventType is expected to grow over time, and the JitCodeEvent structure is expected to accrue new members. The event_handler function must ignore event codes it does not recognize to maintain future compatibility.
Use Isolate::CreateParams to get events for code executed during Isolate setup.

Definition at line 6813 of file api.cc.

6814  {
6815  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6816  // Ensure that logging is initialized for our isolate.
6817  isolate->InitializeLoggingAndCounters();
6818  isolate->logger()->SetCodeEventHandler(options, event_handler);
6819 }

References v8::internal::Isolate::InitializeLoggingAndCounters(), v8::internal::Isolate::logger(), and v8::internal::Logger::SetCodeEventHandler().

+ Here is the call graph for this function:

◆ SetObjectGroupId() [1/2]

template<typename T >
void v8::Isolate::SetObjectGroupId ( const Persistent< T > &  object,
UniqueId  id 
)

Allows the host application to group objects together.

If one object in the group is alive, all objects in the group are alive. After each garbage collection, object groups are removed. It is intended to be used in the before-garbage-collection callback function, for instance to simulate DOM tree connections among JS wrapper objects. Object groups for all dependent handles need to be provided for kGCTypeMarkSweepCompact collections, for all other garbage collection types it is sufficient to provide object groups for partially dependent handles only.

Definition at line 6913 of file v8.h.

6914  {
6915  TYPE_CHECK(Value, T);
6916  SetObjectGroupId(reinterpret_cast<v8::internal::Object**>(object.val_), id);
6917 }
void SetObjectGroupId(const Persistent< T > &object, UniqueId id)
Allows the host application to group objects together.
Definition: v8.h:6913
#define TYPE_CHECK(T, S)
Definition: v8.h:167
#define T(name, string, precedence)
Definition: token.cc:25

References T, and TYPE_CHECK.

◆ SetObjectGroupId() [2/2]

void v8::Isolate::SetObjectGroupId ( internal::Object **  object,
UniqueId  id 
)
private

Definition at line 6425 of file api.cc.

6425  {
6426  i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
6427  internal_isolate->global_handles()->SetObjectGroupId(
6428  v8::internal::Handle<v8::internal::Object>(object).location(),
6429  id);
6430 }
void SetObjectGroupId(Object **handle, UniqueId id)
GlobalHandles * global_handles()
Definition: isolate.h:917

References v8::internal::Isolate::global_handles(), and v8::internal::GlobalHandles::SetObjectGroupId().

+ Here is the call graph for this function:

◆ SetReference() [1/2]

template<typename T , typename S >
void v8::Isolate::SetReference ( const Persistent< T > &  parent,
const Persistent< S > &  child 
)

Allows the host application to declare implicit references from an object to another object.

If the parent object is alive, the child object is alive too. After each garbage collection, all implicit references are removed. It is intended to be used in the before-garbage-collection callback function.

Definition at line 6930 of file v8.h.

6931  {
6932  TYPE_CHECK(Object, T);
6933  TYPE_CHECK(Value, S);
6934  SetReference(reinterpret_cast<v8::internal::Object**>(parent.val_),
6935  reinterpret_cast<v8::internal::Object**>(child.val_));
6936 }
void SetReference(const Persistent< T > &parent, const Persistent< S > &child)
Allows the host application to declare implicit references from an object to another object.
Definition: v8.h:6930
kSerializedDataOffset Object
Definition: objects-inl.h:5322
#define S(x)
Definition: version.cc:55

References S, T, TYPE_CHECK, and v8::PersistentBase< T >::val_.

Referenced by v8::PersistentValueMap< K, V, Traits >::SetReference().

+ Here is the caller graph for this function:

◆ SetReference() [2/2]

void v8::Isolate::SetReference ( internal::Object **  parent,
internal::Object **  child 
)
private

Definition at line 6441 of file api.cc.

6442  {
6443  i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
6444  i::Object** parent_location =
6445  v8::internal::Handle<v8::internal::Object>(parent).location();
6446  internal_isolate->global_handles()->SetReference(
6447  reinterpret_cast<i::HeapObject**>(parent_location),
6448  v8::internal::Handle<v8::internal::Object>(child).location());
6449 }
void SetReference(HeapObject **parent, Object **child)

References v8::internal::Isolate::global_handles(), and v8::internal::GlobalHandles::SetReference().

+ Here is the call graph for this function:

◆ SetReferenceFromGroup() [1/2]

template<typename T >
void v8::Isolate::SetReferenceFromGroup ( UniqueId  id,
const Persistent< T > &  child 
)

Allows the host application to declare implicit references from an object group to an object.

If the objects of the object group are alive, the child object is alive too. After each garbage collection, all implicit references are removed. It is intended to be used in the before-garbage-collection callback function.

Definition at line 6921 of file v8.h.

6922  {
6923  TYPE_CHECK(Value, T);
6925  reinterpret_cast<v8::internal::Object**>(object.val_));
6926 }
void SetReferenceFromGroup(UniqueId id, const Persistent< T > &child)
Allows the host application to declare implicit references from an object group to an object.
Definition: v8.h:6921

References T, and TYPE_CHECK.

◆ SetReferenceFromGroup() [2/2]

void v8::Isolate::SetReferenceFromGroup ( UniqueId  id,
internal::Object **  object 
)
private

Definition at line 6433 of file api.cc.

6433  {
6434  i::Isolate* internal_isolate = reinterpret_cast<i::Isolate*>(this);
6435  internal_isolate->global_handles()->SetReferenceFromGroup(
6436  id,
6437  v8::internal::Handle<v8::internal::Object>(object).location());
6438 }
void SetReferenceFromGroup(UniqueId id, Object **child)

References v8::internal::Isolate::global_handles(), and v8::internal::GlobalHandles::SetReferenceFromGroup().

+ Here is the call graph for this function:

◆ SetStackLimit()

void v8::Isolate::SetStackLimit ( uintptr_t  stack_limit)

Modifies the stack limit for this Isolate.

Parameters
stack_limitAn address beyond which the Vm's stack may not grow.
Note
If you are using threads then you should hold the V8::Locker lock while setting the stack limit and you must set a non-default stack limit separately for each thread.

Definition at line 6822 of file api.cc.

6822  {
6823  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6824  CHECK(stack_limit);
6825  isolate->stack_guard()->SetStackLimit(stack_limit);
6826 }

References CHECK, and v8::internal::Isolate::stack_guard().

+ Here is the call graph for this function:

◆ SetUseCounterCallback()

void v8::Isolate::SetUseCounterCallback ( UseCounterCallback  callback)

Sets a callback for counting the number of times a feature of V8 is used.

Definition at line 6759 of file api.cc.

6759  {
6760  reinterpret_cast<i::Isolate*>(this)->SetUseCounterCallback(callback);
6761 }
void SetUseCounterCallback(UseCounterCallback callback)
Sets a callback for counting the number of times a feature of V8 is used.
Definition: api.cc:6759

◆ ThrowException()

v8::Local< Value > v8::Isolate::ThrowException ( Local< Value exception)

Schedules an exception to be thrown when returning to JavaScript.

When an exception has been scheduled it is illegal to invoke any JavaScript operation; the caller must return immediately and only after the exception has been handled does it become legal to invoke JavaScript operations.

Definition at line 6411 of file api.cc.

6411  {
6412  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(this);
6413  ENTER_V8(isolate);
6414  // If we're passed an empty handle, we throw an undefined exception
6415  // to deal more gracefully with out of memory situations.
6416  if (value.IsEmpty()) {
6417  isolate->ScheduleThrow(isolate->heap()->undefined_value());
6418  } else {
6419  isolate->ScheduleThrow(*Utils::OpenHandle(*value));
6420  }
6421  return v8::Undefined(reinterpret_cast<v8::Isolate*>(isolate));
6422 }
#define ENTER_V8(isolate)
Definition: api.cc:54
Isolate represents an isolated instance of the V8 engine.
Definition: v8.h:4356
void ScheduleThrow(Object *exception)
Definition: isolate.cc:858
Handle< Primitive > Undefined(Isolate *isolate)
Definition: v8.h:6836

References ENTER_V8, v8::internal::Isolate::heap(), v8::Handle< T >::IsEmpty(), v8::Utils::OpenHandle(), v8::internal::Isolate::ScheduleThrow(), and v8::Undefined().

Referenced by v8::Shell::ChangeDirectory(), v8::CheckItsADirectory(), v8::ChildLaunchedOK(), v8::internal::ExternalizeStringExtension::Externalize(), v8::GetStdout(), v8::GetTimeouts(), v8::ExecArgs::Init(), v8::internal::ExternalizeStringExtension::IsOneByte(), v8::Shell::MakeDirectory(), v8::mkdirp(), v8::Shell::RemoveDirectory(), v8::Shell::SetEnvironment(), v8::Shell::SetUMask(), v8::Shell::System(), v8::Throw(), v8::Shell::UnsetEnvironment(), and v8::WaitForChild().

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

◆ WillAutorunMicrotasks()

bool v8::Isolate::WillAutorunMicrotasks ( ) const

Experimental: Returns whether the Microtask Work Queue is automatically run when the script call depth decrements to zero.

Definition at line 6754 of file api.cc.

6754  {
6755  return reinterpret_cast<const i::Isolate*>(this)->autorun_microtasks();
6756 }

Friends And Related Function Documentation

◆ PersistentValueMap

template<class K , class V , class Traits >
friend class PersistentValueMap
friend

Definition at line 4863 of file v8.h.


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