V8 Project
v8::EscapableHandleScope Class Reference

A HandleScope which first allocates a handle in the current scope which will be later filled with the escape value. More...

#include <v8.h>

+ Inheritance diagram for v8::EscapableHandleScope:
+ Collaboration diagram for v8::EscapableHandleScope:

Public Member Functions

 EscapableHandleScope (Isolate *isolate)
 
 ~EscapableHandleScope ()
 
template<class T >
Local< TEscape (Local< T > value)
 Pushes the value into the previous scope and returns a handle to it. More...
 
- Public Member Functions inherited from v8::HandleScope
 HandleScope (Isolate *isolate)
 
 ~HandleScope ()
 
IsolateGetIsolate () const
 

Private Member Functions

internal::Object ** Escape (internal::Object **escape_value)
 
 EscapableHandleScope (const EscapableHandleScope &)
 
void operator= (const EscapableHandleScope &)
 
void * operator new (size_t size)
 
void operator delete (void *, size_t)
 

Private Attributes

internal::Object ** escape_slot_
 

Additional Inherited Members

- Static Public Member Functions inherited from v8::HandleScope
static int NumberOfHandles (Isolate *isolate)
 Counts the number of allocated handles. More...
 
- Protected Member Functions inherited from v8::HandleScope
 HandleScope ()
 
void Initialize (Isolate *isolate)
 
- Static Protected Member Functions inherited from v8::HandleScope
static internal::Object ** CreateHandle (internal::Isolate *isolate, internal::Object *value)
 

Detailed Description

A HandleScope which first allocates a handle in the current scope which will be later filled with the escape value.

Definition at line 855 of file v8.h.

Constructor & Destructor Documentation

◆ EscapableHandleScope() [1/2]

v8::EscapableHandleScope::EscapableHandleScope ( Isolate isolate)

Definition at line 591 of file api.cc.

591  {
592  i::Isolate* isolate = reinterpret_cast<i::Isolate*>(v8_isolate);
593  escape_slot_ = CreateHandle(isolate, isolate->heap()->the_hole_value());
594  Initialize(v8_isolate);
595 }
internal::Object ** escape_slot_
Definition: v8.h:881
void Initialize(Isolate *isolate)
Definition: api.cc:551
static internal::Object ** CreateHandle(internal::Isolate *isolate, internal::Object *value)
Definition: api.cc:579

References v8::HandleScope::CreateHandle(), escape_slot_, v8::internal::Isolate::heap(), and v8::HandleScope::Initialize().

+ Here is the call graph for this function:

◆ ~EscapableHandleScope()

v8::EscapableHandleScope::~EscapableHandleScope ( )
inline

Definition at line 858 of file v8.h.

858 {}

◆ EscapableHandleScope() [2/2]

v8::EscapableHandleScope::EscapableHandleScope ( const EscapableHandleScope )
private

Member Function Documentation

◆ Escape() [1/2]

i::Object ** v8::EscapableHandleScope::Escape ( internal::Object **  escape_value)
private

Definition at line 598 of file api.cc.

598  {
599  i::Heap* heap = reinterpret_cast<i::Isolate*>(GetIsolate())->heap();
600  Utils::ApiCheck(*escape_slot_ == heap->the_hole_value(),
601  "EscapeableHandleScope::Escape",
602  "Escape value set twice");
603  if (escape_value == NULL) {
604  *escape_slot_ = heap->undefined_value();
605  return NULL;
606  }
607  *escape_slot_ = *escape_value;
608  return escape_slot_;
609 }
Isolate * GetIsolate() const
Definition: v8.h:813
static bool ApiCheck(bool condition, const char *location, const char *message)
Definition: api.h:177
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::Utils::ApiCheck(), escape_slot_, v8::HandleScope::GetIsolate(), and NULL.

+ Here is the call graph for this function:

◆ Escape() [2/2]

template<class T >
Local<T> v8::EscapableHandleScope::Escape ( Local< T value)
inline

Pushes the value into the previous scope and returns a handle to it.

Cannot be called twice.

Definition at line 865 of file v8.h.

865  {
866  internal::Object** slot =
867  Escape(reinterpret_cast<internal::Object**>(*value));
868  return Local<T>(reinterpret_cast<T*>(slot));
869  }
Local< T > Escape(Local< T > value)
Pushes the value into the previous scope and returns a handle to it.
Definition: v8.h:865
kSerializedDataOffset Object
Definition: objects-inl.h:5322
#define T(name, string, precedence)
Definition: token.cc:25

References T.

Referenced by v8::Shell::CreateEvaluationContext(), v8::Shell::DebugCommandToJSONRequest(), v8::Shell::DebugMessageDetails(), v8::internal::Handle< T >::EscapeFrom(), v8::Message::Get(), v8::Shell::GetCompletions(), v8::StackTrace::GetFrame(), v8::internal::MessageImpl::GetJSON(), v8::Debug::GetMirror(), v8::Message::GetSourceLine(), v8::Message::GetStackTrace(), v8::getStringProperty(), and v8::Function::NewInstance().

+ Here is the caller graph for this function:

◆ operator delete()

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

◆ operator new()

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

◆ operator=()

void v8::EscapableHandleScope::operator= ( const EscapableHandleScope )
private

Member Data Documentation

◆ escape_slot_

internal::Object** v8::EscapableHandleScope::escape_slot_
private

Definition at line 881 of file v8.h.

Referenced by EscapableHandleScope(), and Escape().


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