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
186#else // !V8_ENABLE_DIRECT_HANDLE
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_HANDLE
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(const LocalBase<T>& other) : LocalBase<T>(other) {}
398
399 V8_INLINE static Local<T> FromSlot(internal::Address* slot) {
400 return Local<T>(LocalBase<T>::FromSlot(slot));
401 }
402
403#ifdef V8_ENABLE_DIRECT_HANDLE
404 friend class TypecheckWitness;
405
406 V8_INLINE static Local<T> FromAddress(internal::Address ptr) {
407 return Local<T>(LocalBase<T>(ptr));
408 }
409#endif // V8_ENABLE_DIRECT_HANDLE
410
411 V8_INLINE static Local<T> New(Isolate* isolate, internal::Address value) {
412 return Local<T>(LocalBase<T>::New(isolate, value));
413 }
414
415 V8_INLINE static Local<T> New(Isolate* isolate, T* that) {
416 return Local<T>(LocalBase<T>::New(isolate, that));
417 }
418
419 // Unsafe cast, should be avoided.
420 template <class S>
421 V8_INLINE Local<S> UnsafeAs() const {
422 return Local<S>(LocalBase<S>(*this));
423 }
424};
425
426namespace internal {
427// A local variant that is suitable for off-stack allocation.
428// Used internally by LocalVector<T>. Not to be used directly!
429template <typename T>
431 public:
432 LocalUnchecked() : Local<T>(Local<T>::do_not_check) {}
433
434#if defined(V8_ENABLE_LOCAL_OFF_STACK_CHECK) && V8_HAS_ATTRIBUTE_TRIVIAL_ABI
435 // In this case, the check is also enforced in the copy constructor and we
436 // need to suppress it.
437 LocalUnchecked(const LocalUnchecked& other)
438 : Local<T>(other, Local<T>::do_not_check) noexcept {}
439 LocalUnchecked& operator=(const LocalUnchecked&) noexcept = default;
440#endif
441
442 // Implicit conversion from Local.
443 LocalUnchecked(const Local<T>& other) noexcept // NOLINT(runtime/explicit)
445};
446
447#ifdef V8_ENABLE_DIRECT_HANDLE
448// Off-stack allocated direct locals must be registered as strong roots.
449// For off-stack indirect locals, this is not necessary.
450
451template <typename T>
452class StrongRootAllocator<LocalUnchecked<T>> : public StrongRootAllocatorBase {
453 public:
454 using value_type = LocalUnchecked<T>;
455 static_assert(std::is_standard_layout_v<value_type>);
456 static_assert(sizeof(value_type) == sizeof(Address));
457
458 explicit StrongRootAllocator(Heap* heap) : StrongRootAllocatorBase(heap) {}
459 explicit StrongRootAllocator(Isolate* isolate)
460 : StrongRootAllocatorBase(isolate) {}
461 explicit StrongRootAllocator(v8::Isolate* isolate)
462 : StrongRootAllocatorBase(reinterpret_cast<Isolate*>(isolate)) {}
463 template <typename U>
464 StrongRootAllocator(const StrongRootAllocator<U>& other) noexcept
465 : StrongRootAllocatorBase(other) {}
466
467 value_type* allocate(size_t n) {
468 return reinterpret_cast<value_type*>(allocate_impl(n));
469 }
470 void deallocate(value_type* p, size_t n) noexcept {
471 return deallocate_impl(reinterpret_cast<Address*>(p), n);
472 }
473};
474#endif // V8_ENABLE_DIRECT_HANDLE
475} // namespace internal
476
477template <typename T>
479 private:
481
482#ifdef V8_ENABLE_DIRECT_HANDLE
483 using allocator_type = internal::StrongRootAllocator<element_type>;
484
485 static allocator_type make_allocator(Isolate* isolate) noexcept {
486 return allocator_type(isolate);
487 }
488#else
489 using allocator_type = std::allocator<element_type>;
490
491 static allocator_type make_allocator(Isolate* isolate) noexcept {
492 return allocator_type();
493 }
494#endif // V8_ENABLE_DIRECT_HANDLE
495
496 using vector_type = std::vector<element_type, allocator_type>;
497
498 public:
502 using size_type = size_t;
503 using difference_type = ptrdiff_t;
504 using iterator =
507 internal::WrappedIterator<typename vector_type::const_iterator,
508 const Local<T>>;
509
510 explicit LocalVector(Isolate* isolate) : backing_(make_allocator(isolate)) {}
511 LocalVector(Isolate* isolate, size_t n)
512 : backing_(n, make_allocator(isolate)) {}
513 explicit LocalVector(Isolate* isolate, std::initializer_list<Local<T>> init)
514 : backing_(make_allocator(isolate)) {
515 if (init.size() == 0) return;
516 backing_.reserve(init.size());
517 backing_.insert(backing_.end(), init.begin(), init.end());
518 }
519
520 iterator begin() noexcept { return iterator(backing_.begin()); }
521 const_iterator begin() const noexcept {
522 return const_iterator(backing_.begin());
523 }
524 iterator end() noexcept { return iterator(backing_.end()); }
525 const_iterator end() const noexcept { return const_iterator(backing_.end()); }
526
527 size_t size() const noexcept { return backing_.size(); }
528 bool empty() const noexcept { return backing_.empty(); }
529 void reserve(size_t n) { backing_.reserve(n); }
530 void shrink_to_fit() { backing_.shrink_to_fit(); }
531
532 Local<T>& operator[](size_t n) { return backing_[n]; }
533 const Local<T>& operator[](size_t n) const { return backing_[n]; }
534
535 Local<T>& at(size_t n) { return backing_.at(n); }
536 const Local<T>& at(size_t n) const { return backing_.at(n); }
537
538 Local<T>& front() { return backing_.front(); }
539 const Local<T>& front() const { return backing_.front(); }
540 Local<T>& back() { return backing_.back(); }
541 const Local<T>& back() const { return backing_.back(); }
542
543 Local<T>* data() noexcept { return backing_.data(); }
544 const Local<T>* data() const noexcept { return backing_.data(); }
545
547 return iterator(backing_.insert(pos.base(), value));
548 }
549
550 template <typename InputIt>
551 iterator insert(const_iterator pos, InputIt first, InputIt last) {
552 return iterator(backing_.insert(pos.base(), first, last));
553 }
554
555 iterator insert(const_iterator pos, std::initializer_list<Local<T>> init) {
556 return iterator(backing_.insert(pos.base(), init.begin(), init.end()));
557 }
558
559 LocalVector<T>& operator=(std::initializer_list<Local<T>> init) {
560 backing_.clear();
561 backing_.reserve(init.size());
562 backing_.insert(backing_.end(), init.begin(), init.end());
563 return *this;
564 }
565
566 void push_back(const Local<T>& x) { backing_.push_back(x); }
567 void pop_back() { backing_.pop_back(); }
568 void emplace_back(const Local<T>& x) { backing_.emplace_back(x); }
569
570 void clear() noexcept { backing_.clear(); }
571 void resize(size_t n) { backing_.resize(n); }
572 void swap(LocalVector<T>& other) { backing_.swap(other.backing_); }
573
574 friend bool operator==(const LocalVector<T>& x, const LocalVector<T>& y) {
575 return x.backing_ == y.backing_;
576 }
577 friend bool operator!=(const LocalVector<T>& x, const LocalVector<T>& y) {
578 return x.backing_ != y.backing_;
579 }
580 friend bool operator<(const LocalVector<T>& x, const LocalVector<T>& y) {
581 return x.backing_ < y.backing_;
582 }
583 friend bool operator>(const LocalVector<T>& x, const LocalVector<T>& y) {
584 return x.backing_ > y.backing_;
585 }
586 friend bool operator<=(const LocalVector<T>& x, const LocalVector<T>& y) {
587 return x.backing_ <= y.backing_;
588 }
589 friend bool operator>=(const LocalVector<T>& x, const LocalVector<T>& y) {
590 return x.backing_ >= y.backing_;
591 }
592
593 private:
594 vector_type backing_;
595};
596
597#if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
598// Handle is an alias for Local for historical reasons.
599template <class T>
601#endif
602
613template <class T>
615 public:
616 V8_INLINE MaybeLocal() : local_() {}
617 template <class S>
618 V8_INLINE MaybeLocal(Local<S> that) : local_(that) {}
619
620 V8_INLINE bool IsEmpty() const { return local_.IsEmpty(); }
621
626 template <class S>
628 *out = local_;
629 return !IsEmpty();
630 }
631
638 return local_;
639 }
640
645 template <class S>
646 V8_INLINE Local<S> FromMaybe(Local<S> default_value) const {
647 return IsEmpty() ? default_value : Local<S>(local_);
648 }
649
655 template <class S>
657#ifdef V8_ENABLE_CHECKS
658 // If we're going to perform the type check then we have to check
659 // that the handle isn't empty before doing the checked cast.
660 if (that.IsEmpty()) return MaybeLocal<T>();
661 T::Cast(that.local_.template value<S>());
662#endif
663 return MaybeLocal<T>(that.local_);
664 }
665
671 template <class S>
673 return MaybeLocal<S>::Cast(*this);
674 }
675
676 private:
677 Local<T> local_;
678
679 template <typename S>
680 friend class MaybeLocal;
681};
682
688 public:
691
693 void operator=(const EscapableHandleScopeBase&) = delete;
694 void* operator new(size_t size) = delete;
695 void* operator new[](size_t size) = delete;
696 void operator delete(void*, size_t) = delete;
697 void operator delete[](void*, size_t) = delete;
698
699 protected:
705
706 private:
707 internal::Address* escape_slot_;
708};
709
711 : public EscapableHandleScopeBase {
712 public:
713 explicit EscapableHandleScope(Isolate* isolate)
714 : EscapableHandleScopeBase(isolate) {}
716 template <class T>
718#ifdef V8_ENABLE_DIRECT_HANDLE
719 return value;
720#else
721 if (value.IsEmpty()) return value;
722 return Local<T>::FromSlot(EscapeSlot(value.slot()));
723#endif
724 }
725
726 template <class T>
728 return Escape(value.FromMaybe(Local<T>()));
729 }
730};
731
738 public:
739 explicit SealHandleScope(Isolate* isolate);
741
743 void operator=(const SealHandleScope&) = delete;
744 void* operator new(size_t size) = delete;
745 void* operator new[](size_t size) = delete;
746 void operator delete(void*, size_t) = delete;
747 void operator delete[](void*, size_t) = delete;
748
749 private:
750 internal::Isolate* const i_isolate_;
751 internal::Address* prev_limit_;
752 int prev_sealed_level_;
753};
754
755} // namespace v8
756
757#endif // INCLUDE_V8_LOCAL_HANDLE_H_
Definition: v8-traced-handle.h:125
Definition: v8-context.h:48
Definition: v8-local-handle.h:687
EscapableHandleScopeBase(Isolate *isolate)
internal::Address * EscapeSlot(internal::Address *escape_value)
EscapableHandleScopeBase(const EscapableHandleScopeBase &)=delete
void operator=(const EscapableHandleScopeBase &)=delete
Definition: v8-local-handle.h:711
Local< T > Escape(Local< T > value)
Definition: v8-local-handle.h:717
MaybeLocal< T > EscapeMaybe(MaybeLocal< T > value)
Definition: v8-local-handle.h:727
EscapableHandleScope(Isolate *isolate)
Definition: v8-local-handle.h:713
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:211
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:478
LocalVector< T > & operator=(std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:559
const Local< T > & front() const
Definition: v8-local-handle.h:539
friend bool operator>=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:589
bool empty() const noexcept
Definition: v8-local-handle.h:528
const Local< T > * data() const noexcept
Definition: v8-local-handle.h:544
const_iterator end() const noexcept
Definition: v8-local-handle.h:525
const Local< T > & operator[](size_t n) const
Definition: v8-local-handle.h:533
friend bool operator<(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:580
const Local< T > & back() const
Definition: v8-local-handle.h:541
void shrink_to_fit()
Definition: v8-local-handle.h:530
Local< T > * data() noexcept
Definition: v8-local-handle.h:543
void reserve(size_t n)
Definition: v8-local-handle.h:529
Local< T > & front()
Definition: v8-local-handle.h:538
internal::WrappedIterator< typename vector_type::iterator, Local< T > > iterator
Definition: v8-local-handle.h:505
friend bool operator<=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:586
friend bool operator!=(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:577
Local< T > & operator[](size_t n)
Definition: v8-local-handle.h:532
size_t size_type
Definition: v8-local-handle.h:502
const_iterator begin() const noexcept
Definition: v8-local-handle.h:521
iterator insert(const_iterator pos, std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:555
Local< T > & at(size_t n)
Definition: v8-local-handle.h:535
ptrdiff_t difference_type
Definition: v8-local-handle.h:503
iterator insert(const_iterator pos, const Local< T > &value)
Definition: v8-local-handle.h:546
internal::WrappedIterator< typename vector_type::const_iterator, const Local< T > > const_iterator
Definition: v8-local-handle.h:508
void pop_back()
Definition: v8-local-handle.h:567
LocalVector(Isolate *isolate, std::initializer_list< Local< T > > init)
Definition: v8-local-handle.h:513
iterator end() noexcept
Definition: v8-local-handle.h:524
const Local< T > & at(size_t n) const
Definition: v8-local-handle.h:536
void clear() noexcept
Definition: v8-local-handle.h:570
void emplace_back(const Local< T > &x)
Definition: v8-local-handle.h:568
void swap(LocalVector< T > &other)
Definition: v8-local-handle.h:572
iterator insert(const_iterator pos, InputIt first, InputIt last)
Definition: v8-local-handle.h:551
friend bool operator==(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:574
LocalVector(Isolate *isolate)
Definition: v8-local-handle.h:510
size_t size() const noexcept
Definition: v8-local-handle.h:527
void resize(size_t n)
Definition: v8-local-handle.h:571
Local< T > & back()
Definition: v8-local-handle.h:540
LocalVector(Isolate *isolate, size_t n)
Definition: v8-local-handle.h:511
void push_back(const Local< T > &x)
Definition: v8-local-handle.h:566
iterator begin() noexcept
Definition: v8-local-handle.h:520
friend bool operator>(const LocalVector< T > &x, const LocalVector< T > &y)
Definition: v8-local-handle.h:583
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:614
bool ToLocal(Local< S > *out) const
Definition: v8-local-handle.h:627
static MaybeLocal< T > Cast(MaybeLocal< S > that)
Definition: v8-local-handle.h:656
MaybeLocal< S > As() const
Definition: v8-local-handle.h:672
Local< T > ToLocalChecked()
Definition: v8-local-handle.h:636
Local< S > FromMaybe(Local< S > default_value) const
Definition: v8-local-handle.h:646
MaybeLocal()
Definition: v8-local-handle.h:616
bool IsEmpty() const
Definition: v8-local-handle.h:620
MaybeLocal(Local< S > that)
Definition: v8-local-handle.h:618
Definition: v8-object.h:233
Definition: v8-persistent-handle.h:89
Definition: v8-persistent-handle.h:246
Definition: v8-local-handle.h:737
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:1610
Definition: v8-local-handle.h:430
LocalUnchecked()
Definition: v8-local-handle.h:432
LocalUnchecked(const Local< T > &other) noexcept
Definition: v8-local-handle.h:443
Definition: v8-internal.h:1379
static Address ValueAsAddress(const T *value)
Definition: v8-internal.h:1595
static bool IsEmpty(T *value)
Definition: v8-internal.h:1564
Definition: v8-internal.h:1398
constexpr Iterator base() const noexcept
Definition: v8-internal.h:1476
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:938
Local< Primitive > Undefined(Isolate *isolate)
Definition: v8-primitive.h:930
Local< Boolean > False(Isolate *isolate)
Definition: v8-primitive.h:954
Local< Boolean > True(Isolate *isolate)
Definition: v8-primitive.h:946
#define V8_EXPORT
Definition: v8config.h:779
#define V8_INLINE
Definition: v8config.h:493
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:654
#define V8_UNLIKELY(condition)
Definition: v8config.h:643
#define V8_TRIVIAL_ABI
Definition: v8config.h:729
#define V8_NODISCARD
Definition: v8config.h:676