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;
54template <class F1, class F2>
55class PersistentValueVector;
56class Primitive;
57class Private;
58template <class F>
59class PropertyCallbackInfo;
60template <class F>
61class ReturnValue;
62class String;
63template <class F>
64class Traced;
66class Utils;
67
68namespace debug {
69class ConsoleCallArguments;
70}
71
72namespace internal {
73template <typename T>
75template <typename T>
76class LocalUnchecked;
77class SamplingHeapProfiler;
78} // namespace internal
79
80namespace api_internal {
81// Called when ToLocalChecked is called on an empty Local.
83} // namespace api_internal
84
100 public:
101 explicit HandleScope(Isolate* isolate);
102
104
108 static int NumberOfHandles(Isolate* isolate);
109
111 return reinterpret_cast<Isolate*>(i_isolate_);
112 }
113
114 HandleScope(const HandleScope&) = delete;
115 void operator=(const HandleScope&) = delete;
116
118 internal::Address value);
119
120 protected:
122
123 void Initialize(Isolate* isolate);
124
125 static internal::Address* CreateHandle(internal::Isolate* i_isolate,
126 internal::Address value);
127
128 private:
129 // Declaring operator new and delete as deleted is not spec compliant.
130 // Therefore declare them private instead to disable dynamic alloc
131 void* operator new(size_t size);
132 void* operator new[](size_t size);
133 void operator delete(void*, size_t);
134 void operator delete[](void*, size_t);
135
136 internal::Isolate* i_isolate_;
137 internal::Address* prev_next_;
138 internal::Address* prev_limit_;
139#ifdef V8_ENABLE_CHECKS
140 int scope_level_ = 0;
141#endif
142
143 // LocalBase<T>::New uses CreateHandle with an Isolate* parameter.
144 template <typename T>
145 friend class LocalBase;
146
147 // Object::GetInternalField and Context::GetEmbedderData use CreateHandle with
148 // a HeapObject in their shortcuts.
149 friend class Object;
150 friend class Context;
151};
152
159#ifdef V8_ENABLE_DIRECT_LOCAL
160
161template <typename T>
162class LocalBase : public api_internal::DirectHandleBase {
163 protected:
164 template <class F>
165 friend class Local;
166
167 V8_INLINE LocalBase() = default;
168
169 V8_INLINE explicit LocalBase(internal::Address ptr) : DirectHandleBase(ptr) {}
170
171 template <typename S>
172 V8_INLINE LocalBase(const LocalBase<S>& other) : DirectHandleBase(other) {}
173
174 V8_INLINE static LocalBase<T> New(Isolate* isolate, internal::Address value) {
175 return LocalBase<T>(value);
176 }
177
178 V8_INLINE static LocalBase<T> New(Isolate* isolate, T* that) {
179 return LocalBase<T>::New(isolate,
181 }
182
183 V8_INLINE static LocalBase<T> FromSlot(internal::Address* slot) {
184 return LocalBase<T>(*slot);
185 }
186};
187
188#else // !V8_ENABLE_DIRECT_LOCAL
189
190template <typename T>
192 protected:
193 template <class F>
194 friend class Local;
195
196 V8_INLINE LocalBase() = default;
197
199 : IndirectHandleBase(location) {}
200
201 template <typename S>
203
206 reinterpret_cast<internal::Isolate*>(isolate), value));
207 }
208
209 V8_INLINE static LocalBase<T> New(Isolate* isolate, T* that) {
211 return LocalBase<T>::New(isolate,
213 }
214
216 return LocalBase<T>(slot);
217 }
218};
219
220#endif // V8_ENABLE_DIRECT_LOCAL
221
251template <class T>
253#ifdef V8_ENABLE_LOCAL_OFF_STACK_CHECK
255#else
256 public api_internal::StackAllocated<false>
257#endif
258{
259 public:
260 V8_INLINE Local() = default;
261
262 template <class S>
269 static_assert(std::is_base_of<T, S>::value, "type check");
270 }
271
272 V8_INLINE T* operator->() const { return this->template value<T>(); }
273
274 V8_INLINE T* operator*() const { return this->operator->(); }
275
287 template <class S>
288 V8_INLINE bool operator==(const Local<S>& that) const {
289 return internal::HandleHelper::EqualHandles(*this, that);
290 }
291
292 template <class S>
293 V8_INLINE bool operator==(const PersistentBase<S>& that) const {
294 return internal::HandleHelper::EqualHandles(*this, that);
295 }
296
297 template <class S>
298 V8_INLINE bool operator!=(const Local<S>& that) const {
299 return !operator==(that);
300 }
301
302 template <class S>
303 V8_INLINE bool operator!=(const Persistent<S>& that) const {
304 return !operator==(that);
305 }
306
312 template <class S>
314#ifdef V8_ENABLE_CHECKS
315 // If we're going to perform the type check then we have to check
316 // that the handle isn't empty before doing the checked cast.
317 if (that.IsEmpty()) return Local<T>();
318 T::Cast(that.template value<S>());
319#endif
320 return Local<T>(LocalBase<T>(that));
321 }
322
328 template <class S>
330 return Local<S>::Cast(*this);
331 }
332
338 V8_INLINE static Local<T> New(Isolate* isolate, Local<T> that) {
339 return New(isolate, that.template value<T, true>());
340 }
341
342 V8_INLINE static Local<T> New(Isolate* isolate,
343 const PersistentBase<T>& that) {
344 return New(isolate, that.template value<T, true>());
345 }
346
347 V8_INLINE static Local<T> New(Isolate* isolate,
348 const BasicTracedReference<T>& that) {
349 return New(isolate, that.template value<T, true>());
350 }
351
352 private:
354 friend class Utils;
355 template <class F>
356 friend class Eternal;
357 template <class F>
358 friend class Global;
359 template <class F>
360 friend class Local;
361 template <class F>
362 friend class MaybeLocal;
363 template <class F, class M>
364 friend class Persistent;
365 template <class F>
367 template <class F>
369 friend class String;
370 friend class Object;
371 friend class Context;
372 friend class Isolate;
373 friend class Private;
374 template <class F>
376 friend Local<Primitive> Undefined(Isolate* isolate);
377 friend Local<Primitive> Null(Isolate* isolate);
378 friend Local<Boolean> True(Isolate* isolate);
379 friend Local<Boolean> False(Isolate* isolate);
380 friend class HandleScope;
383 template <class F1, class F2, class F3>
385 template <class F1, class F2>
387 template <class F>
388 friend class ReturnValue;
389 template <class F>
390 friend class Traced;
391 friend class internal::SamplingHeapProfiler;
393 friend class debug::ConsoleCallArguments;
394 friend class internal::LocalUnchecked<T>;
395
396 explicit Local(no_checking_tag do_not_check)
397 : LocalBase<T>(), StackAllocated(do_not_check) {}
398 explicit Local(const Local<T>& other, no_checking_tag do_not_check)
399 : LocalBase<T>(other), StackAllocated(do_not_check) {}
400
401 V8_INLINE explicit Local<T>(const LocalBase<T>& other)
402 : LocalBase<T>(other) {}
403
404 V8_INLINE static Local<T> FromSlot(internal::Address* slot) {
405 return Local<T>(LocalBase<T>::FromSlot(slot));
406 }
407
408#ifdef V8_ENABLE_DIRECT_LOCAL
409 friend class TypecheckWitness;
410
411 V8_INLINE static Local<T> FromAddress(internal::Address ptr) {
412 return Local<T>(LocalBase<T>(ptr));
413 }
414#endif // V8_ENABLE_DIRECT_LOCAL
415
416 V8_INLINE static Local<T> New(Isolate* isolate, internal::Address value) {
417 return Local<T>(LocalBase<T>::New(isolate, value));
418 }
419
420 V8_INLINE static Local<T> New(Isolate* isolate, T* that) {
421 return Local<T>(LocalBase<T>::New(isolate, that));
422 }
423
424 // Unsafe cast, should be avoided.
425 template <class S>
426 V8_INLINE Local<S> UnsafeAs() const {
427 return Local<S>(LocalBase<S>(*this));
428 }
429};
430
431namespace internal {
432// A local variant that is suitable for off-stack allocation.
433// Used internally by LocalVector<T>. Not to be used directly!
434template <typename T>
436 public:
437 LocalUnchecked() : Local<T>(Local<T>::do_not_check) {}
438
439#if defined(V8_ENABLE_LOCAL_OFF_STACK_CHECK) && V8_HAS_ATTRIBUTE_TRIVIAL_ABI
440 // In this case, the check is also enforced in the copy constructor and we
441 // need to suppress it.
442 LocalUnchecked(const LocalUnchecked& other)
443 : Local<T>(other, Local<T>::do_not_check) noexcept {}
444 LocalUnchecked& operator=(const LocalUnchecked&) noexcept = default;
445#endif
446
447 // Implicit conversion from Local.
448 LocalUnchecked(const Local<T>& other) noexcept // NOLINT(runtime/explicit)
450};
451
452#ifdef V8_ENABLE_DIRECT_LOCAL
453// Off-stack allocated direct locals must be registered as strong roots.
454// For off-stack indirect locals, this is not necessary.
455
456template <typename T>
457class StrongRootAllocator<LocalUnchecked<T>> : public StrongRootAllocatorBase {
458 public:
459 using value_type = LocalUnchecked<T>;
460 static_assert(std::is_standard_layout_v<value_type>);
461 static_assert(sizeof(value_type) == sizeof(Address));
462
463 explicit StrongRootAllocator(Heap* heap) : StrongRootAllocatorBase(heap) {}
464 explicit StrongRootAllocator(Isolate* isolate)
465 : StrongRootAllocatorBase(isolate) {}
466 explicit StrongRootAllocator(v8::Isolate* isolate)
467 : StrongRootAllocatorBase(reinterpret_cast<Isolate*>(isolate)) {}
468 template <typename U>
469 StrongRootAllocator(const StrongRootAllocator<U>& other) noexcept
470 : StrongRootAllocatorBase(other) {}
471
472 value_type* allocate(size_t n) {
473 return reinterpret_cast<value_type*>(allocate_impl(n));
474 }
475 void deallocate(value_type* p, size_t n) noexcept {
476 return deallocate_impl(reinterpret_cast<Address*>(p), n);
477 }
478};
479#endif // V8_ENABLE_DIRECT_LOCAL
480} // namespace internal
481
482template <typename T>
484 private:
486
487#ifdef V8_ENABLE_DIRECT_LOCAL
488 using allocator_type = internal::StrongRootAllocator<element_type>;
489
490 static allocator_type make_allocator(Isolate* isolate) noexcept {
491 return allocator_type(isolate);
492 }
493#else
494 using allocator_type = std::allocator<element_type>;
495
496 static allocator_type make_allocator(Isolate* isolate) noexcept {
497 return allocator_type();
498 }
499#endif // V8_ENABLE_DIRECT_LOCAL
500
501 using vector_type = std::vector<element_type, allocator_type>;
502
503 public:
507 using size_type = size_t;
508 using difference_type = ptrdiff_t;
509 using iterator =
512 internal::WrappedIterator<typename vector_type::const_iterator,
513 const Local<T>>;
514
515 explicit LocalVector(Isolate* isolate) : backing_(make_allocator(isolate)) {}
516 LocalVector(Isolate* isolate, size_t n)
517 : backing_(n, make_allocator(isolate)) {}
518 explicit LocalVector(Isolate* isolate, std::initializer_list<Local<T>> init)
519 : backing_(make_allocator(isolate)) {
520 if (init.size() == 0) return;
521 backing_.reserve(init.size());
522 backing_.insert(backing_.end(), init.begin(), init.end());
523 }
524
525 iterator begin() noexcept { return iterator(backing_.begin()); }
526 const_iterator begin() const noexcept {
527 return const_iterator(backing_.begin());
528 }
529 iterator end() noexcept { return iterator(backing_.end()); }
530 const_iterator end() const noexcept { return const_iterator(backing_.end()); }
531
532 size_t size() const noexcept { return backing_.size(); }
533 bool empty() const noexcept { return backing_.empty(); }
534 void reserve(size_t n) { backing_.reserve(n); }
535 void shrink_to_fit() { backing_.shrink_to_fit(); }
536
537 Local<T>& operator[](size_t n) { return backing_[n]; }
538 const Local<T>& operator[](size_t n) const { return backing_[n]; }
539
540 Local<T>& at(size_t n) { return backing_.at(n); }
541 const Local<T>& at(size_t n) const { return backing_.at(n); }
542
543 Local<T>& front() { return backing_.front(); }
544 const Local<T>& front() const { return backing_.front(); }
545 Local<T>& back() { return backing_.back(); }
546 const Local<T>& back() const { return backing_.back(); }
547
548 Local<T>* data() noexcept { return backing_.data(); }
549 const Local<T>* data() const noexcept { return backing_.data(); }
550
552 return iterator(backing_.insert(pos.base(), value));
553 }
554
555 template <typename InputIt>
556 iterator insert(const_iterator pos, InputIt first, InputIt last) {
557 return iterator(backing_.insert(pos.base(), first, last));
558 }
559
560 iterator insert(const_iterator pos, std::initializer_list<Local<T>> init) {
561 return iterator(backing_.insert(pos.base(), init.begin(), init.end()));
562 }
563
564 LocalVector<T>& operator=(std::initializer_list<Local<T>> init) {
565 backing_.clear();
566 backing_.reserve(init.size());
567 backing_.insert(backing_.end(), init.begin(), init.end());
568 return *this;
569 }
570
571 void push_back(const Local<T>& x) { backing_.push_back(x); }
572 void pop_back() { backing_.pop_back(); }
573 void emplace_back(const Local<T>& x) { backing_.emplace_back(x); }
574
575 void clear() noexcept { backing_.clear(); }
576 void resize(size_t n) { backing_.resize(n); }
577 void swap(LocalVector<T>& other) { backing_.swap(other.backing_); }
578
579 friend bool operator==(const LocalVector<T>& x, const LocalVector<T>& y) {
580 return x.backing_ == y.backing_;
581 }
582 friend bool operator!=(const LocalVector<T>& x, const LocalVector<T>& y) {
583 return x.backing_ != y.backing_;
584 }
585 friend bool operator<(const LocalVector<T>& x, const LocalVector<T>& y) {
586 return x.backing_ < y.backing_;
587 }
588 friend bool operator>(const LocalVector<T>& x, const LocalVector<T>& y) {
589 return x.backing_ > y.backing_;
590 }
591 friend bool operator<=(const LocalVector<T>& x, const LocalVector<T>& y) {
592 return x.backing_ <= y.backing_;
593 }
594 friend bool operator>=(const LocalVector<T>& x, const LocalVector<T>& y) {
595 return x.backing_ >= y.backing_;
596 }
597
598 private:
599 vector_type backing_;
600};
601
602#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
603// Handle is an alias for Local for historical reasons.
604template <class T>
606#endif
607
618template <class T>
620 public:
621 V8_INLINE MaybeLocal() : local_() {}
622 template <class S>
623 V8_INLINE MaybeLocal(Local<S> that) : local_(that) {}
624
625 V8_INLINE bool IsEmpty() const { return local_.IsEmpty(); }
626
631 template <class S>
633 *out = local_;
634 return !IsEmpty();
635 }
636
643 return local_;
644 }
645
650 template <class S>
651 V8_INLINE Local<S> FromMaybe(Local<S> default_value) const {
652 return IsEmpty() ? default_value : Local<S>(local_);
653 }
654
660 template <class S>
662#ifdef V8_ENABLE_CHECKS
663 // If we're going to perform the type check then we have to check
664 // that the handle isn't empty before doing the checked cast.
665 if (that.IsEmpty()) return MaybeLocal<T>();
666 T::Cast(that.local_.template value<S>());
667#endif
668 return MaybeLocal<T>(that.local_);
669 }
670
676 template <class S>
678 return MaybeLocal<S>::Cast(*this);
679 }
680
681 private:
682 Local<T> local_;
683
684 template <typename S>
685 friend class MaybeLocal;
686};
687
693 public:
696
698 void operator=(const EscapableHandleScopeBase&) = delete;
699 void* operator new(size_t size) = delete;
700 void* operator new[](size_t size) = delete;
701 void operator delete(void*, size_t) = delete;
702 void operator delete[](void*, size_t) = delete;
703
704 protected:
710
711 private:
712 internal::Address* escape_slot_;
713};
714
716 : public EscapableHandleScopeBase {
717 public:
718 explicit EscapableHandleScope(Isolate* isolate)
719 : EscapableHandleScopeBase(isolate) {}
721 template <class T>
723#ifdef V8_ENABLE_DIRECT_LOCAL
724 return value;
725#else
726 if (value.IsEmpty()) return value;
727 return Local<T>::FromSlot(EscapeSlot(value.slot()));
728#endif
729 }
730
731 template <class T>
733 return Escape(value.FromMaybe(Local<T>()));
734 }
735};
736
743 public:
744 explicit SealHandleScope(Isolate* isolate);
746
748 void operator=(const SealHandleScope&) = delete;
749 void* operator new(size_t size) = delete;
750 void* operator new[](size_t size) = delete;
751 void operator delete(void*, size_t) = delete;
752 void operator delete[](void*, size_t) = delete;
753
754 private:
755 internal::Isolate* const i_isolate_;
756 internal::Address* prev_limit_;
757 int prev_sealed_level_;
758};
759
760} // namespace v8
761
762#endif // INCLUDE_V8_LOCAL_HANDLE_H_
Definition: v8-traced-handle.h:125
Definition: v8-context.h:48
Definition: v8-local-handle.h:692
EscapableHandleScopeBase(Isolate *isolate)
internal::Address * EscapeSlot(internal::Address *escape_value)
EscapableHandleScopeBase(const EscapableHandleScopeBase &)=delete
void operator=(const EscapableHandleScopeBase &)=delete
Definition: v8-local-handle.h:716
Local< T > Escape(Local< T > value)
Definition: v8-local-handle.h:722
MaybeLocal< T > EscapeMaybe(MaybeLocal< T > value)
Definition: v8-local-handle.h:732
EscapableHandleScope(Isolate *isolate)
Definition: v8-local-handle.h:718
Definition: v8-local-handle.h:99
HandleScope()=default
void operator=(const HandleScope &)=delete
void Initialize(Isolate *isolate)
HandleScope(const HandleScope &)=delete
Isolate * GetIsolate() const
Definition: v8-local-handle.h:110
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:191
static LocalBase< T > New(Isolate *isolate, T *that)
Definition: v8-local-handle.h:209
static LocalBase< T > FromSlot(internal::Address *slot)
Definition: v8-local-handle.h:215
LocalBase(const LocalBase< S > &other)
Definition: v8-local-handle.h:202
LocalBase(internal::Address *location)
Definition: v8-local-handle.h:198
LocalBase()=default
static LocalBase< T > New(Isolate *isolate, internal::Address value)
Definition: v8-local-handle.h:204
Definition: v8-local-handle.h:483
LocalVector< T > & operator=(std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:564
const Local< T > & front() const
Definition: v8-local-handle.h:544
friend bool operator>=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:594
bool empty() const noexcept
Definition: v8-local-handle.h:533
const Local< T > * data() const noexcept
Definition: v8-local-handle.h:549
const_iterator end() const noexcept
Definition: v8-local-handle.h:530
const Local< T > & operator[](size_t n) const
Definition: v8-local-handle.h:538
friend bool operator<(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:585
const Local< T > & back() const
Definition: v8-local-handle.h:546
void shrink_to_fit()
Definition: v8-local-handle.h:535
Local< T > * data() noexcept
Definition: v8-local-handle.h:548
void reserve(size_t n)
Definition: v8-local-handle.h:534
Local< T > & front()
Definition: v8-local-handle.h:543
internal::WrappedIterator< typename vector_type::iterator, Local< T > > iterator
Definition: v8-local-handle.h:510
friend bool operator<=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:591
friend bool operator!=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:582
Local< T > & operator[](size_t n)
Definition: v8-local-handle.h:537
size_t size_type
Definition: v8-local-handle.h:507
const_iterator begin() const noexcept
Definition: v8-local-handle.h:526
iterator insert(const_iterator pos, std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:560
Local< T > & at(size_t n)
Definition: v8-local-handle.h:540
ptrdiff_t difference_type
Definition: v8-local-handle.h:508
iterator insert(const_iterator pos, const Local< T > &value)
Definition: v8-local-handle.h:551
internal::WrappedIterator< typename vector_type::const_iterator, const Local< T > > const_iterator
Definition: v8-local-handle.h:513
void pop_back()
Definition: v8-local-handle.h:572
LocalVector(Isolate *isolate, std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:518
iterator end() noexcept
Definition: v8-local-handle.h:529
const Local< T > & at(size_t n) const
Definition: v8-local-handle.h:541
void clear() noexcept
Definition: v8-local-handle.h:575
void emplace_back(const Local< T > &x)
Definition: v8-local-handle.h:573
void swap(LocalVector< T > &other)
Definition: v8-local-handle.h:577
iterator insert(const_iterator pos, InputIt first, InputIt last)
Definition: v8-local-handle.h:556
friend bool operator==(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:579
LocalVector(Isolate *isolate)
Definition: v8-local-handle.h:515
size_t size() const noexcept
Definition: v8-local-handle.h:532
void resize(size_t n)
Definition: v8-local-handle.h:576
Local< T > & back()
Definition: v8-local-handle.h:545
LocalVector(Isolate *isolate, size_t n)
Definition: v8-local-handle.h:516
void push_back(const Local< T > &x)
Definition: v8-local-handle.h:571
iterator begin() noexcept
Definition: v8-local-handle.h:525
friend bool operator>(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:588
Definition: v8-local-handle.h:258
friend class TracedReferenceBase
Definition: v8-local-handle.h:353
friend class Object
Definition: v8-local-handle.h:370
friend class PersistentValueMapBase
Definition: v8-local-handle.h:384
static Local< T > New(Isolate *isolate, const PersistentBase< T > &that)
Definition: v8-local-handle.h:342
friend class PropertyCallbackInfo
Definition: v8-local-handle.h:368
friend class ReturnValue
Definition: v8-local-handle.h:388
friend class HandleScope
Definition: v8-local-handle.h:380
friend class Traced
Definition: v8-local-handle.h:390
T * operator*() const
Definition: v8-local-handle.h:274
static Local< T > Cast(Local< S > that)
Definition: v8-local-handle.h:313
Local()=default
friend class FunctionCallbackInfo
Definition: v8-local-handle.h:366
Local< S > As() const
Definition: v8-local-handle.h:329
friend class String
Definition: v8-local-handle.h:369
bool operator!=(const Local< S > &that) const
Definition: v8-local-handle.h:298
friend class MaybeLocal
Definition: v8-local-handle.h:362
static Local< T > New(Isolate *isolate, const BasicTracedReference< T > &that)
Definition: v8-local-handle.h:347
bool operator==(const PersistentBase< S > &that) const
Definition: v8-local-handle.h:293
friend class PersistentValueVector
Definition: v8-local-handle.h:386
bool operator!=(const Persistent< S > &that) const
Definition: v8-local-handle.h:303
friend class Isolate
Definition: v8-local-handle.h:372
friend class Utils
Definition: v8-local-handle.h:354
static Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8-local-handle.h:338
friend class Context
Definition: v8-local-handle.h:371
friend class Private
Definition: v8-local-handle.h:373
friend class Persistent
Definition: v8-local-handle.h:364
friend class Global
Definition: v8-local-handle.h:358
T * operator->() const
Definition: v8-local-handle.h:272
friend class EscapableHandleScope
Definition: v8-local-handle.h:381
friend class Eternal
Definition: v8-local-handle.h:356
bool operator==(const Local< S > &that) const
Definition: v8-local-handle.h:288
friend class InternalEscapableScope
Definition: v8-local-handle.h:382
Local(Local< S > that)
Definition: v8-local-handle.h:263
friend class Local
Definition: v8-local-handle.h:360
Definition: v8-local-handle.h:619
bool ToLocal(Local< S > *out) const
Definition: v8-local-handle.h:632
static MaybeLocal< T > Cast(MaybeLocal< S > that)
Definition: v8-local-handle.h:661
MaybeLocal< S > As() const
Definition: v8-local-handle.h:677
Local< T > ToLocalChecked()
Definition: v8-local-handle.h:641
Local< S > FromMaybe(Local< S > default_value) const
Definition: v8-local-handle.h:651
MaybeLocal()
Definition: v8-local-handle.h:621
bool IsEmpty() const
Definition: v8-local-handle.h:625
MaybeLocal(Local< S > that)
Definition: v8-local-handle.h:623
Definition: v8-object.h:238
Definition: v8-persistent-handle.h:91
Definition: v8-persistent-handle.h:250
Definition: v8-local-handle.h:742
SealHandleScope(const SealHandleScope &)=delete
void operator=(const SealHandleScope &)=delete
SealHandleScope(Isolate *isolate)
Definition: v8-local-handle.h:64
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:74
Definition: v8-internal.h:1472
Definition: v8-local-handle.h:435
LocalUnchecked()
Definition: v8-local-handle.h:437
LocalUnchecked(const Local< T > &other) noexcept
Definition: v8-local-handle.h:448
Definition: v8-internal.h:1241
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1457
static bool IsEmpty(T *value)
Definition: v8-internal.h:1426
Definition: v8-internal.h:1260
constexpr Iterator base() const noexcept
Definition: v8-internal.h:1338
internal::BasicPersistent< T, internal::StrongPersistentPolicy > Persistent
Definition: persistent.h:363
uintptr_t Address
Definition: v8-internal.h:31
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