Where Online Learning is simpler!
The C and C++ Include Header Files
/usr/include/node/v8-local-handle.h
$ cat -n /usr/include/node/v8-local-handle.h 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
9 10 #include
11 #include
12 13 #include "v8-handle-base.h" // NOLINT(build/include_directory) 14 #include "v8-internal.h" // NOLINT(build/include_directory) 15 16 namespace v8 { 17 18 template
19 class LocalBase; 20 template
21 class Local; 22 template
23 class LocalVector; 24 template
25 class MaybeLocal; 26 27 template
28 class Eternal; 29 template
30 class Global; 31 32 template
33 class NonCopyablePersistentTraits; 34 template
35 class PersistentBase; 36 template
> 37 class Persistent; 38 39 class TracedReferenceBase; 40 template
41 class BasicTracedReference; 42 template
43 class TracedReference; 44 45 class Boolean; 46 class Context; 47 class EscapableHandleScope; 48 template
49 class FunctionCallbackInfo; 50 class Isolate; 51 class Object; 52 template
53 class PersistentValueMapBase; 54 template
55 class PersistentValueVector; 56 class Primitive; 57 class Private; 58 template
59 class PropertyCallbackInfo; 60 template
61 class ReturnValue; 62 class String; 63 template
64 class Traced; 65 class TypecheckWitness; 66 class Utils; 67 68 namespace debug { 69 class ConsoleCallArguments; 70 } 71 72 namespace internal { 73 template
74 class CustomArguments; 75 template
76 class LocalUnchecked; 77 class SamplingHeapProfiler; 78 } // namespace internal 79 80 namespace api_internal { 81 // Called when ToLocalChecked is called on an empty Local. 82 V8_EXPORT void ToLocalEmpty(); 83 } // namespace api_internal 84 85 /** 86 * A stack-allocated class that governs a number of local handles. 87 * After a handle scope has been created, all local handles will be 88 * allocated within that handle scope until either the handle scope is 89 * deleted or another handle scope is created. If there is already a 90 * handle scope and a new one is created, all allocations will take 91 * place in the new handle scope until it is deleted. After that, 92 * new handles will again be allocated in the original handle scope. 93 * 94 * After the handle scope of a local handle has been deleted the 95 * garbage collector will no longer track the object stored in the 96 * handle and may deallocate it. The behavior of accessing a handle 97 * for which the handle scope has been deleted is undefined. 98 */ 99 class V8_EXPORT V8_NODISCARD HandleScope { 100 public: 101 explicit HandleScope(Isolate* isolate); 102 103 ~HandleScope(); 104 105 /** 106 * Counts the number of allocated handles. 107 */ 108 static int NumberOfHandles(Isolate* isolate); 109 110 V8_INLINE Isolate* GetIsolate() const { 111 return reinterpret_cast
(i_isolate_); 112 } 113 114 HandleScope(const HandleScope&) = delete; 115 void operator=(const HandleScope&) = delete; 116 117 static internal::Address* CreateHandleForCurrentIsolate( 118 internal::Address value); 119 120 protected: 121 V8_INLINE HandleScope() = default; 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
::New uses CreateHandle with an Isolate* parameter. 144 template
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 153 /** 154 * A base class for local handles. 155 * Its implementation depends on whether direct local support is enabled. 156 * When it is, a local handle contains a direct pointer to the referenced 157 * object, otherwise it contains an indirect pointer. 158 */ 159 #ifdef V8_ENABLE_DIRECT_LOCAL 160 161 template
162 class LocalBase : public api_internal::DirectHandleBase { 163 protected: 164 template
165 friend class Local; 166 167 V8_INLINE LocalBase() = default; 168 169 V8_INLINE explicit LocalBase(internal::Address ptr) : DirectHandleBase(ptr) {} 170 171 template
172 V8_INLINE LocalBase(const LocalBase
& other) : DirectHandleBase(other) {} 173 174 V8_INLINE static LocalBase
New(Isolate* isolate, internal::Address value) { 175 return LocalBase
(value); 176 } 177 178 V8_INLINE static LocalBase
New(Isolate* isolate, T* that) { 179 return LocalBase
::New(isolate, 180 internal::ValueHelper::ValueAsAddress(that)); 181 } 182 183 V8_INLINE static LocalBase
FromSlot(internal::Address* slot) { 184 return LocalBase
(*slot); 185 } 186 }; 187 188 #else // !V8_ENABLE_DIRECT_LOCAL 189 190 template
191 class LocalBase : public api_internal::IndirectHandleBase { 192 protected: 193 template
194 friend class Local; 195 196 V8_INLINE LocalBase() = default; 197 198 V8_INLINE explicit LocalBase(internal::Address* location) 199 : IndirectHandleBase(location) {} 200 201 template
202 V8_INLINE LocalBase(const LocalBase
& other) : IndirectHandleBase(other) {} 203 204 V8_INLINE static LocalBase
New(Isolate* isolate, internal::Address value) { 205 return LocalBase(HandleScope::CreateHandle( 206 reinterpret_cast
(isolate), value)); 207 } 208 209 V8_INLINE static LocalBase
New(Isolate* isolate, T* that) { 210 if (internal::ValueHelper::IsEmpty(that)) return LocalBase
(); 211 return LocalBase
::New(isolate, 212 internal::ValueHelper::ValueAsAddress(that)); 213 } 214 215 V8_INLINE static LocalBase
FromSlot(internal::Address* slot) { 216 return LocalBase
(slot); 217 } 218 }; 219 220 #endif // V8_ENABLE_DIRECT_LOCAL 221 222 /** 223 * An object reference managed by the v8 garbage collector. 224 * 225 * All objects returned from v8 have to be tracked by the garbage collector so 226 * that it knows that the objects are still alive. Also, because the garbage 227 * collector may move objects, it is unsafe to point directly to an object. 228 * Instead, all objects are stored in handles which are known by the garbage 229 * collector and updated whenever an object moves. Handles should always be 230 * passed by value (except in cases like out-parameters) and they should never 231 * be allocated on the heap. 232 * 233 * There are two types of handles: local and persistent handles. 234 * 235 * Local handles are light-weight and transient and typically used in local 236 * operations. They are managed by HandleScopes. That means that a HandleScope 237 * must exist on the stack when they are created and that they are only valid 238 * inside of the HandleScope active during their creation. For passing a local 239 * handle to an outer HandleScope, an EscapableHandleScope and its Escape() 240 * method must be used. 241 * 242 * Persistent handles can be used when storing objects across several 243 * independent operations and have to be explicitly deallocated when they're no 244 * longer used. 245 * 246 * It is safe to extract the object stored in the handle by dereferencing the 247 * handle (for instance, to extract the Object* from a Local
); the value 248 * will still be governed by a handle behind the scenes and the same rules apply 249 * to these values as to their handles. 250 */ 251 template
252 class V8_TRIVIAL_ABI Local : public LocalBase
, 253 #ifdef V8_ENABLE_LOCAL_OFF_STACK_CHECK 254 public api_internal::StackAllocated
255 #else 256 public api_internal::StackAllocated
257 #endif 258 { 259 public: 260 V8_INLINE Local() = default; 261 262 template
263 V8_INLINE Local(Local
that) : LocalBase
(that) { 264 /** 265 * This check fails when trying to convert between incompatible 266 * handles. For example, converting from a Local
to a 267 * Local
. 268 */ 269 static_assert(std::is_base_of
::value, "type check"); 270 } 271 272 V8_INLINE T* operator->() const { return this->template value
(); } 273 274 V8_INLINE T* operator*() const { return this->operator->(); } 275 276 /** 277 * Checks whether two handles are equal or different. 278 * They are equal iff they are both empty or they are both non-empty and the 279 * objects to which they refer are physically equal. 280 * 281 * If both handles refer to JS objects, this is the same as strict 282 * non-equality. For primitives, such as numbers or strings, a `true` return 283 * value does not indicate that the values aren't equal in the JavaScript 284 * sense. Use `Value::StrictEquals()` to check primitives for equality. 285 */ 286 287 template
288 V8_INLINE bool operator==(const Local
& that) const { 289 return internal::HandleHelper::EqualHandles(*this, that); 290 } 291 292 template
293 V8_INLINE bool operator==(const PersistentBase
& that) const { 294 return internal::HandleHelper::EqualHandles(*this, that); 295 } 296 297 template
298 V8_INLINE bool operator!=(const Local
& that) const { 299 return !operator==(that); 300 } 301 302 template
303 V8_INLINE bool operator!=(const Persistent
& that) const { 304 return !operator==(that); 305 } 306 307 /** 308 * Cast a handle to a subclass, e.g. Local
to Local
. 309 * This is only valid if the handle actually refers to a value of the 310 * target type. 311 */ 312 template
313 V8_INLINE static Local
Cast(Local
that) { 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
(); 318 T::Cast(that.template value
()); 319 #endif 320 return Local
(LocalBase
(that)); 321 } 322 323 /** 324 * Calling this is equivalent to Local
::Cast(). 325 * In particular, this is only valid if the handle actually refers to a value 326 * of the target type. 327 */ 328 template
329 V8_INLINE Local
As() const { 330 return Local
::Cast(*this); 331 } 332 333 /** 334 * Create a local handle for the content of another handle. 335 * The referee is kept alive by the local handle even when 336 * the original handle is destroyed/disposed. 337 */ 338 V8_INLINE static Local
New(Isolate* isolate, Local
that) { 339 return New(isolate, that.template value
()); 340 } 341 342 V8_INLINE static Local
New(Isolate* isolate, 343 const PersistentBase
& that) { 344 return New(isolate, that.template value
()); 345 } 346 347 V8_INLINE static Local
New(Isolate* isolate, 348 const BasicTracedReference
& that) { 349 return New(isolate, that.template value
()); 350 } 351 352 private: 353 friend class TracedReferenceBase; 354 friend class Utils; 355 template
356 friend class Eternal; 357 template
358 friend class Global; 359 template
360 friend class Local; 361 template
362 friend class MaybeLocal; 363 template
364 friend class Persistent; 365 template
366 friend class FunctionCallbackInfo; 367 template
368 friend class PropertyCallbackInfo; 369 friend class String; 370 friend class Object; 371 friend class Context; 372 friend class Isolate; 373 friend class Private; 374 template
375 friend class internal::CustomArguments; 376 friend Local
Undefined(Isolate* isolate); 377 friend Local
Null(Isolate* isolate); 378 friend Local
True(Isolate* isolate); 379 friend Local
False(Isolate* isolate); 380 friend class HandleScope; 381 friend class EscapableHandleScope; 382 friend class InternalEscapableScope; 383 template
384 friend class PersistentValueMapBase; 385 template
386 friend class PersistentValueVector; 387 template
388 friend class ReturnValue; 389 template
390 friend class Traced; 391 friend class internal::SamplingHeapProfiler; 392 friend class internal::HandleHelper; 393 friend class debug::ConsoleCallArguments; 394 friend class internal::LocalUnchecked
; 395 396 explicit Local(no_checking_tag do_not_check) 397 : LocalBase
(), StackAllocated(do_not_check) {} 398 explicit Local(const Local
& other, no_checking_tag do_not_check) 399 : LocalBase
(other), StackAllocated(do_not_check) {} 400 401 V8_INLINE explicit Local(const LocalBase
& other) : LocalBase
(other) {} 402 403 V8_INLINE static Local
FromSlot(internal::Address* slot) { 404 return Local
(LocalBase
::FromSlot(slot)); 405 } 406 407 #ifdef V8_ENABLE_DIRECT_LOCAL 408 friend class TypecheckWitness; 409 410 V8_INLINE static Local
FromAddress(internal::Address ptr) { 411 return Local
(LocalBase
(ptr)); 412 } 413 #endif // V8_ENABLE_DIRECT_LOCAL 414 415 V8_INLINE static Local
New(Isolate* isolate, internal::Address value) { 416 return Local
(LocalBase
::New(isolate, value)); 417 } 418 419 V8_INLINE static Local
New(Isolate* isolate, T* that) { 420 return Local
(LocalBase
::New(isolate, that)); 421 } 422 423 // Unsafe cast, should be avoided. 424 template
425 V8_INLINE Local
UnsafeAs() const { 426 return Local
(LocalBase
(*this)); 427 } 428 }; 429 430 namespace internal { 431 // A local variant that is suitable for off-stack allocation. 432 // Used internally by LocalVector
. Not to be used directly! 433 template
434 class V8_TRIVIAL_ABI LocalUnchecked : public Local
{ 435 public: 436 LocalUnchecked() : Local
(Local
::do_not_check) {} 437 438 #if defined(V8_ENABLE_LOCAL_OFF_STACK_CHECK) && V8_HAS_ATTRIBUTE_TRIVIAL_ABI 439 // In this case, the check is also enforced in the copy constructor and we 440 // need to suppress it. 441 LocalUnchecked(const LocalUnchecked& other) 442 : Local
(other, Local
::do_not_check) {} 443 LocalUnchecked& operator=(const LocalUnchecked&) = default; 444 #endif 445 446 // Implicit conversion from Local. 447 LocalUnchecked(const Local
& other) // NOLINT(runtime/explicit) 448 : Local
(other, Local
::do_not_check) {} 449 }; 450 451 #ifdef V8_ENABLE_DIRECT_LOCAL 452 // Off-stack allocated direct locals must be registered as strong roots. 453 // For off-stack indirect locals, this is not necessary. 454 455 template
456 class StrongRootAllocator
> : public StrongRootAllocatorBase { 457 public: 458 using value_type = LocalUnchecked
; 459 static_assert(std::is_standard_layout_v
); 460 static_assert(sizeof(value_type) == sizeof(Address)); 461 462 explicit StrongRootAllocator(Heap* heap) : StrongRootAllocatorBase(heap) {} 463 explicit StrongRootAllocator(v8::Isolate* isolate) 464 : StrongRootAllocatorBase(isolate) {} 465 template
466 StrongRootAllocator(const StrongRootAllocator
& other) noexcept 467 : StrongRootAllocatorBase(other) {} 468 469 value_type* allocate(size_t n) { 470 return reinterpret_cast
(allocate_impl(n)); 471 } 472 void deallocate(value_type* p, size_t n) noexcept { 473 return deallocate_impl(reinterpret_cast
(p), n); 474 } 475 }; 476 #endif // V8_ENABLE_DIRECT_LOCAL 477 } // namespace internal 478 479 template
480 class LocalVector { 481 private: 482 using element_type = internal::LocalUnchecked
; 483 484 #ifdef V8_ENABLE_DIRECT_LOCAL 485 using allocator_type = internal::StrongRootAllocator
; 486 487 static allocator_type make_allocator(Isolate* isolate) noexcept { 488 return allocator_type(isolate); 489 } 490 #else 491 using allocator_type = std::allocator
; 492 493 static allocator_type make_allocator(Isolate* isolate) noexcept { 494 return allocator_type(); 495 } 496 #endif // V8_ENABLE_DIRECT_LOCAL 497 498 using vector_type = std::vector
; 499 500 public: 501 using value_type = Local
; 502 using reference = value_type&; 503 using const_reference = const value_type&; 504 using size_type = size_t; 505 using difference_type = ptrdiff_t; 506 using iterator = 507 internal::WrappedIterator
>; 508 using const_iterator = 509 internal::WrappedIterator
>; 511 512 explicit LocalVector(Isolate* isolate) : backing_(make_allocator(isolate)) {} 513 LocalVector(Isolate* isolate, size_t n) 514 : backing_(n, make_allocator(isolate)) {} 515 explicit LocalVector(Isolate* isolate, std::initializer_list
> init) 516 : backing_(make_allocator(isolate)) { 517 if (init.size() == 0) return; 518 backing_.reserve(init.size()); 519 backing_.insert(backing_.end(), init.begin(), init.end()); 520 } 521 522 iterator begin() noexcept { return iterator(backing_.begin()); } 523 const_iterator begin() const noexcept { 524 return const_iterator(backing_.begin()); 525 } 526 iterator end() noexcept { return iterator(backing_.end()); } 527 const_iterator end() const noexcept { return const_iterator(backing_.end()); } 528 529 size_t size() const noexcept { return backing_.size(); } 530 bool empty() const noexcept { return backing_.empty(); } 531 void reserve(size_t n) { backing_.reserve(n); } 532 void shrink_to_fit() { backing_.shrink_to_fit(); } 533 534 Local
& operator[](size_t n) { return backing_[n]; } 535 const Local
& operator[](size_t n) const { return backing_[n]; } 536 537 Local
& at(size_t n) { return backing_.at(n); } 538 const Local
& at(size_t n) const { return backing_.at(n); } 539 540 Local
& front() { return backing_.front(); } 541 const Local
& front() const { return backing_.front(); } 542 Local
& back() { return backing_.back(); } 543 const Local
& back() const { return backing_.back(); } 544 545 Local
* data() noexcept { return backing_.data(); } 546 const Local
* data() const noexcept { return backing_.data(); } 547 548 iterator insert(const_iterator pos, const Local
& value) { 549 return iterator(backing_.insert(pos.base(), value)); 550 } 551 552 template
553 iterator insert(const_iterator pos, InputIt first, InputIt last) { 554 return iterator(backing_.insert(pos.base(), first, last)); 555 } 556 557 iterator insert(const_iterator pos, std::initializer_list
> init) { 558 return iterator(backing_.insert(pos.base(), init.begin(), init.end())); 559 } 560 561 LocalVector
& operator=(std::initializer_list
> init) { 562 backing_.clear(); 563 backing_.insert(backing_.end(), init.begin(), init.end()); 564 return *this; 565 } 566 567 void push_back(const Local
& x) { backing_.push_back(x); } 568 void pop_back() { backing_.pop_back(); } 569 void emplace_back(const Local
& 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
& other) { backing_.swap(other.backing_); } 574 575 friend bool operator==(const LocalVector
& x, const LocalVector
& y) { 576 return x.backing_ == y.backing_; 577 } 578 friend bool operator!=(const LocalVector
& x, const LocalVector
& y) { 579 return x.backing_ != y.backing_; 580 } 581 friend bool operator<(const LocalVector
& x, const LocalVector
& y) { 582 return x.backing_ < y.backing_; 583 } 584 friend bool operator>(const LocalVector
& x, const LocalVector
& y) { 585 return x.backing_ > y.backing_; 586 } 587 friend bool operator<=(const LocalVector
& x, const LocalVector
& y) { 588 return x.backing_ <= y.backing_; 589 } 590 friend bool operator>=(const LocalVector
& x, const LocalVector
& 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. 600 template
601 using Handle = Local
; 602 #endif 603 604 /** 605 * A MaybeLocal<> is a wrapper around Local<> that enforces a check whether 606 * the Local<> is empty before it can be used. 607 * 608 * If an API method returns a MaybeLocal<>, the API method can potentially fail 609 * either because an exception is thrown, or because an exception is pending, 610 * e.g. because a previous API call threw an exception that hasn't been caught 611 * yet, or because a TerminateExecution exception was thrown. In that case, an 612 * empty MaybeLocal is returned. 613 */ 614 template
615 class MaybeLocal { 616 public: 617 V8_INLINE MaybeLocal() : local_() {} 618 template
619 V8_INLINE MaybeLocal(Local
that) : local_(that) {} 620 621 V8_INLINE bool IsEmpty() const { return local_.IsEmpty(); } 622 623 /** 624 * Converts this MaybeLocal<> to a Local<>. If this MaybeLocal<> is empty, 625 * |false| is returned and |out| is assigned with nullptr. 626 */ 627 template
628 V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local
* out) const { 629 *out = local_; 630 return !IsEmpty(); 631 } 632 633 /** 634 * Converts this MaybeLocal<> to a Local<>. If this MaybeLocal<> is empty, 635 * V8 will crash the process. 636 */ 637 V8_INLINE Local
ToLocalChecked() { 638 if (V8_UNLIKELY(IsEmpty())) api_internal::ToLocalEmpty(); 639 return local_; 640 } 641 642 /** 643 * Converts this MaybeLocal<> to a Local<>, using a default value if this 644 * MaybeLocal<> is empty. 645 */ 646 template
647 V8_INLINE Local
FromMaybe(Local
default_value) const { 648 return IsEmpty() ? default_value : Local
(local_); 649 } 650 651 /** 652 * Cast a handle to a subclass, e.g. MaybeLocal
to MaybeLocal
. 653 * This is only valid if the handle actually refers to a value of the target 654 * type. 655 */ 656 template
657 V8_INLINE static MaybeLocal
Cast(MaybeLocal
that) { 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
(); 662 T::Cast(that.local_.template value
()); 663 #endif 664 return MaybeLocal
(that.local_); 665 } 666 667 /** 668 * Calling this is equivalent to MaybeLocal
::Cast(). 669 * In particular, this is only valid if the handle actually refers to a value 670 * of the target type. 671 */ 672 template
673 V8_INLINE MaybeLocal
As() const { 674 return MaybeLocal
::Cast(*this); 675 } 676 677 private: 678 Local
local_; 679 680 template
681 friend class MaybeLocal; 682 }; 683 684 /** 685 * A HandleScope which first allocates a handle in the current scope 686 * which will be later filled with the escape value. 687 */ 688 class V8_EXPORT V8_NODISCARD EscapableHandleScopeBase : public HandleScope { 689 public: 690 explicit EscapableHandleScopeBase(Isolate* isolate); 691 V8_INLINE ~EscapableHandleScopeBase() = default; 692 693 EscapableHandleScopeBase(const EscapableHandleScopeBase&) = delete; 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: 701 /** 702 * Pushes the value into the previous scope and returns a handle to it. 703 * Cannot be called twice. 704 */ 705 internal::Address* EscapeSlot(internal::Address* escape_value); 706 707 private: 708 internal::Address* escape_slot_; 709 }; 710 711 class V8_EXPORT V8_NODISCARD EscapableHandleScope 712 : public EscapableHandleScopeBase { 713 public: 714 explicit EscapableHandleScope(Isolate* isolate) 715 : EscapableHandleScopeBase(isolate) {} 716 V8_INLINE ~EscapableHandleScope() = default; 717 template
718 V8_INLINE Local
Escape(Local
value) { 719 #ifdef V8_ENABLE_DIRECT_LOCAL 720 return value; 721 #else 722 if (value.IsEmpty()) return value; 723 return Local
::FromSlot(EscapeSlot(value.slot())); 724 #endif 725 } 726 727 template
728 V8_INLINE MaybeLocal
EscapeMaybe(MaybeLocal
value) { 729 return Escape(value.FromMaybe(Local
())); 730 } 731 }; 732 733 /** 734 * A SealHandleScope acts like a handle scope in which no handle allocations 735 * are allowed. It can be useful for debugging handle leaks. 736 * Handles can be allocated within inner normal HandleScopes. 737 */ 738 class V8_EXPORT V8_NODISCARD SealHandleScope { 739 public: 740 explicit SealHandleScope(Isolate* isolate); 741 ~SealHandleScope(); 742 743 SealHandleScope(const SealHandleScope&) = delete; 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_
Contact us
|
About us
|
Term of use
|
Copyright © 2000-2025 MyWebUniversity.com ™