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_LOCAL
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
186#else // !V8_ENABLE_DIRECT_LOCAL
187
188template <typename T>
190 protected:
191 template <class F>
192 friend class Local;
193
194 V8_INLINE LocalBase() = default;
195
197 : IndirectHandleBase(location) {}
198
199 template <typename S>
201
204 reinterpret_cast<internal::Isolate*>(isolate), value));
205 }
206
207 V8_INLINE static LocalBase<T> New(Isolate* isolate, T* that) {
209 return LocalBase<T>::New(isolate,
211 }
212
214 return LocalBase<T>(slot);
215 }
216};
217
218#endif // V8_ENABLE_DIRECT_LOCAL
219
249template <class T>
251#ifdef V8_ENABLE_LOCAL_OFF_STACK_CHECK
253#else
254 public api_internal::StackAllocated<false>
255#endif
256{
257 public:
258 V8_INLINE Local() = default;
259
260 template <class S>
267 static_assert(std::is_base_of<T, S>::value, "type check");
268 }
269
270 V8_INLINE T* operator->() const { return this->template value<T>(); }
271
272 V8_INLINE T* operator*() const { return this->operator->(); }
273
285 template <class S>
286 V8_INLINE bool operator==(const Local<S>& that) const {
287 return internal::HandleHelper::EqualHandles(*this, that);
288 }
289
290 template <class S>
291 V8_INLINE bool operator==(const PersistentBase<S>& that) const {
292 return internal::HandleHelper::EqualHandles(*this, that);
293 }
294
295 template <class S>
296 V8_INLINE bool operator!=(const Local<S>& that) const {
297 return !operator==(that);
298 }
299
300 template <class S>
301 V8_INLINE bool operator!=(const Persistent<S>& that) const {
302 return !operator==(that);
303 }
304
310 template <class S>
312#ifdef V8_ENABLE_CHECKS
313 // If we're going to perform the type check then we have to check
314 // that the handle isn't empty before doing the checked cast.
315 if (that.IsEmpty()) return Local<T>();
316 T::Cast(that.template value<S>());
317#endif
318 return Local<T>(LocalBase<T>(that));
319 }
320
326 template <class S>
328 return Local<S>::Cast(*this);
329 }
330
336 V8_INLINE static Local<T> New(Isolate* isolate, Local<T> that) {
337 return New(isolate, that.template value<T, true>());
338 }
339
340 V8_INLINE static Local<T> New(Isolate* isolate,
341 const PersistentBase<T>& that) {
342 return New(isolate, that.template value<T, true>());
343 }
344
345 V8_INLINE static Local<T> New(Isolate* isolate,
346 const BasicTracedReference<T>& that) {
347 return New(isolate, that.template value<T, true>());
348 }
349
350 private:
352 friend class Utils;
353 template <class F>
354 friend class Eternal;
355 template <class F>
356 friend class Global;
357 template <class F>
358 friend class Local;
359 template <class F>
360 friend class MaybeLocal;
361 template <class F, class M>
362 friend class Persistent;
363 template <class F>
365 template <class F>
367 friend class String;
368 friend class Object;
369 friend class Context;
370 friend class Isolate;
371 friend class Private;
372 template <class F>
374 friend Local<Primitive> Undefined(Isolate* isolate);
375 friend Local<Primitive> Null(Isolate* isolate);
376 friend Local<Boolean> True(Isolate* isolate);
377 friend Local<Boolean> False(Isolate* isolate);
378 friend class HandleScope;
381 template <class F1, class F2, class F3>
383 template <class F>
384 friend class ReturnValue;
385 template <class F>
386 friend class Traced;
387 friend class internal::SamplingHeapProfiler;
389 friend class debug::ConsoleCallArguments;
390 friend class internal::LocalUnchecked<T>;
391
392 explicit Local(no_checking_tag do_not_check)
393 : LocalBase<T>(), StackAllocated(do_not_check) {}
394 explicit Local(const Local<T>& other, no_checking_tag do_not_check)
395 : LocalBase<T>(other), StackAllocated(do_not_check) {}
396
397 V8_INLINE explicit Local<T>(const LocalBase<T>& other)
398 : LocalBase<T>(other) {}
399
400 V8_INLINE static Local<T> FromSlot(internal::Address* slot) {
401 return Local<T>(LocalBase<T>::FromSlot(slot));
402 }
403
404#ifdef V8_ENABLE_DIRECT_LOCAL
405 friend class TypecheckWitness;
406
407 V8_INLINE static Local<T> FromAddress(internal::Address ptr) {
408 return Local<T>(LocalBase<T>(ptr));
409 }
410#endif // V8_ENABLE_DIRECT_LOCAL
411
412 V8_INLINE static Local<T> New(Isolate* isolate, internal::Address value) {
413 return Local<T>(LocalBase<T>::New(isolate, value));
414 }
415
416 V8_INLINE static Local<T> New(Isolate* isolate, T* that) {
417 return Local<T>(LocalBase<T>::New(isolate, that));
418 }
419
420 // Unsafe cast, should be avoided.
421 template <class S>
422 V8_INLINE Local<S> UnsafeAs() const {
423 return Local<S>(LocalBase<S>(*this));
424 }
425};
426
427namespace internal {
428// A local variant that is suitable for off-stack allocation.
429// Used internally by LocalVector<T>. Not to be used directly!
430template <typename T>
432 public:
433 LocalUnchecked() : Local<T>(Local<T>::do_not_check) {}
434
435#if defined(V8_ENABLE_LOCAL_OFF_STACK_CHECK) && V8_HAS_ATTRIBUTE_TRIVIAL_ABI
436 // In this case, the check is also enforced in the copy constructor and we
437 // need to suppress it.
438 LocalUnchecked(const LocalUnchecked& other)
439 : Local<T>(other, Local<T>::do_not_check) noexcept {}
440 LocalUnchecked& operator=(const LocalUnchecked&) noexcept = default;
441#endif
442
443 // Implicit conversion from Local.
444 LocalUnchecked(const Local<T>& other) noexcept // NOLINT(runtime/explicit)
446};
447
448#ifdef V8_ENABLE_DIRECT_LOCAL
449// Off-stack allocated direct locals must be registered as strong roots.
450// For off-stack indirect locals, this is not necessary.
451
452template <typename T>
453class StrongRootAllocator<LocalUnchecked<T>> : public StrongRootAllocatorBase {
454 public:
455 using value_type = LocalUnchecked<T>;
456 static_assert(std::is_standard_layout_v<value_type>);
457 static_assert(sizeof(value_type) == sizeof(Address));
458
459 explicit StrongRootAllocator(Heap* heap) : StrongRootAllocatorBase(heap) {}
460 explicit StrongRootAllocator(Isolate* isolate)
461 : StrongRootAllocatorBase(isolate) {}
462 explicit StrongRootAllocator(v8::Isolate* isolate)
463 : StrongRootAllocatorBase(reinterpret_cast<Isolate*>(isolate)) {}
464 template <typename U>
465 StrongRootAllocator(const StrongRootAllocator<U>& other) noexcept
466 : StrongRootAllocatorBase(other) {}
467
468 value_type* allocate(size_t n) {
469 return reinterpret_cast<value_type*>(allocate_impl(n));
470 }
471 void deallocate(value_type* p, size_t n) noexcept {
472 return deallocate_impl(reinterpret_cast<Address*>(p), n);
473 }
474};
475#endif // V8_ENABLE_DIRECT_LOCAL
476} // namespace internal
477
478template <typename T>
480 private:
482
483#ifdef V8_ENABLE_DIRECT_LOCAL
484 using allocator_type = internal::StrongRootAllocator<element_type>;
485
486 static allocator_type make_allocator(Isolate* isolate) noexcept {
487 return allocator_type(isolate);
488 }
489#else
490 using allocator_type = std::allocator<element_type>;
491
492 static allocator_type make_allocator(Isolate* isolate) noexcept {
493 return allocator_type();
494 }
495#endif // V8_ENABLE_DIRECT_LOCAL
496
497 using vector_type = std::vector<element_type, allocator_type>;
498
499 public:
503 using size_type = size_t;
504 using difference_type = ptrdiff_t;
505 using iterator =
508 internal::WrappedIterator<typename vector_type::const_iterator,
509 const Local<T>>;
510
511 explicit LocalVector(Isolate* isolate) : backing_(make_allocator(isolate)) {}
512 LocalVector(Isolate* isolate, size_t n)
513 : backing_(n, make_allocator(isolate)) {}
514 explicit LocalVector(Isolate* isolate, std::initializer_list<Local<T>> init)
515 : backing_(make_allocator(isolate)) {
516 if (init.size() == 0) return;
517 backing_.reserve(init.size());
518 backing_.insert(backing_.end(), init.begin(), init.end());
519 }
520
521 iterator begin() noexcept { return iterator(backing_.begin()); }
522 const_iterator begin() const noexcept {
523 return const_iterator(backing_.begin());
524 }
525 iterator end() noexcept { return iterator(backing_.end()); }
526 const_iterator end() const noexcept { return const_iterator(backing_.end()); }
527
528 size_t size() const noexcept { return backing_.size(); }
529 bool empty() const noexcept { return backing_.empty(); }
530 void reserve(size_t n) { backing_.reserve(n); }
531 void shrink_to_fit() { backing_.shrink_to_fit(); }
532
533 Local<T>& operator[](size_t n) { return backing_[n]; }
534 const Local<T>& operator[](size_t n) const { return backing_[n]; }
535
536 Local<T>& at(size_t n) { return backing_.at(n); }
537 const Local<T>& at(size_t n) const { return backing_.at(n); }
538
539 Local<T>& front() { return backing_.front(); }
540 const Local<T>& front() const { return backing_.front(); }
541 Local<T>& back() { return backing_.back(); }
542 const Local<T>& back() const { return backing_.back(); }
543
544 Local<T>* data() noexcept { return backing_.data(); }
545 const Local<T>* data() const noexcept { return backing_.data(); }
546
548 return iterator(backing_.insert(pos.base(), value));
549 }
550
551 template <typename InputIt>
552 iterator insert(const_iterator pos, InputIt first, InputIt last) {
553 return iterator(backing_.insert(pos.base(), first, last));
554 }
555
556 iterator insert(const_iterator pos, std::initializer_list<Local<T>> init) {
557 return iterator(backing_.insert(pos.base(), init.begin(), init.end()));
558 }
559
560 LocalVector<T>& operator=(std::initializer_list<Local<T>> init) {
561 backing_.clear();
562 backing_.reserve(init.size());
563 backing_.insert(backing_.end(), init.begin(), init.end());
564 return *this;
565 }
566
567 void push_back(const Local<T>& x) { backing_.push_back(x); }
568 void pop_back() { backing_.pop_back(); }
569 void emplace_back(const Local<T>& x) { backing_.emplace_back(x); }
570
571 void clear() noexcept { backing_.clear(); }
572 void resize(size_t n) { backing_.resize(n); }
573 void swap(LocalVector<T>& other) { backing_.swap(other.backing_); }
574
575 friend bool operator==(const LocalVector<T>& x, const LocalVector<T>& y) {
576 return x.backing_ == y.backing_;
577 }
578 friend bool operator!=(const LocalVector<T>& x, const LocalVector<T>& y) {
579 return x.backing_ != y.backing_;
580 }
581 friend bool operator<(const LocalVector<T>& x, const LocalVector<T>& y) {
582 return x.backing_ < y.backing_;
583 }
584 friend bool operator>(const LocalVector<T>& x, const LocalVector<T>& y) {
585 return x.backing_ > y.backing_;
586 }
587 friend bool operator<=(const LocalVector<T>& x, const LocalVector<T>& y) {
588 return x.backing_ <= y.backing_;
589 }
590 friend bool operator>=(const LocalVector<T>& x, const LocalVector<T>& y) {
591 return x.backing_ >= y.backing_;
592 }
593
594 private:
595 vector_type backing_;
596};
597
598#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
599// Handle is an alias for Local for historical reasons.
600template <class T>
602#endif
603
614template <class T>
616 public:
617 V8_INLINE MaybeLocal() : local_() {}
618 template <class S>
619 V8_INLINE MaybeLocal(Local<S> that) : local_(that) {}
620
621 V8_INLINE bool IsEmpty() const { return local_.IsEmpty(); }
622
627 template <class S>
629 *out = local_;
630 return !IsEmpty();
631 }
632
639 return local_;
640 }
641
646 template <class S>
647 V8_INLINE Local<S> FromMaybe(Local<S> default_value) const {
648 return IsEmpty() ? default_value : Local<S>(local_);
649 }
650
656 template <class S>
658#ifdef V8_ENABLE_CHECKS
659 // If we're going to perform the type check then we have to check
660 // that the handle isn't empty before doing the checked cast.
661 if (that.IsEmpty()) return MaybeLocal<T>();
662 T::Cast(that.local_.template value<S>());
663#endif
664 return MaybeLocal<T>(that.local_);
665 }
666
672 template <class S>
674 return MaybeLocal<S>::Cast(*this);
675 }
676
677 private:
678 Local<T> local_;
679
680 template <typename S>
681 friend class MaybeLocal;
682};
683
689 public:
692
694 void operator=(const EscapableHandleScopeBase&) = delete;
695 void* operator new(size_t size) = delete;
696 void* operator new[](size_t size) = delete;
697 void operator delete(void*, size_t) = delete;
698 void operator delete[](void*, size_t) = delete;
699
700 protected:
706
707 private:
708 internal::Address* escape_slot_;
709};
710
712 : public EscapableHandleScopeBase {
713 public:
714 explicit EscapableHandleScope(Isolate* isolate)
715 : EscapableHandleScopeBase(isolate) {}
717 template <class T>
719#ifdef V8_ENABLE_DIRECT_LOCAL
720 return value;
721#else
722 if (value.IsEmpty()) return value;
723 return Local<T>::FromSlot(EscapeSlot(value.slot()));
724#endif
725 }
726
727 template <class T>
729 return Escape(value.FromMaybe(Local<T>()));
730 }
731};
732
739 public:
740 explicit SealHandleScope(Isolate* isolate);
742
744 void operator=(const SealHandleScope&) = delete;
745 void* operator new(size_t size) = delete;
746 void* operator new[](size_t size) = delete;
747 void operator delete(void*, size_t) = delete;
748 void operator delete[](void*, size_t) = delete;
749
750 private:
751 internal::Isolate* const i_isolate_;
752 internal::Address* prev_limit_;
753 int prev_sealed_level_;
754};
755
756} // namespace v8
757
758#endif // INCLUDE_V8_LOCAL_HANDLE_H_
Definition: v8-traced-handle.h:125
Definition: v8-context.h:48
Definition: v8-local-handle.h:688
EscapableHandleScopeBase(Isolate *isolate)
internal::Address * EscapeSlot(internal::Address *escape_value)
EscapableHandleScopeBase(const EscapableHandleScopeBase &)=delete
void operator=(const EscapableHandleScopeBase &)=delete
Definition: v8-local-handle.h:712
Local< T > Escape(Local< T > value)
Definition: v8-local-handle.h:718
MaybeLocal< T > EscapeMaybe(MaybeLocal< T > value)
Definition: v8-local-handle.h:728
EscapableHandleScope(Isolate *isolate)
Definition: v8-local-handle.h:714
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:210
Definition: v8-local-handle.h:189
static LocalBase< T > New(Isolate *isolate, T *that)
Definition: v8-local-handle.h:207
static LocalBase< T > FromSlot(internal::Address *slot)
Definition: v8-local-handle.h:213
LocalBase(const LocalBase< S > &other)
Definition: v8-local-handle.h:200
LocalBase(internal::Address *location)
Definition: v8-local-handle.h:196
LocalBase()=default
static LocalBase< T > New(Isolate *isolate, internal::Address value)
Definition: v8-local-handle.h:202
Definition: v8-local-handle.h:479
LocalVector< T > & operator=(std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:560
const Local< T > & front() const
Definition: v8-local-handle.h:540
friend bool operator>=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:590
bool empty() const noexcept
Definition: v8-local-handle.h:529
const Local< T > * data() const noexcept
Definition: v8-local-handle.h:545
const_iterator end() const noexcept
Definition: v8-local-handle.h:526
const Local< T > & operator[](size_t n) const
Definition: v8-local-handle.h:534
friend bool operator<(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:581
const Local< T > & back() const
Definition: v8-local-handle.h:542
void shrink_to_fit()
Definition: v8-local-handle.h:531
Local< T > * data() noexcept
Definition: v8-local-handle.h:544
void reserve(size_t n)
Definition: v8-local-handle.h:530
Local< T > & front()
Definition: v8-local-handle.h:539
internal::WrappedIterator< typename vector_type::iterator, Local< T > > iterator
Definition: v8-local-handle.h:506
friend bool operator<=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:587
friend bool operator!=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:578
Local< T > & operator[](size_t n)
Definition: v8-local-handle.h:533
size_t size_type
Definition: v8-local-handle.h:503
const_iterator begin() const noexcept
Definition: v8-local-handle.h:522
iterator insert(const_iterator pos, std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:556
Local< T > & at(size_t n)
Definition: v8-local-handle.h:536
ptrdiff_t difference_type
Definition: v8-local-handle.h:504
iterator insert(const_iterator pos, const Local< T > &value)
Definition: v8-local-handle.h:547
internal::WrappedIterator< typename vector_type::const_iterator, const Local< T > > const_iterator
Definition: v8-local-handle.h:509
void pop_back()
Definition: v8-local-handle.h:568
LocalVector(Isolate *isolate, std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:514
iterator end() noexcept
Definition: v8-local-handle.h:525
const Local< T > & at(size_t n) const
Definition: v8-local-handle.h:537
void clear() noexcept
Definition: v8-local-handle.h:571
void emplace_back(const Local< T > &x)
Definition: v8-local-handle.h:569
void swap(LocalVector< T > &other)
Definition: v8-local-handle.h:573
iterator insert(const_iterator pos, InputIt first, InputIt last)
Definition: v8-local-handle.h:552
friend bool operator==(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:575
LocalVector(Isolate *isolate)
Definition: v8-local-handle.h:511
size_t size() const noexcept
Definition: v8-local-handle.h:528
void resize(size_t n)
Definition: v8-local-handle.h:572
Local< T > & back()
Definition: v8-local-handle.h:541
LocalVector(Isolate *isolate, size_t n)
Definition: v8-local-handle.h:512
void push_back(const Local< T > &x)
Definition: v8-local-handle.h:567
iterator begin() noexcept
Definition: v8-local-handle.h:521
friend bool operator>(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:584
Definition: v8-local-handle.h:256
friend class TracedReferenceBase
Definition: v8-local-handle.h:351
friend class Object
Definition: v8-local-handle.h:368
friend class PersistentValueMapBase
Definition: v8-local-handle.h:382
static Local< T > New(Isolate *isolate, const PersistentBase< T > &that)
Definition: v8-local-handle.h:340
friend class PropertyCallbackInfo
Definition: v8-local-handle.h:366
friend class ReturnValue
Definition: v8-local-handle.h:384
friend class HandleScope
Definition: v8-local-handle.h:378
friend class Traced
Definition: v8-local-handle.h:386
T * operator*() const
Definition: v8-local-handle.h:272
static Local< T > Cast(Local< S > that)
Definition: v8-local-handle.h:311
Local()=default
friend class FunctionCallbackInfo
Definition: v8-local-handle.h:364
Local< S > As() const
Definition: v8-local-handle.h:327
friend class String
Definition: v8-local-handle.h:367
bool operator!=(const Local< S > &that) const
Definition: v8-local-handle.h:296
friend class MaybeLocal
Definition: v8-local-handle.h:360
static Local< T > New(Isolate *isolate, const BasicTracedReference< T > &that)
Definition: v8-local-handle.h:345
bool operator==(const PersistentBase< S > &that) const
Definition: v8-local-handle.h:291
bool operator!=(const Persistent< S > &that) const
Definition: v8-local-handle.h:301
friend class Isolate
Definition: v8-local-handle.h:370
friend class Utils
Definition: v8-local-handle.h:352
static Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8-local-handle.h:336
friend class Context
Definition: v8-local-handle.h:369
friend class Private
Definition: v8-local-handle.h:371
friend class Persistent
Definition: v8-local-handle.h:362
friend class Global
Definition: v8-local-handle.h:356
T * operator->() const
Definition: v8-local-handle.h:270
friend class EscapableHandleScope
Definition: v8-local-handle.h:379
friend class Eternal
Definition: v8-local-handle.h:354
bool operator==(const Local< S > &that) const
Definition: v8-local-handle.h:286
friend class InternalEscapableScope
Definition: v8-local-handle.h:380
Local(Local< S > that)
Definition: v8-local-handle.h:261
friend class Local
Definition: v8-local-handle.h:358
Definition: v8-local-handle.h:615
bool ToLocal(Local< S > *out) const
Definition: v8-local-handle.h:628
static MaybeLocal< T > Cast(MaybeLocal< S > that)
Definition: v8-local-handle.h:657
MaybeLocal< S > As() const
Definition: v8-local-handle.h:673
Local< T > ToLocalChecked()
Definition: v8-local-handle.h:637
Local< S > FromMaybe(Local< S > default_value) const
Definition: v8-local-handle.h:647
MaybeLocal()
Definition: v8-local-handle.h:617
bool IsEmpty() const
Definition: v8-local-handle.h:621
MaybeLocal(Local< S > that)
Definition: v8-local-handle.h:619
Definition: v8-object.h:238
Definition: v8-persistent-handle.h:89
Definition: v8-persistent-handle.h:246
Definition: v8-local-handle.h:738
SealHandleScope(const SealHandleScope &)=delete
void operator=(const SealHandleScope &)=delete
SealHandleScope(Isolate *isolate)
Definition: v8-local-handle.h:62
Definition: v8-value.h:497
Definition: v8-handle-base.h:53
T * value() const
Definition: v8-handle-base.h:85
internal::Address ptr() const
Definition: v8-handle-base.h:76
internal::Address *const & slot() const
Definition: v8-handle-base.h:79
bool IsEmpty() const
Definition: v8-handle-base.h:56
Definition: v8-handle-base.h:13
Definition: v8-local-handle.h:72
Definition: v8-internal.h:1559
Definition: v8-local-handle.h:431
LocalUnchecked()
Definition: v8-local-handle.h:433
LocalUnchecked(const Local< T > &other) noexcept
Definition: v8-local-handle.h:444
Definition: v8-internal.h:1328
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1544
static bool IsEmpty(T *value)
Definition: v8-internal.h:1513
Definition: v8-internal.h:1347
constexpr Iterator base() const noexcept
Definition: v8-internal.h:1425
internal::BasicPersistent< T, internal::StrongPersistentPolicy > Persistent
Definition: persistent.h:363
uintptr_t Address
Definition: v8-internal.h:33
Definition: libplatform.h:15
Local< Primitive > Null(Isolate *isolate)
Definition: v8-primitive.h:847
Local< Primitive > Undefined(Isolate *isolate)
Definition: v8-primitive.h:839
Local< Boolean > False(Isolate *isolate)
Definition: v8-primitive.h:863
Local< Boolean > True(Isolate *isolate)
Definition: v8-primitive.h:855
#define V8_EXPORT
Definition: v8config.h:762
#define V8_INLINE
Definition: v8config.h:477
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:637
#define V8_UNLIKELY(condition)
Definition: v8config.h:626
#define V8_TRIVIAL_ABI
Definition: v8config.h:712
#define V8_NODISCARD
Definition: v8config.h:659