![]() |
v8 14.1.146 (node 25.0.0)
V8 is Google's open source JavaScript engine
|
#include <v8-local-handle.h>


Public Member Functions | |
| V8_INLINE | Local ()=default |
| template<class S > requires std::is_base_of_v<T, S> | |
| V8_INLINE | Local (Local< S > that) |
| 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 |
Public Member Functions inherited from IndirectHandleBase | |
| V8_INLINE bool | IsEmpty () const |
| V8_INLINE void | Clear () |
Public Member Functions inherited from StackAllocated< false > | |
| V8_INLINE | StackAllocated ()=default |
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 BasicTracedReference< T > &that) |
Friends | |
| class | TracedReferenceBase |
| class | Utils |
| template<class F > | |
| class | Eternal |
| template<class F > | |
| class | Global |
| template<class F > | |
| class | Local |
| template<class F > | |
| class | MaybeLocal |
| template<class F , class M > | |
| class | Persistent |
| 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 |
| class | InternalEscapableScope |
| template<class F1 , class F2 , class F3 > | |
| class | PersistentValueMapBase |
| template<class F > | |
| class | ReturnValue |
| template<class F > | |
| class | Traced |
| class | internal::SamplingHeapProfiler |
| class | internal::HandleHelper |
| class | debug::ConsoleCallArguments |
| class | internal::LocalUnchecked< T > |
| 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 360 of file v8-local-handle.h.
|
inline |
Constructor for handling automatic up casting. Ex. Local<Object> can be passed when Local<Value> is expected but not the other way round.
Definition at line 380 of file v8-local-handle.h.
References LocalBase< T >::Local.
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 or if the handle is empty.
Definition at line 439 of file v8-local-handle.h.
References LocalBase< T >::Local.
|
inlinestatic |
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 or if the handle is empty.
Definition at line 423 of file v8-local-handle.h.
References LocalBase< T >::Local.
|
inlinestatic |
Definition at line 457 of file v8-local-handle.h.
References LocalBase< T >::Local.
|
inlinestatic |
Definition at line 452 of file v8-local-handle.h.
References LocalBase< T >::Local.
|
inlinestatic |
Create a local handle for the content of another handle. The referee is kept alive by the local handle even when the original handle is destroyed/disposed.
Definition at line 448 of file v8-local-handle.h.
References LocalBase< T >::Local.
|
inline |
Definition at line 408 of file v8-local-handle.h.
References LocalBase< T >::Local.
|
inline |
Definition at line 413 of file v8-local-handle.h.
References LocalBase< T >::Local.
|
inline |
Definition at line 384 of file v8-local-handle.h.
References LocalBase< T >::Local.
|
inline |
Definition at line 382 of file v8-local-handle.h.
References LocalBase< T >::Local.
|
inline |
Checks whether two handles are equal or different. They are equal iff they are both empty or they are both non-empty and the objects to which they refer are physically equal.
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.
Definition at line 398 of file v8-local-handle.h.
References LocalBase< T >::Local.
|
inline |
Definition at line 403 of file v8-local-handle.h.
References LocalBase< T >::Local.
|
friend |
Definition at line 481 of file v8-local-handle.h.
|
friend |
Definition at line 501 of file v8-local-handle.h.
|
friend |
Definition at line 491 of file v8-local-handle.h.
Definition at line 466 of file v8-local-handle.h.
Referenced by Eternal< T >::Eternal(), Eternal< T >::Get(), and Eternal< T >::Set().
Definition at line 1094 of file v8-primitive.h.
Definition at line 476 of file v8-local-handle.h.
Definition at line 468 of file v8-local-handle.h.
Referenced by Global< T >::Global(), Global< T >::Global(), Global< T >::Pass(), PersistentValueMapBase< K, V, Traits >::Release(), PersistentValueMapBase< K, V, Traits >::RemoveWeak(), PersistentValueMap< K, V, Traits >::Set(), and GlobalValueMap< K, V, Traits >::Set().
|
friend |
Definition at line 490 of file v8-local-handle.h.
Definition at line 485 of file v8-local-handle.h.
|
friend |
Definition at line 500 of file v8-local-handle.h.
|
friend |
Definition at line 501 of file v8-local-handle.h.
|
friend |
Definition at line 499 of file v8-local-handle.h.
|
friend |
Definition at line 492 of file v8-local-handle.h.
|
friend |
Definition at line 482 of file v8-local-handle.h.
Definition at line 470 of file v8-local-handle.h.
Definition at line 472 of file v8-local-handle.h.
Referenced by MaybeLocal< T >::As(), MaybeLocal< T >::Cast(), MaybeLocal< T >::FromMaybe(), MaybeLocal< T >::IsEmpty(), MaybeLocal< T >::MaybeLocal(), MaybeLocal< T >::MaybeLocal(), MaybeLocal< T >::ToLocal(), and MaybeLocal< T >::ToLocalChecked().
Definition at line 1078 of file v8-primitive.h.
|
friend |
Definition at line 480 of file v8-local-handle.h.
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 474 of file v8-local-handle.h.
Referenced by Persistent< T, M >::As(), Persistent< T, M >::Cast(), Persistent< T, M >::operator=(), Persistent< T, M >::operator=(), Persistent< T, M >::Persistent(), Persistent< T, M >::Persistent(), Persistent< T, M >::Persistent(), Persistent< T, M >::Persistent(), and Persistent< T, M >::~Persistent().
|
friend |
Definition at line 494 of file v8-local-handle.h.
|
friend |
Definition at line 483 of file v8-local-handle.h.
Definition at line 478 of file v8-local-handle.h.
Definition at line 496 of file v8-local-handle.h.
|
friend |
Definition at line 479 of file v8-local-handle.h.
Definition at line 498 of file v8-local-handle.h.
|
friend |
Definition at line 463 of file v8-local-handle.h.
Definition at line 1086 of file v8-primitive.h.
Definition at line 1070 of file v8-primitive.h.
|
friend |
Definition at line 464 of file v8-local-handle.h.