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 return LocalBase<T>(*slot);
183 }
184
185 V8_INLINE static LocalBase<T> FromRepr(
187 return LocalBase<T>(repr);
188 }
189};
190
191#else // !V8_ENABLE_DIRECT_HANDLE
192
193template <typename T>
195 protected:
196 template <class F>
197 friend class Local;
198
199 V8_INLINE LocalBase() = default;
200
202 : IndirectHandleBase(location) {}
203
204 template <typename S>
206
209 reinterpret_cast<internal::Isolate*>(isolate), value));
210 }
211
212 V8_INLINE static LocalBase<T> New(Isolate* isolate, T* that) {
214 return LocalBase<T>::New(isolate,
216 }
217
219 return LocalBase<T>(slot);
220 }
221
224 return LocalBase<T>(repr);
225 }
226};
227
228#endif // V8_ENABLE_DIRECT_HANDLE
229
259template <class T>
261#ifdef V8_ENABLE_LOCAL_OFF_STACK_CHECK
263#else
264 public api_internal::StackAllocated<false>
265#endif
266{
267 public:
268 V8_INLINE Local() = default;
269
270 template <class S>
277 static_assert(std::is_base_of<T, S>::value, "type check");
278 }
279
280 V8_INLINE T* operator->() const { return this->template value<T>(); }
281
282 V8_INLINE T* operator*() const { return this->operator->(); }
283
295 template <class S>
296 V8_INLINE bool operator==(const Local<S>& that) const {
297 return internal::HandleHelper::EqualHandles(*this, that);
298 }
299
300 template <class S>
301 V8_INLINE bool operator==(const PersistentBase<S>& that) const {
302 return internal::HandleHelper::EqualHandles(*this, that);
303 }
304
305 template <class S>
306 V8_INLINE bool operator!=(const Local<S>& that) const {
307 return !operator==(that);
308 }
309
310 template <class S>
311 V8_INLINE bool operator!=(const Persistent<S>& that) const {
312 return !operator==(that);
313 }
314
320 template <class S>
322#ifdef V8_ENABLE_CHECKS
323 // If we're going to perform the type check then we have to check
324 // that the handle isn't empty before doing the checked cast.
325 if (that.IsEmpty()) return Local<T>();
326 T::Cast(that.template value<S>());
327#endif
328 return Local<T>(LocalBase<T>(that));
329 }
330
336 template <class S>
338 return Local<S>::Cast(*this);
339 }
340
346 V8_INLINE static Local<T> New(Isolate* isolate, Local<T> that) {
347 return New(isolate, that.template value<T, true>());
348 }
349
350 V8_INLINE static Local<T> New(Isolate* isolate,
351 const PersistentBase<T>& that) {
352 return New(isolate, that.template value<T, true>());
353 }
354
355 V8_INLINE static Local<T> New(Isolate* isolate,
356 const BasicTracedReference<T>& that) {
357 return New(isolate, that.template value<T, true>());
358 }
359
360 private:
362 friend class Utils;
363 template <class F>
364 friend class Eternal;
365 template <class F>
366 friend class Global;
367 template <class F>
368 friend class Local;
369 template <class F>
370 friend class MaybeLocal;
371 template <class F, class M>
372 friend class Persistent;
373 template <class F>
375 template <class F>
377 friend class String;
378 friend class Object;
379 friend class Context;
380 friend class Isolate;
381 friend class Private;
382 template <class F>
384 friend Local<Primitive> Undefined(Isolate* isolate);
385 friend Local<Primitive> Null(Isolate* isolate);
386 friend Local<Boolean> True(Isolate* isolate);
387 friend Local<Boolean> False(Isolate* isolate);
388 friend class HandleScope;
391 template <class F1, class F2, class F3>
393 template <class F>
394 friend class ReturnValue;
395 template <class F>
396 friend class Traced;
397 friend class internal::SamplingHeapProfiler;
399 friend class debug::ConsoleCallArguments;
400 friend class internal::LocalUnchecked<T>;
401
402 explicit Local(no_checking_tag do_not_check)
403 : LocalBase<T>(), StackAllocated(do_not_check) {}
404 explicit Local(const Local<T>& other, no_checking_tag do_not_check)
405 : LocalBase<T>(other), StackAllocated(do_not_check) {}
406
407 V8_INLINE explicit Local(const LocalBase<T>& other) : LocalBase<T>(other) {}
408
409 V8_INLINE static Local<T> FromRepr(
410 internal::ValueHelper::InternalRepresentationType repr) {
411 return Local<T>(LocalBase<T>::FromRepr(repr));
412 }
413
414 V8_INLINE static Local<T> FromSlot(internal::Address* slot) {
415 return Local<T>(LocalBase<T>::FromSlot(slot));
416 }
417
418#ifdef V8_ENABLE_DIRECT_HANDLE
419 friend class TypecheckWitness;
420
421 V8_INLINE static Local<T> FromAddress(internal::Address ptr) {
422 return Local<T>(LocalBase<T>(ptr));
423 }
424#endif // V8_ENABLE_DIRECT_HANDLE
425
426 V8_INLINE static Local<T> New(Isolate* isolate, internal::Address value) {
427 return Local<T>(LocalBase<T>::New(isolate, value));
428 }
429
430 V8_INLINE static Local<T> New(Isolate* isolate, T* that) {
431 return Local<T>(LocalBase<T>::New(isolate, that));
432 }
433
434 // Unsafe cast, should be avoided.
435 template <class S>
436 V8_INLINE Local<S> UnsafeAs() const {
437 return Local<S>(LocalBase<S>(*this));
438 }
439};
440
441namespace internal {
442// A local variant that is suitable for off-stack allocation.
443// Used internally by LocalVector<T>. Not to be used directly!
444template <typename T>
446 public:
447 LocalUnchecked() : Local<T>(Local<T>::do_not_check) {}
448
449#if defined(V8_ENABLE_LOCAL_OFF_STACK_CHECK) && V8_HAS_ATTRIBUTE_TRIVIAL_ABI
450 // In this case, the check is also enforced in the copy constructor and we
451 // need to suppress it.
453 const LocalUnchecked& other) noexcept // NOLINT(runtime/explicit)
455 LocalUnchecked& operator=(const LocalUnchecked&) noexcept = default;
456#endif
457
458 // Implicit conversion from Local.
459 LocalUnchecked(const Local<T>& other) noexcept // NOLINT(runtime/explicit)
461};
462
463#ifdef V8_ENABLE_DIRECT_HANDLE
464// Off-stack allocated direct locals must be registered as strong roots.
465// For off-stack indirect locals, this is not necessary.
466
467template <typename T>
468class StrongRootAllocator<LocalUnchecked<T>> : public StrongRootAllocatorBase {
469 public:
470 using value_type = LocalUnchecked<T>;
471 static_assert(std::is_standard_layout_v<value_type>);
472 static_assert(sizeof(value_type) == sizeof(Address));
473
474 template <typename HeapOrIsolateT>
475 explicit StrongRootAllocator(HeapOrIsolateT* heap_or_isolate)
476 : StrongRootAllocatorBase(heap_or_isolate) {}
477 template <typename U>
478 StrongRootAllocator(const StrongRootAllocator<U>& other) noexcept
479 : StrongRootAllocatorBase(other) {}
480
481 value_type* allocate(size_t n) {
482 return reinterpret_cast<value_type*>(allocate_impl(n));
483 }
484 void deallocate(value_type* p, size_t n) noexcept {
485 return deallocate_impl(reinterpret_cast<Address*>(p), n);
486 }
487};
488#endif // V8_ENABLE_DIRECT_HANDLE
489} // namespace internal
490
491template <typename T>
493 private:
495
496#ifdef V8_ENABLE_DIRECT_HANDLE
497 using allocator_type = internal::StrongRootAllocator<element_type>;
498
499 static allocator_type make_allocator(Isolate* isolate) noexcept {
500 return allocator_type(isolate);
501 }
502#else
503 using allocator_type = std::allocator<element_type>;
504
505 static allocator_type make_allocator(Isolate* isolate) noexcept {
506 return allocator_type();
507 }
508#endif // V8_ENABLE_DIRECT_HANDLE
509
510 using vector_type = std::vector<element_type, allocator_type>;
511
512 public:
516 using size_type = size_t;
517 using difference_type = ptrdiff_t;
518 using iterator =
521 internal::WrappedIterator<typename vector_type::const_iterator,
522 const Local<T>>;
523
524 explicit LocalVector(Isolate* isolate) : backing_(make_allocator(isolate)) {}
525 LocalVector(Isolate* isolate, size_t n)
526 : backing_(n, make_allocator(isolate)) {}
527 explicit LocalVector(Isolate* isolate, std::initializer_list<Local<T>> init)
528 : backing_(make_allocator(isolate)) {
529 if (init.size() == 0) return;
530 backing_.reserve(init.size());
531 backing_.insert(backing_.end(), init.begin(), init.end());
532 }
533
534 iterator begin() noexcept { return iterator(backing_.begin()); }
535 const_iterator begin() const noexcept {
536 return const_iterator(backing_.begin());
537 }
538 iterator end() noexcept { return iterator(backing_.end()); }
539 const_iterator end() const noexcept { return const_iterator(backing_.end()); }
540
541 size_t size() const noexcept { return backing_.size(); }
542 bool empty() const noexcept { return backing_.empty(); }
543 void reserve(size_t n) { backing_.reserve(n); }
544 void shrink_to_fit() { backing_.shrink_to_fit(); }
545
546 Local<T>& operator[](size_t n) { return backing_[n]; }
547 const Local<T>& operator[](size_t n) const { return backing_[n]; }
548
549 Local<T>& at(size_t n) { return backing_.at(n); }
550 const Local<T>& at(size_t n) const { return backing_.at(n); }
551
552 Local<T>& front() { return backing_.front(); }
553 const Local<T>& front() const { return backing_.front(); }
554 Local<T>& back() { return backing_.back(); }
555 const Local<T>& back() const { return backing_.back(); }
556
557 Local<T>* data() noexcept { return backing_.data(); }
558 const Local<T>* data() const noexcept { return backing_.data(); }
559
561 return iterator(backing_.insert(pos.base(), value));
562 }
563
564 template <typename InputIt>
565 iterator insert(const_iterator pos, InputIt first, InputIt last) {
566 return iterator(backing_.insert(pos.base(), first, last));
567 }
568
569 iterator insert(const_iterator pos, std::initializer_list<Local<T>> init) {
570 return iterator(backing_.insert(pos.base(), init.begin(), init.end()));
571 }
572
573 LocalVector<T>& operator=(std::initializer_list<Local<T>> init) {
574 backing_.clear();
575 backing_.reserve(init.size());
576 backing_.insert(backing_.end(), init.begin(), init.end());
577 return *this;
578 }
579
580 void push_back(const Local<T>& x) { backing_.push_back(x); }
581 void pop_back() { backing_.pop_back(); }
582
583 template <typename... Args>
584 void emplace_back(Args&&... args) {
585 backing_.push_back(value_type{std::forward<Args>(args)...});
586 }
587
588 void clear() noexcept { backing_.clear(); }
589 void resize(size_t n) { backing_.resize(n); }
590 void swap(LocalVector<T>& other) { backing_.swap(other.backing_); }
591
592 friend bool operator==(const LocalVector<T>& x, const LocalVector<T>& y) {
593 return x.backing_ == y.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
611 private:
612 vector_type backing_;
613};
614
615#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
616// Handle is an alias for Local for historical reasons.
617template <class T>
619#endif
620
631template <class T>
633 public:
634 V8_INLINE MaybeLocal() : local_() {}
635 template <class S>
636 V8_INLINE MaybeLocal(Local<S> that) : local_(that) {}
637
638 V8_INLINE bool IsEmpty() const { return local_.IsEmpty(); }
639
644 template <class S>
646 *out = local_;
647 return !IsEmpty();
648 }
649
656 return local_;
657 }
658
663 template <class S>
664 V8_INLINE Local<S> FromMaybe(Local<S> default_value) const {
665 return IsEmpty() ? default_value : Local<S>(local_);
666 }
667
673 template <class S>
675#ifdef V8_ENABLE_CHECKS
676 // If we're going to perform the type check then we have to check
677 // that the handle isn't empty before doing the checked cast.
678 if (that.IsEmpty()) return MaybeLocal<T>();
679 T::Cast(that.local_.template value<S>());
680#endif
681 return MaybeLocal<T>(that.local_);
682 }
683
689 template <class S>
691 return MaybeLocal<S>::Cast(*this);
692 }
693
694 private:
695 Local<T> local_;
696
697 template <typename S>
698 friend class MaybeLocal;
699};
700
706 public:
709
711 void operator=(const EscapableHandleScopeBase&) = delete;
712 void* operator new(size_t size) = delete;
713 void* operator new[](size_t size) = delete;
714 void operator delete(void*, size_t) = delete;
715 void operator delete[](void*, size_t) = delete;
716
717 protected:
723
724 private:
725 internal::Address* escape_slot_;
726};
727
729 : public EscapableHandleScopeBase {
730 public:
731 explicit EscapableHandleScope(Isolate* isolate)
732 : EscapableHandleScopeBase(isolate) {}
734 template <class T>
736#ifdef V8_ENABLE_DIRECT_HANDLE
737 return value;
738#else
739 if (value.IsEmpty()) return value;
740 return Local<T>::FromSlot(EscapeSlot(value.slot()));
741#endif
742 }
743
744 template <class T>
746 return Escape(value.FromMaybe(Local<T>()));
747 }
748};
749
756 public:
757 explicit SealHandleScope(Isolate* isolate);
759
761 void operator=(const SealHandleScope&) = delete;
762 void* operator new(size_t size) = delete;
763 void* operator new[](size_t size) = delete;
764 void operator delete(void*, size_t) = delete;
765 void operator delete[](void*, size_t) = delete;
766
767 private:
768 internal::Isolate* const i_isolate_;
769 internal::Address* prev_limit_;
770 int prev_sealed_level_;
771};
772
773} // namespace v8
774
775#endif // INCLUDE_V8_LOCAL_HANDLE_H_
Definition: v8-traced-handle.h:124
Definition: v8-context.h:48
Definition: v8-local-handle.h:705
EscapableHandleScopeBase(Isolate *isolate)
internal::Address * EscapeSlot(internal::Address *escape_value)
EscapableHandleScopeBase(const EscapableHandleScopeBase &)=delete
void operator=(const EscapableHandleScopeBase &)=delete
Definition: v8-local-handle.h:729
Local< T > Escape(Local< T > value)
Definition: v8-local-handle.h:735
MaybeLocal< T > EscapeMaybe(MaybeLocal< T > value)
Definition: v8-local-handle.h:745
EscapableHandleScope(Isolate *isolate)
Definition: v8-local-handle.h:731
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:261
Definition: v8-local-handle.h:194
static LocalBase< T > New(Isolate *isolate, T *that)
Definition: v8-local-handle.h:212
static LocalBase< T > FromSlot(internal::Address *slot)
Definition: v8-local-handle.h:218
LocalBase(const LocalBase< S > &other)
Definition: v8-local-handle.h:205
static LocalBase< T > FromRepr(internal::ValueHelper::InternalRepresentationType repr)
Definition: v8-local-handle.h:222
LocalBase(internal::Address *location)
Definition: v8-local-handle.h:201
LocalBase()=default
static LocalBase< T > New(Isolate *isolate, internal::Address value)
Definition: v8-local-handle.h:207
Definition: v8-local-handle.h:492
LocalVector< T > & operator=(std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:573
const Local< T > & front() const
Definition: v8-local-handle.h:553
friend bool operator>=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:607
bool empty() const noexcept
Definition: v8-local-handle.h:542
const Local< T > * data() const noexcept
Definition: v8-local-handle.h:558
const_iterator end() const noexcept
Definition: v8-local-handle.h:539
const Local< T > & operator[](size_t n) const
Definition: v8-local-handle.h:547
friend bool operator<(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:598
const Local< T > & back() const
Definition: v8-local-handle.h:555
void shrink_to_fit()
Definition: v8-local-handle.h:544
Local< T > * data() noexcept
Definition: v8-local-handle.h:557
void reserve(size_t n)
Definition: v8-local-handle.h:543
Local< T > & front()
Definition: v8-local-handle.h:552
internal::WrappedIterator< typename vector_type::iterator, Local< T > > iterator
Definition: v8-local-handle.h:519
friend bool operator<=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:604
friend bool operator!=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:595
Local< T > & operator[](size_t n)
Definition: v8-local-handle.h:546
size_t size_type
Definition: v8-local-handle.h:516
void emplace_back(Args &&... args)
Definition: v8-local-handle.h:584
const_iterator begin() const noexcept
Definition: v8-local-handle.h:535
iterator insert(const_iterator pos, std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:569
Local< T > & at(size_t n)
Definition: v8-local-handle.h:549
ptrdiff_t difference_type
Definition: v8-local-handle.h:517
iterator insert(const_iterator pos, const Local< T > &value)
Definition: v8-local-handle.h:560
internal::WrappedIterator< typename vector_type::const_iterator, const Local< T > > const_iterator
Definition: v8-local-handle.h:522
void pop_back()
Definition: v8-local-handle.h:581
LocalVector(Isolate *isolate, std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:527
iterator end() noexcept
Definition: v8-local-handle.h:538
const Local< T > & at(size_t n) const
Definition: v8-local-handle.h:550
void clear() noexcept
Definition: v8-local-handle.h:588
void swap(LocalVector< T > &other)
Definition: v8-local-handle.h:590
iterator insert(const_iterator pos, InputIt first, InputIt last)
Definition: v8-local-handle.h:565
friend bool operator==(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:592
LocalVector(Isolate *isolate)
Definition: v8-local-handle.h:524
size_t size() const noexcept
Definition: v8-local-handle.h:541
void resize(size_t n)
Definition: v8-local-handle.h:589
Local< T > & back()
Definition: v8-local-handle.h:554
LocalVector(Isolate *isolate, size_t n)
Definition: v8-local-handle.h:525
void push_back(const Local< T > &x)
Definition: v8-local-handle.h:580
iterator begin() noexcept
Definition: v8-local-handle.h:534
friend bool operator>(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:601
Definition: v8-local-handle.h:266
friend class TracedReferenceBase
Definition: v8-local-handle.h:361
friend class Object
Definition: v8-local-handle.h:378
friend class PersistentValueMapBase
Definition: v8-local-handle.h:392
static Local< T > New(Isolate *isolate, const PersistentBase< T > &that)
Definition: v8-local-handle.h:350
friend class PropertyCallbackInfo
Definition: v8-local-handle.h:376
friend class ReturnValue
Definition: v8-local-handle.h:394
friend class HandleScope
Definition: v8-local-handle.h:388
friend class Traced
Definition: v8-local-handle.h:396
T * operator*() const
Definition: v8-local-handle.h:282
static Local< T > Cast(Local< S > that)
Definition: v8-local-handle.h:321
Local()=default
friend class FunctionCallbackInfo
Definition: v8-local-handle.h:374
Local< S > As() const
Definition: v8-local-handle.h:337
friend class String
Definition: v8-local-handle.h:377
bool operator!=(const Local< S > &that) const
Definition: v8-local-handle.h:306
friend class MaybeLocal
Definition: v8-local-handle.h:370
static Local< T > New(Isolate *isolate, const BasicTracedReference< T > &that)
Definition: v8-local-handle.h:355
bool operator==(const PersistentBase< S > &that) const
Definition: v8-local-handle.h:301
bool operator!=(const Persistent< S > &that) const
Definition: v8-local-handle.h:311
friend class Isolate
Definition: v8-local-handle.h:380
friend class Utils
Definition: v8-local-handle.h:362
static Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8-local-handle.h:346
friend class Context
Definition: v8-local-handle.h:379
friend class Private
Definition: v8-local-handle.h:381
friend class Persistent
Definition: v8-local-handle.h:372
friend class Global
Definition: v8-local-handle.h:366
T * operator->() const
Definition: v8-local-handle.h:280
friend class EscapableHandleScope
Definition: v8-local-handle.h:389
friend class Eternal
Definition: v8-local-handle.h:364
bool operator==(const Local< S > &that) const
Definition: v8-local-handle.h:296
friend class InternalEscapableScope
Definition: v8-local-handle.h:390
Local(Local< S > that)
Definition: v8-local-handle.h:271
friend class Local
Definition: v8-local-handle.h:368
Definition: v8-local-handle.h:632
bool ToLocal(Local< S > *out) const
Definition: v8-local-handle.h:645
static MaybeLocal< T > Cast(MaybeLocal< S > that)
Definition: v8-local-handle.h:674
MaybeLocal< S > As() const
Definition: v8-local-handle.h:690
Local< T > ToLocalChecked()
Definition: v8-local-handle.h:654
Local< S > FromMaybe(Local< S > default_value) const
Definition: v8-local-handle.h:664
MaybeLocal()
Definition: v8-local-handle.h:634
bool IsEmpty() const
Definition: v8-local-handle.h:638
MaybeLocal(Local< S > that)
Definition: v8-local-handle.h:636
Definition: v8-object.h:233
Definition: v8-persistent-handle.h:89
Definition: v8-persistent-handle.h:246
Definition: v8-local-handle.h:755
SealHandleScope(const SealHandleScope &)=delete
void operator=(const SealHandleScope &)=delete
SealHandleScope(Isolate *isolate)
Definition: v8-local-handle.h:62
Definition: v8-value.h:502
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:1651
Definition: v8-local-handle.h:445
LocalUnchecked()
Definition: v8-local-handle.h:447
LocalUnchecked(const Local< T > &other) noexcept
Definition: v8-local-handle.h:459
Definition: v8-internal.h:1337
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1625
internal::Address * InternalRepresentationType
Definition: v8-internal.h:1579
static bool IsEmpty(T *value)
Definition: v8-internal.h:1584
Definition: v8-internal.h:1396
constexpr const Iterator & base() const noexcept
Definition: v8-internal.h:1556
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:1029
Local< Primitive > Undefined(Isolate *isolate)
Definition: v8-primitive.h:1021
Local< Boolean > False(Isolate *isolate)
Definition: v8-primitive.h:1045
Local< Boolean > True(Isolate *isolate)
Definition: v8-primitive.h:1037
#define V8_EXPORT
Definition: v8config.h:793
#define V8_INLINE
Definition: v8config.h:499
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:660
#define V8_UNLIKELY(condition)
Definition: v8config.h:649
#define V8_TRIVIAL_ABI
Definition: v8config.h:743
#define V8_NODISCARD
Definition: v8config.h:682