v8
8.4.371 (node 14.15.5)
V8 is Google's open source JavaScript engine
|
#include <v8.h>
Public Member Functions | |
V8_INLINE | Local () |
template<class S > | |
V8_INLINE | Local (Local< S > that) |
V8_INLINE bool | IsEmpty () const |
V8_INLINE void | Clear () |
V8_INLINE T * | operator-> () const |
V8_INLINE T * | operator* () const |
template<class S > | |
V8_INLINE bool | operator== (const Local< S > &that) const |
template<class S > | |
V8_INLINE bool | operator== (const PersistentBase< S > &that) const |
template<class S > | |
V8_INLINE bool | operator!= (const Local< S > &that) const |
template<class S > | |
V8_INLINE bool | operator!= (const Persistent< S > &that) const |
template<class S > | |
V8_INLINE Local< S > | As () const |
Static Public Member Functions | |
template<class S > | |
static V8_INLINE Local< T > | Cast (Local< S > that) |
static V8_INLINE Local< T > | New (Isolate *isolate, Local< T > that) |
static V8_INLINE Local< T > | New (Isolate *isolate, const PersistentBase< T > &that) |
static V8_INLINE Local< T > | New (Isolate *isolate, const TracedReferenceBase< T > &that) |
Friends | |
class | Utils |
template<class F > | |
class | Eternal |
template<class F > | |
class | PersistentBase |
template<class F , class M > | |
class | Persistent |
template<class F > | |
class | Local |
template<class F > | |
class | MaybeLocal |
template<class F > | |
class | FunctionCallbackInfo |
template<class F > | |
class | PropertyCallbackInfo |
class | String |
class | Object |
class | Context |
class | Isolate |
class | Private |
template<class F > | |
class | internal::CustomArguments |
class | HandleScope |
class | EscapableHandleScope |
template<class F1 , class F2 , class F3 > | |
class | PersistentValueMapBase |
template<class F1 , class F2 > | |
class | PersistentValueVector |
template<class F > | |
class | ReturnValue |
template<class F > | |
class | Traced |
template<class F > | |
class | TracedGlobal |
template<class F > | |
class | TracedReferenceBase |
template<class F > | |
class | TracedReference |
Local< Primitive > | Undefined (Isolate *isolate) |
Local< Primitive > | Null (Isolate *isolate) |
Local< Boolean > | True (Isolate *isolate) |
Local< Boolean > | False (Isolate *isolate) |
An object reference managed by the v8 garbage collector.
All objects returned from v8 have to be tracked by the garbage collector so that it knows that the objects are still alive. Also, because the garbage collector may move objects, it is unsafe to point directly to an object. Instead, all objects are stored in handles which are known by the garbage collector and updated whenever an object moves. Handles should always be passed by value (except in cases like out-parameters) and they should never be allocated on the heap.
There are two types of handles: local and persistent handles.
Local handles are light-weight and transient and typically used in local operations. They are managed by HandleScopes. That means that a HandleScope must exist on the stack when they are created and that they are only valid inside of the HandleScope active during their creation. For passing a local handle to an outer HandleScope, an EscapableHandleScope and its Escape() method must be used.
Persistent handles can be used when storing objects across several independent operations and have to be explicitly deallocated when they're no longer used.
It is safe to extract the object stored in the handle by dereferencing the handle (for instance, to extract the Object* from a Local<Object>); the value will still be governed by a handle behind the scenes and the same rules apply to these values as to their handles.
Definition at line 192 of file v8.h.
Referenced by V8InspectorClient::ensureDefaultContextInGroup(), and Extension::GetNativeFunctionTemplate().
Calling this is equivalent to Local<S>::Cast(). In particular, this is only valid if the handle actually refers to a value of the target type.
Definition at line 286 of file v8.h.
References Local< T >::Local.
Cast a handle to a subclass, e.g. Local<Value> to Local<Object>. This is only valid if the handle actually refers to a value of the target type.
Definition at line 271 of file v8.h.
References Local< T >::Local.
|
inline |
|
inline |
Returns true if the handle is empty.
Definition at line 207 of file v8.h.
Referenced by ScriptOrigin::ScriptOrigin().
|
static |
|
static |
Checks whether two handles are different. Returns true if only one of the handles is empty, or if the objects to which they refer are different.
If both handles refer to JS objects, this is the same as strict non-equality. For primitives, such as numbers or strings, a true
return value does not indicate that the values aren't equal in the JavaScript sense. Use Value::StrictEquals()
to check primitives for equality.
|
inline |
|
inline |
Definition at line 214 of file v8.h.
Referenced by Context::Scope::Scope(), ScriptOrigin::ScriptOrigin(), and Context::Scope::~Scope().
Checks whether two handles are the same. Returns true if both are empty, or if the objects to which they refer are identical.
If both handles refer to JS objects, this is the same as strict equality. For primitives, such as numbers or strings, a false
return value does not indicate that the values aren't equal in the JavaScript sense. Use Value::StrictEquals()
to check primitives for equality.
|
inline |
|
friend |
Definition at line 11901 of file v8.h.
Referenced by Boolean::New().
|
friend |
|
friend |
|
friend |
|
friend |
Definition at line 306 of file v8.h.
Referenced by Local< T >::As(), Local< T >::Cast(), FunctionCallbackInfo< T >::Data(), PropertyCallbackInfo< T >::Data(), String::Empty(), V8InspectorClient::ensureDefaultContextInGroup(), EscapableHandleScope::Escape(), EscapableHandleScope::EscapeMaybe(), MaybeLocal< T >::FromMaybe(), ReturnValue< T >::Get(), PersistentValueMapBase< K, V, Traits >::Get(), Eternal< T >::Get(), PersistentBase< T >::Get(), TracedReferenceBase< T >::Get(), PersistentValueVector< V, Traits >::Get(), Isolate::GetDataFromSnapshotOnce(), Context::GetDataFromSnapshotOnce(), Context::GetEmbedderData(), Object::GetInternalField(), Extension::GetNativeFunctionTemplate(), FunctionCallbackInfo< T >::Holder(), PropertyCallbackInfo< T >::Holder(), PersistentValueMapBase< K, V, Traits >::PersistentValueReference::NewLocal(), FunctionCallbackInfo< T >::NewTarget(), FunctionCallbackInfo< T >::operator[](), PersistentValueMap< K, V, Traits >::SetUnique(), GlobalValueMap< K, V, Traits >::SetUnique(), FunctionCallbackInfo< T >::This(), PropertyCallbackInfo< T >::This(), and MaybeLocal< T >::ToLocalChecked().
|
friend |
Definition at line 308 of file v8.h.
Referenced by V8InspectorClient::memoryInfo().
|
friend |
Persistent is a way to create a strong pointer from an off-heap object to another on-heap object. As long as the Persistent handle is alive the GC will keep the object pointed to alive. The Persistent handle is always a GC root from the point of view of the GC. Persistent must be constructed and destructed in the same thread.
Definition at line 305 of file v8.h.
Referenced by Persistent< T, M >::As(), and Persistent< T, M >::Cast().
|
friend |
Definition at line 304 of file v8.h.
Referenced by Global< T >::Global(), and Persistent< T, M >::Persistent().
|
friend |
|
friend |
|
friend |
|
friend |
Definition at line 327 of file v8.h.
Referenced by FunctionCallbackInfo< T >::GetReturnValue(), and PropertyCallbackInfo< T >::GetReturnValue().
|
friend |
Definition at line 331 of file v8.h.
Referenced by TracedGlobal< T >::As().
|
friend |
Definition at line 335 of file v8.h.
Referenced by TracedReference< T >::As().
|
friend |
Definition at line 333 of file v8.h.
Referenced by TracedReferenceBase< T >::As(), TracedGlobal< T >::Reset(), TracedReference< T >::Reset(), TracedGlobal< T >::TracedGlobal(), and TracedReference< T >::TracedReference().
Definition at line 11892 of file v8.h.
Referenced by Boolean::New().