Loading...
Searching...
No Matches
v8-local-handle.h
Go to the documentation of this file.
1// Copyright 2021 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef INCLUDE_V8_LOCAL_HANDLE_H_
6#define INCLUDE_V8_LOCAL_HANDLE_H_
7
8#include <stddef.h>
9
10#include <type_traits>
11#include <vector>
12
13#include "v8-handle-base.h" // NOLINT(build/include_directory)
14#include "v8-internal.h" // NOLINT(build/include_directory)
15
16namespace v8 {
17
18template <class T>
19class LocalBase;
20template <class T>
21class Local;
22template <class T>
23class LocalVector;
24template <class F>
25class MaybeLocal;
26
27template <class T>
28class Eternal;
29template <class T>
30class Global;
31
32template <class T>
33class NonCopyablePersistentTraits;
34template <class T>
35class PersistentBase;
36template <class T, class M = NonCopyablePersistentTraits<T>>
37class Persistent;
38
39class TracedReferenceBase;
40template <class T>
41class BasicTracedReference;
42template <class F>
43class TracedReference;
44
45class Boolean;
46class Context;
47class EscapableHandleScope;
48template <class F>
49class FunctionCallbackInfo;
50class Isolate;
51class Object;
52template <class F1, class F2, class F3>
53class PersistentValueMapBase;
54class Primitive;
55class Private;
56template <class F>
57class PropertyCallbackInfo;
58template <class F>
59class ReturnValue;
60class String;
61template <class F>
62class Traced;
64class Utils;
65
66namespace debug {
67class ConsoleCallArguments;
68}
69
70namespace internal {
71template <typename T>
73template <typename T>
74class LocalUnchecked;
75class SamplingHeapProfiler;
76} // namespace internal
77
78namespace api_internal {
79// Called when ToLocalChecked is called on an empty Local.
81} // namespace api_internal
82
98 public:
99 explicit HandleScope(Isolate* isolate);
100
102
106 static int NumberOfHandles(Isolate* isolate);
107
109 return reinterpret_cast<Isolate*>(i_isolate_);
110 }
111
112 HandleScope(const HandleScope&) = delete;
113 void operator=(const HandleScope&) = delete;
114
116 internal::Address value);
117
118 protected:
120
121 void Initialize(Isolate* isolate);
122
123 static internal::Address* CreateHandle(internal::Isolate* i_isolate,
124 internal::Address value);
125
126 private:
127 // Declaring operator new and delete as deleted is not spec compliant.
128 // Therefore declare them private instead to disable dynamic alloc
129 void* operator new(size_t size);
130 void* operator new[](size_t size);
131 void operator delete(void*, size_t);
132 void operator delete[](void*, size_t);
133
134 internal::Isolate* i_isolate_;
135 internal::Address* prev_next_;
136 internal::Address* prev_limit_;
137#ifdef V8_ENABLE_CHECKS
138 int scope_level_ = 0;
139#endif
140
141 // LocalBase<T>::New uses CreateHandle with an Isolate* parameter.
142 template <typename T>
143 friend class LocalBase;
144
145 // Object::GetInternalField and Context::GetEmbedderData use CreateHandle with
146 // a HeapObject in their shortcuts.
147 friend class Object;
148 friend class Context;
149};
150
157#ifdef V8_ENABLE_DIRECT_HANDLE
158
159template <typename T>
160class LocalBase : public api_internal::DirectHandleBase {
161 protected:
162 template <class F>
163 friend class Local;
164
165 V8_INLINE LocalBase() = default;
166
167 V8_INLINE explicit LocalBase(internal::Address ptr) : DirectHandleBase(ptr) {}
168
169 template <typename S>
170 V8_INLINE LocalBase(const LocalBase<S>& other) : DirectHandleBase(other) {}
171
172 V8_INLINE static LocalBase<T> New(Isolate* isolate, internal::Address value) {
173 return LocalBase<T>(value);
174 }
175
176 V8_INLINE static LocalBase<T> New(Isolate* isolate, T* that) {
177 return LocalBase<T>::New(isolate,
179 }
180
181 V8_INLINE static LocalBase<T> FromSlot(internal::Address* slot) {
182 if (slot == nullptr) return LocalBase<T>();
183 return LocalBase<T>(*slot);
184 }
185
186 V8_INLINE static LocalBase<T> FromRepr(
188 return LocalBase<T>(repr);
189 }
190};
191
192#else // !V8_ENABLE_DIRECT_HANDLE
193
194template <typename T>
196 protected:
197 template <class F>
198 friend class Local;
199
200 V8_INLINE LocalBase() = default;
201
203 : IndirectHandleBase(location) {}
204
205 template <typename S>
207
210 reinterpret_cast<internal::Isolate*>(isolate), value));
211 }
212
213 V8_INLINE static LocalBase<T> New(Isolate* isolate, T* that) {
215 return LocalBase<T>::New(isolate,
217 }
218
220 return LocalBase<T>(slot);
221 }
222
225 return LocalBase<T>(repr);
226 }
227};
228
229#endif // V8_ENABLE_DIRECT_HANDLE
230
260template <class T>
262#ifdef V8_ENABLE_LOCAL_OFF_STACK_CHECK
264#else
265 public api_internal::StackAllocated<false>
266#endif
267{
268 public:
272 V8_INLINE Local() = default;
273
279 template <class S>
280 requires std::is_base_of_v<T, S>
281 V8_INLINE Local(Local<S> that) : LocalBase<T>(that) {}
282
283 V8_INLINE T* operator->() const { return this->template value<T>(); }
284
285 V8_INLINE T* operator*() const { return this->operator->(); }
286
298 template <class S>
299 V8_INLINE bool operator==(const Local<S>& that) const {
300 return internal::HandleHelper::EqualHandles(*this, that);
301 }
302
303 template <class S>
304 V8_INLINE bool operator==(const PersistentBase<S>& that) const {
305 return internal::HandleHelper::EqualHandles(*this, that);
306 }
307
308 template <class S>
309 V8_INLINE bool operator!=(const Local<S>& that) const {
310 return !operator==(that);
311 }
312
313 template <class S>
314 V8_INLINE bool operator!=(const Persistent<S>& that) const {
315 return !operator==(that);
316 }
317
323 template <class S>
325#ifdef V8_ENABLE_CHECKS
326 // If we're going to perform the type check then we have to check
327 // that the handle isn't empty before doing the checked cast.
328 if (that.IsEmpty()) return Local<T>();
329 T::Cast(that.template value<S>());
330#endif
331 return Local<T>(LocalBase<T>(that));
332 }
333
339 template <class S>
341 return Local<S>::Cast(*this);
342 }
343
349 V8_INLINE static Local<T> New(Isolate* isolate, Local<T> that) {
350 return New(isolate, that.template value<T, true>());
351 }
352
353 V8_INLINE static Local<T> New(Isolate* isolate,
354 const PersistentBase<T>& that) {
355 return New(isolate, that.template value<T, true>());
356 }
357
358 V8_INLINE static Local<T> New(Isolate* isolate,
359 const BasicTracedReference<T>& that) {
360 return New(isolate, that.template value<T, true>());
361 }
362
363 private:
365 friend class Utils;
366 template <class F>
367 friend class Eternal;
368 template <class F>
369 friend class Global;
370 template <class F>
371 friend class Local;
372 template <class F>
373 friend class MaybeLocal;
374 template <class F, class M>
375 friend class Persistent;
376 template <class F>
378 template <class F>
380 friend class String;
381 friend class Object;
382 friend class Context;
383 friend class Isolate;
384 friend class Private;
385 template <class F>
387 friend Local<Primitive> Undefined(Isolate* isolate);
388 friend Local<Primitive> Null(Isolate* isolate);
389 friend Local<Boolean> True(Isolate* isolate);
390 friend Local<Boolean> False(Isolate* isolate);
391 friend class HandleScope;
394 template <class F1, class F2, class F3>
396 template <class F>
397 friend class ReturnValue;
398 template <class F>
399 friend class Traced;
400 friend class internal::SamplingHeapProfiler;
402 friend class debug::ConsoleCallArguments;
403 friend class internal::LocalUnchecked<T>;
404
405 explicit Local(no_checking_tag do_not_check)
406 : LocalBase<T>(), StackAllocated(do_not_check) {}
407 explicit Local(const Local<T>& other, no_checking_tag do_not_check)
408 : LocalBase<T>(other), StackAllocated(do_not_check) {}
409
410 V8_INLINE explicit Local(const LocalBase<T>& other) : LocalBase<T>(other) {}
411
412 V8_INLINE static Local<T> FromRepr(
413 internal::ValueHelper::InternalRepresentationType repr) {
414 return Local<T>(LocalBase<T>::FromRepr(repr));
415 }
416
417 V8_INLINE static Local<T> FromSlot(internal::Address* slot) {
418 return Local<T>(LocalBase<T>::FromSlot(slot));
419 }
420
421#ifdef V8_ENABLE_DIRECT_HANDLE
422 friend class TypecheckWitness;
423
424 V8_INLINE static Local<T> FromAddress(internal::Address ptr) {
425 return Local<T>(LocalBase<T>(ptr));
426 }
427#endif // V8_ENABLE_DIRECT_HANDLE
428
429 V8_INLINE static Local<T> New(Isolate* isolate, internal::Address value) {
430 return Local<T>(LocalBase<T>::New(isolate, value));
431 }
432
433 V8_INLINE static Local<T> New(Isolate* isolate, T* that) {
434 return Local<T>(LocalBase<T>::New(isolate, that));
435 }
436
437 // Unsafe cast, should be avoided.
438 template <class S>
439 V8_INLINE Local<S> UnsafeAs() const {
440 return Local<S>(LocalBase<S>(*this));
441 }
442};
443
444namespace internal {
445// A local variant that is suitable for off-stack allocation.
446// Used internally by LocalVector<T>. Not to be used directly!
447template <typename T>
449 public:
450 LocalUnchecked() : Local<T>(Local<T>::do_not_check) {}
451
452#if defined(V8_ENABLE_LOCAL_OFF_STACK_CHECK) && V8_HAS_ATTRIBUTE_TRIVIAL_ABI
453 // In this case, the check is also enforced in the copy constructor and we
454 // need to suppress it.
456 const LocalUnchecked& other) noexcept // NOLINT(runtime/explicit)
458 LocalUnchecked& operator=(const LocalUnchecked&) noexcept = default;
459#endif
460
461 // Implicit conversion from Local.
462 LocalUnchecked(const Local<T>& other) noexcept // NOLINT(runtime/explicit)
464};
465
466#ifdef V8_ENABLE_DIRECT_HANDLE
467// Off-stack allocated direct locals must be registered as strong roots.
468// For off-stack indirect locals, this is not necessary.
469
470template <typename T>
471class StrongRootAllocator<LocalUnchecked<T>> : public StrongRootAllocatorBase {
472 public:
473 using value_type = LocalUnchecked<T>;
474 static_assert(std::is_standard_layout_v<value_type>);
475 static_assert(sizeof(value_type) == sizeof(Address));
476
477 template <typename HeapOrIsolateT>
478 explicit StrongRootAllocator(HeapOrIsolateT* heap_or_isolate)
479 : StrongRootAllocatorBase(heap_or_isolate) {}
480 template <typename U>
481 StrongRootAllocator(const StrongRootAllocator<U>& other) noexcept
482 : StrongRootAllocatorBase(other) {}
483
484 value_type* allocate(size_t n) {
485 return reinterpret_cast<value_type*>(allocate_impl(n));
486 }
487 void deallocate(value_type* p, size_t n) noexcept {
488 return deallocate_impl(reinterpret_cast<Address*>(p), n);
489 }
490};
491#endif // V8_ENABLE_DIRECT_HANDLE
492} // namespace internal
493
494template <typename T>
496 private:
498
499#ifdef V8_ENABLE_DIRECT_HANDLE
500 using allocator_type = internal::StrongRootAllocator<element_type>;
501
502 static allocator_type make_allocator(Isolate* isolate) noexcept {
503 return allocator_type(isolate);
504 }
505#else
506 using allocator_type = std::allocator<element_type>;
507
508 static allocator_type make_allocator(Isolate* isolate) noexcept {
509 return allocator_type();
510 }
511#endif // V8_ENABLE_DIRECT_HANDLE
512
513 using vector_type = std::vector<element_type, allocator_type>;
514
515 public:
519 using size_type = size_t;
520 using difference_type = ptrdiff_t;
521 using iterator =
524 internal::WrappedIterator<typename vector_type::const_iterator,
525 const Local<T>>;
526
527 explicit LocalVector(Isolate* isolate) : backing_(make_allocator(isolate)) {}
528 LocalVector(Isolate* isolate, size_t n)
529 : backing_(n, make_allocator(isolate)) {}
530 explicit LocalVector(Isolate* isolate, std::initializer_list<Local<T>> init)
531 : backing_(make_allocator(isolate)) {
532 if (init.size() == 0) return;
533 backing_.reserve(init.size());
534 backing_.insert(backing_.end(), init.begin(), init.end());
535 }
536
537 iterator begin() noexcept { return iterator(backing_.begin()); }
538 const_iterator begin() const noexcept {
539 return const_iterator(backing_.begin());
540 }
541 iterator end() noexcept { return iterator(backing_.end()); }
542 const_iterator end() const noexcept { return const_iterator(backing_.end()); }
543
544 size_t size() const noexcept { return backing_.size(); }
545 bool empty() const noexcept { return backing_.empty(); }
546 void reserve(size_t n) { backing_.reserve(n); }
547 void shrink_to_fit() { backing_.shrink_to_fit(); }
548
549 Local<T>& operator[](size_t n) { return backing_[n]; }
550 const Local<T>& operator[](size_t n) const { return backing_[n]; }
551
552 Local<T>& at(size_t n) { return backing_.at(n); }
553 const Local<T>& at(size_t n) const { return backing_.at(n); }
554
555 Local<T>& front() { return backing_.front(); }
556 const Local<T>& front() const { return backing_.front(); }
557 Local<T>& back() { return backing_.back(); }
558 const Local<T>& back() const { return backing_.back(); }
559
560 Local<T>* data() noexcept { return backing_.data(); }
561 const Local<T>* data() const noexcept { return backing_.data(); }
562
564 return iterator(backing_.insert(pos.base(), value));
565 }
566
567 template <typename InputIt>
568 iterator insert(const_iterator pos, InputIt first, InputIt last) {
569 return iterator(backing_.insert(pos.base(), first, last));
570 }
571
572 iterator insert(const_iterator pos, std::initializer_list<Local<T>> init) {
573 return iterator(backing_.insert(pos.base(), init.begin(), init.end()));
574 }
575
576 LocalVector<T>& operator=(std::initializer_list<Local<T>> init) {
577 backing_.clear();
578 backing_.reserve(init.size());
579 backing_.insert(backing_.end(), init.begin(), init.end());
580 return *this;
581 }
582
583 void push_back(const Local<T>& x) { backing_.push_back(x); }
584 void pop_back() { backing_.pop_back(); }
585
586 template <typename... Args>
587 void emplace_back(Args&&... args) {
588 backing_.push_back(value_type{std::forward<Args>(args)...});
589 }
590
591 void clear() noexcept { backing_.clear(); }
592 void resize(size_t n) { backing_.resize(n); }
593 void swap(LocalVector<T>& other) { backing_.swap(other.backing_); }
594
595 friend bool operator==(const LocalVector<T>& x, const LocalVector<T>& y) {
596 return x.backing_ == y.backing_;
597 }
598 friend bool operator!=(const LocalVector<T>& x, const LocalVector<T>& y) {
599 return x.backing_ != y.backing_;
600 }
601 friend bool operator<(const LocalVector<T>& x, const LocalVector<T>& y) {
602 return x.backing_ < y.backing_;
603 }
604 friend bool operator>(const LocalVector<T>& x, const LocalVector<T>& y) {
605 return x.backing_ > y.backing_;
606 }
607 friend bool operator<=(const LocalVector<T>& x, const LocalVector<T>& y) {
608 return x.backing_ <= y.backing_;
609 }
610 friend bool operator>=(const LocalVector<T>& x, const LocalVector<T>& y) {
611 return x.backing_ >= y.backing_;
612 }
613
614 private:
615 vector_type backing_;
616};
617
618#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
619// Handle is an alias for Local for historical reasons.
620template <class T>
622#endif
623
634template <class T>
636 public:
644 template <class S>
645 requires std::is_base_of_v<T, S>
646 V8_INLINE MaybeLocal(Local<S> that) : local_(that) {}
650 template <class S>
651 requires std::is_base_of_v<T, S>
652 V8_INLINE MaybeLocal(MaybeLocal<S> that) : local_(that.local_) {}
653
654 V8_INLINE bool IsEmpty() const { return local_.IsEmpty(); }
655
660 template <class S>
662 *out = local_;
663 return !IsEmpty();
664 }
665
672 return local_;
673 }
674
679 template <class S>
680 V8_INLINE Local<S> FromMaybe(Local<S> default_value) const {
681 return IsEmpty() ? default_value : Local<S>(local_);
682 }
683
689 template <class S>
691 return MaybeLocal<T>{Local<T>::Cast(that.local_)};
692 }
693
699 template <class S>
701 return MaybeLocal<S>::Cast(*this);
702 }
703
704 private:
705 Local<T> local_;
706
707 template <typename S>
708 friend class MaybeLocal;
709};
710
716 public:
719
721 void operator=(const EscapableHandleScopeBase&) = delete;
722 void* operator new(size_t size) = delete;
723 void* operator new[](size_t size) = delete;
724 void operator delete(void*, size_t) = delete;
725 void operator delete[](void*, size_t) = delete;
726
727 protected:
733
734 private:
735 internal::Address* escape_slot_;
736};
737
739 : public EscapableHandleScopeBase {
740 public:
741 explicit EscapableHandleScope(Isolate* isolate)
742 : EscapableHandleScopeBase(isolate) {}
744 template <class T>
746#ifdef V8_ENABLE_DIRECT_HANDLE
747 return value;
748#else
749 if (value.IsEmpty()) return value;
750 return Local<T>::FromSlot(EscapeSlot(value.slot()));
751#endif
752 }
753
754 template <class T>
756 return Escape(value.FromMaybe(Local<T>()));
757 }
758};
759
766 public:
767 explicit SealHandleScope(Isolate* isolate);
769
771 void operator=(const SealHandleScope&) = delete;
772 void* operator new(size_t size) = delete;
773 void* operator new[](size_t size) = delete;
774 void operator delete(void*, size_t) = delete;
775 void operator delete[](void*, size_t) = delete;
776
777 private:
778 internal::Isolate* const i_isolate_;
779 internal::Address* prev_limit_;
780 int prev_sealed_level_;
781};
782
783} // namespace v8
784
785#endif // INCLUDE_V8_LOCAL_HANDLE_H_
Definition: v8-traced-handle.h:124
Definition: v8-context.h:48
Definition: v8-local-handle.h:715
EscapableHandleScopeBase(Isolate *isolate)
internal::Address * EscapeSlot(internal::Address *escape_value)
EscapableHandleScopeBase(const EscapableHandleScopeBase &)=delete
void operator=(const EscapableHandleScopeBase &)=delete
Definition: v8-local-handle.h:739
Local< T > Escape(Local< T > value)
Definition: v8-local-handle.h:745
MaybeLocal< T > EscapeMaybe(MaybeLocal< T > value)
Definition: v8-local-handle.h:755
EscapableHandleScope(Isolate *isolate)
Definition: v8-local-handle.h:741
Definition: v8-local-handle.h:97
HandleScope()=default
void operator=(const HandleScope &)=delete
void Initialize(Isolate *isolate)
HandleScope(const HandleScope &)=delete
Isolate * GetIsolate() const
Definition: v8-local-handle.h:108
static int NumberOfHandles(Isolate *isolate)
static internal::Address * CreateHandleForCurrentIsolate(internal::Address value)
static internal::Address * CreateHandle(internal::Isolate *i_isolate, internal::Address value)
HandleScope(Isolate *isolate)
Definition: v8-isolate.h:274
Definition: v8-local-handle.h:195
static LocalBase< T > New(Isolate *isolate, T *that)
Definition: v8-local-handle.h:213
static LocalBase< T > FromSlot(internal::Address *slot)
Definition: v8-local-handle.h:219
LocalBase(const LocalBase< S > &other)
Definition: v8-local-handle.h:206
static LocalBase< T > FromRepr(internal::ValueHelper::InternalRepresentationType repr)
Definition: v8-local-handle.h:223
LocalBase(internal::Address *location)
Definition: v8-local-handle.h:202
LocalBase()=default
static LocalBase< T > New(Isolate *isolate, internal::Address value)
Definition: v8-local-handle.h:208
Definition: v8-local-handle.h:495
LocalVector< T > & operator=(std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:576
const Local< T > & front() const
Definition: v8-local-handle.h:556
friend bool operator>=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:610
bool empty() const noexcept
Definition: v8-local-handle.h:545
const Local< T > * data() const noexcept
Definition: v8-local-handle.h:561
const_iterator end() const noexcept
Definition: v8-local-handle.h:542
const Local< T > & operator[](size_t n) const
Definition: v8-local-handle.h:550
friend bool operator<(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:601
const Local< T > & back() const
Definition: v8-local-handle.h:558
void shrink_to_fit()
Definition: v8-local-handle.h:547
Local< T > * data() noexcept
Definition: v8-local-handle.h:560
void reserve(size_t n)
Definition: v8-local-handle.h:546
Local< T > & front()
Definition: v8-local-handle.h:555
internal::WrappedIterator< typename vector_type::iterator, Local< T > > iterator
Definition: v8-local-handle.h:522
friend bool operator<=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:607
friend bool operator!=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:598
Local< T > & operator[](size_t n)
Definition: v8-local-handle.h:549
size_t size_type
Definition: v8-local-handle.h:519
void emplace_back(Args &&... args)
Definition: v8-local-handle.h:587
const_iterator begin() const noexcept
Definition: v8-local-handle.h:538
iterator insert(const_iterator pos, std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:572
Local< T > & at(size_t n)
Definition: v8-local-handle.h:552
ptrdiff_t difference_type
Definition: v8-local-handle.h:520
iterator insert(const_iterator pos, const Local< T > &value)
Definition: v8-local-handle.h:563
internal::WrappedIterator< typename vector_type::const_iterator, const Local< T > > const_iterator
Definition: v8-local-handle.h:525
void pop_back()
Definition: v8-local-handle.h:584
LocalVector(Isolate *isolate, std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:530
iterator end() noexcept
Definition: v8-local-handle.h:541
const Local< T > & at(size_t n) const
Definition: v8-local-handle.h:553
void clear() noexcept
Definition: v8-local-handle.h:591
void swap(LocalVector< T > &other)
Definition: v8-local-handle.h:593
iterator insert(const_iterator pos, InputIt first, InputIt last)
Definition: v8-local-handle.h:568
friend bool operator==(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:595
LocalVector(Isolate *isolate)
Definition: v8-local-handle.h:527
size_t size() const noexcept
Definition: v8-local-handle.h:544
void resize(size_t n)
Definition: v8-local-handle.h:592
Local< T > & back()
Definition: v8-local-handle.h:557
LocalVector(Isolate *isolate, size_t n)
Definition: v8-local-handle.h:528
void push_back(const Local< T > &x)
Definition: v8-local-handle.h:583
iterator begin() noexcept
Definition: v8-local-handle.h:537
friend bool operator>(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:604
Definition: v8-local-handle.h:267
friend class TracedReferenceBase
Definition: v8-local-handle.h:364
friend class Object
Definition: v8-local-handle.h:381
friend class PersistentValueMapBase
Definition: v8-local-handle.h:395
static Local< T > New(Isolate *isolate, const PersistentBase< T > &that)
Definition: v8-local-handle.h:353
friend class PropertyCallbackInfo
Definition: v8-local-handle.h:379
friend class ReturnValue
Definition: v8-local-handle.h:397
friend class HandleScope
Definition: v8-local-handle.h:391
friend class Traced
Definition: v8-local-handle.h:399
T * operator*() const
Definition: v8-local-handle.h:285
static Local< T > Cast(Local< S > that)
Definition: v8-local-handle.h:324
Local()=default
friend class FunctionCallbackInfo
Definition: v8-local-handle.h:377
Local< S > As() const
Definition: v8-local-handle.h:340
friend class String
Definition: v8-local-handle.h:380
bool operator!=(const Local< S > &that) const
Definition: v8-local-handle.h:309
friend class MaybeLocal
Definition: v8-local-handle.h:373
static Local< T > New(Isolate *isolate, const BasicTracedReference< T > &that)
Definition: v8-local-handle.h:358
bool operator==(const PersistentBase< S > &that) const
Definition: v8-local-handle.h:304
bool operator!=(const Persistent< S > &that) const
Definition: v8-local-handle.h:314
friend class Isolate
Definition: v8-local-handle.h:383
friend class Utils
Definition: v8-local-handle.h:365
static Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8-local-handle.h:349
friend class Context
Definition: v8-local-handle.h:382
friend class Private
Definition: v8-local-handle.h:384
friend class Persistent
Definition: v8-local-handle.h:375
friend class Global
Definition: v8-local-handle.h:369
T * operator->() const
Definition: v8-local-handle.h:283
friend class EscapableHandleScope
Definition: v8-local-handle.h:392
friend class Eternal
Definition: v8-local-handle.h:367
bool operator==(const Local< S > &that) const
Definition: v8-local-handle.h:299
Local(Local< S > that)
Definition: v8-local-handle.h:281
friend class InternalEscapableScope
Definition: v8-local-handle.h:393
friend class Local
Definition: v8-local-handle.h:371
Definition: v8-local-handle.h:635
bool ToLocal(Local< S > *out) const
Definition: v8-local-handle.h:661
static MaybeLocal< T > Cast(MaybeLocal< S > that)
Definition: v8-local-handle.h:690
MaybeLocal< S > As() const
Definition: v8-local-handle.h:700
Local< T > ToLocalChecked()
Definition: v8-local-handle.h:670
Local< S > FromMaybe(Local< S > default_value) const
Definition: v8-local-handle.h:680
MaybeLocal()=default
bool IsEmpty() const
Definition: v8-local-handle.h:654
MaybeLocal(Local< S > that)
Definition: v8-local-handle.h:646
MaybeLocal(MaybeLocal< S > that)
Definition: v8-local-handle.h:652
Definition: v8-object.h:233
Definition: v8-persistent-handle.h:93
Definition: v8-persistent-handle.h:250
Definition: v8-local-handle.h:765
SealHandleScope(const SealHandleScope &)=delete
void operator=(const SealHandleScope &)=delete
SealHandleScope(Isolate *isolate)
Definition: v8-local-handle.h:62
Definition: v8-value.h:515
Definition: v8-handle-base.h:57
T * value() const
Definition: v8-handle-base.h:89
internal::Address ptr() const
Definition: v8-handle-base.h:80
internal::Address *const & slot() const
Definition: v8-handle-base.h:83
bool IsEmpty() const
Definition: v8-handle-base.h:60
internal::ValueHelper::InternalRepresentationType repr() const
Definition: v8-handle-base.h:98
Definition: v8-handle-base.h:13
Definition: v8-local-handle.h:72
Definition: v8-internal.h:1701
Definition: v8-local-handle.h:448
LocalUnchecked()
Definition: v8-local-handle.h:450
LocalUnchecked(const Local< T > &other) noexcept
Definition: v8-local-handle.h:462
Definition: v8-internal.h:1383
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1675
internal::Address * InternalRepresentationType
Definition: v8-internal.h:1629
static bool IsEmpty(T *value)
Definition: v8-internal.h:1634
Definition: v8-internal.h:1442
constexpr const Iterator & base() const noexcept
Definition: v8-internal.h:1606
internal::BasicPersistent< T, internal::StrongPersistentPolicy > Persistent
Definition: persistent.h:363
uintptr_t Address
Definition: v8-internal.h:52
Definition: libplatform.h:15
Local< Primitive > Null(Isolate *isolate)
Definition: v8-primitive.h:1063
Local< Primitive > Undefined(Isolate *isolate)
Definition: v8-primitive.h:1055
Local< Boolean > False(Isolate *isolate)
Definition: v8-primitive.h:1079
Local< Boolean > True(Isolate *isolate)
Definition: v8-primitive.h:1071
#define V8_EXPORT
Definition: v8config.h:800
#define V8_INLINE
Definition: v8config.h:500
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:671
#define V8_UNLIKELY(condition)
Definition: v8config.h:660
#define V8_TRIVIAL_ABI
Definition: v8config.h:754
#define V8_NODISCARD
Definition: v8config.h:693