V8  latest master commit
V8 is Google's open source JavaScript engine
v8.h
Go to the documentation of this file.
1 // Copyright 2012 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 
15 #ifndef INCLUDE_V8_H_
16 #define INCLUDE_V8_H_
17 
18 #include <stddef.h>
19 #include <stdint.h>
20 #include <stdio.h>
21 
22 #include <memory>
23 #include <string>
24 #include <type_traits>
25 #include <utility>
26 #include <vector>
27 
28 #include "cppgc/common.h"
29 #include "v8-internal.h" // NOLINT(build/include_directory)
30 #include "v8-version.h" // NOLINT(build/include_directory)
31 #include "v8config.h" // NOLINT(build/include_directory)
32 
33 // We reserve the V8_* prefix for macros defined in V8 public API and
34 // assume there are no name conflicts with the embedder's code.
35 
39 namespace v8 {
40 
41 class AccessorSignature;
42 class Array;
43 class ArrayBuffer;
44 class BigInt;
45 class BigIntObject;
46 class Boolean;
47 class BooleanObject;
48 class Context;
49 class Data;
50 class Date;
51 class External;
52 class Function;
53 class FunctionTemplate;
54 class HeapProfiler;
55 class ImplementationUtilities;
56 class Int32;
57 class Integer;
58 class Isolate;
59 template <class T>
60 class Maybe;
61 class MicrotaskQueue;
62 class Name;
63 class Number;
64 class NumberObject;
65 class Object;
66 class ObjectOperationDescriptor;
67 class ObjectTemplate;
68 class Platform;
69 class Primitive;
70 class Promise;
71 class PropertyDescriptor;
72 class Proxy;
73 class RawOperationDescriptor;
74 class Script;
75 class SharedArrayBuffer;
76 class Signature;
77 class StartupData;
78 class StackFrame;
79 class StackTrace;
80 class String;
81 class StringObject;
82 class Symbol;
83 class SymbolObject;
84 class PrimitiveArray;
85 class Private;
86 class Uint32;
87 class Utils;
88 class Value;
89 class WasmModuleObject;
90 template <class T> class Local;
91 template <class T>
92 class MaybeLocal;
93 template <class T> class Eternal;
94 template<class T> class NonCopyablePersistentTraits;
95 template<class T> class PersistentBase;
96 template <class T, class M = NonCopyablePersistentTraits<T> >
97 class Persistent;
98 template <class T>
99 class Global;
100 template <class T>
102 template <class T>
104 template <class T>
106 template<class K, class V, class T> class PersistentValueMap;
107 template <class K, class V, class T>
109 template <class K, class V, class T>
110 class GlobalValueMap;
111 template<class V, class T> class PersistentValueVector;
112 template<class T, class P> class WeakCallbackObject;
113 class FunctionTemplate;
114 class ObjectTemplate;
115 template<typename T> class FunctionCallbackInfo;
116 template<typename T> class PropertyCallbackInfo;
117 class StackTrace;
118 class StackFrame;
119 class Isolate;
120 class CallHandlerHelper;
122 template<typename T> class ReturnValue;
123 
124 namespace internal {
125 enum class ArgumentsType;
126 template <ArgumentsType>
127 class Arguments;
128 template <typename T>
130 class DeferredHandles;
131 class FunctionCallbackArguments;
132 class GlobalHandles;
133 class Heap;
134 class HeapObject;
135 class ExternalString;
136 class Isolate;
137 class LocalEmbedderHeapTracer;
138 class MicrotaskQueue;
139 class PropertyCallbackArguments;
140 class ReadOnlyHeap;
141 class ScopedExternalStringLock;
142 struct ScriptStreamingData;
143 class ThreadLocalTop;
144 
145 namespace wasm {
146 class NativeModule;
147 class StreamingDecoder;
148 } // namespace wasm
149 
150 } // namespace internal
151 
152 namespace debug {
153 class ConsoleCallArguments;
154 } // namespace debug
155 
156 // --- Handles ---
157 
189 template <class T>
190 class Local {
191  public:
192  V8_INLINE Local() : val_(nullptr) {}
193  template <class S>
195  : val_(reinterpret_cast<T*>(*that)) {
201  static_assert(std::is_base_of<T, S>::value, "type check");
202  }
203 
207  V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
208 
212  V8_INLINE void Clear() { val_ = nullptr; }
213 
214  V8_INLINE T* operator->() const { return val_; }
215 
216  V8_INLINE T* operator*() const { return val_; }
217 
228  template <class S>
229  V8_INLINE bool operator==(const Local<S>& that) const {
230  internal::Address* a = reinterpret_cast<internal::Address*>(this->val_);
231  internal::Address* b = reinterpret_cast<internal::Address*>(that.val_);
232  if (a == nullptr) return b == nullptr;
233  if (b == nullptr) return false;
234  return *a == *b;
235  }
236 
237  template <class S> V8_INLINE bool operator==(
238  const PersistentBase<S>& that) const {
239  internal::Address* a = reinterpret_cast<internal::Address*>(this->val_);
240  internal::Address* b = reinterpret_cast<internal::Address*>(that.val_);
241  if (a == nullptr) return b == nullptr;
242  if (b == nullptr) return false;
243  return *a == *b;
244  }
245 
256  template <class S>
257  V8_INLINE bool operator!=(const Local<S>& that) const {
258  return !operator==(that);
259  }
260 
261  template <class S> V8_INLINE bool operator!=(
262  const Persistent<S>& that) const {
263  return !operator==(that);
264  }
265 
271  template <class S> V8_INLINE static Local<T> Cast(Local<S> that) {
272 #ifdef V8_ENABLE_CHECKS
273  // If we're going to perform the type check then we have to check
274  // that the handle isn't empty before doing the checked cast.
275  if (that.IsEmpty()) return Local<T>();
276 #endif
277  return Local<T>(T::Cast(*that));
278  }
279 
285  template <class S>
287  return Local<S>::Cast(*this);
288  }
289 
295  V8_INLINE static Local<T> New(Isolate* isolate, Local<T> that);
296  V8_INLINE static Local<T> New(Isolate* isolate,
297  const PersistentBase<T>& that);
298  V8_INLINE static Local<T> New(Isolate* isolate,
299  const TracedReferenceBase<T>& that);
300 
301  private:
302  friend class Utils;
303  template<class F> friend class Eternal;
304  template<class F> friend class PersistentBase;
305  template<class F, class M> friend class Persistent;
306  template<class F> friend class Local;
307  template <class F>
308  friend class MaybeLocal;
309  template<class F> friend class FunctionCallbackInfo;
310  template<class F> friend class PropertyCallbackInfo;
311  friend class String;
312  friend class Object;
313  friend class Context;
314  friend class Isolate;
315  friend class Private;
316  template<class F> friend class internal::CustomArguments;
317  friend Local<Primitive> Undefined(Isolate* isolate);
318  friend Local<Primitive> Null(Isolate* isolate);
319  friend Local<Boolean> True(Isolate* isolate);
320  friend Local<Boolean> False(Isolate* isolate);
321  friend class HandleScope;
322  friend class EscapableHandleScope;
323  template <class F1, class F2, class F3>
325  template<class F1, class F2> friend class PersistentValueVector;
326  template <class F>
327  friend class ReturnValue;
328  template <class F>
329  friend class Traced;
330  template <class F>
331  friend class TracedGlobal;
332  template <class F>
333  friend class TracedReferenceBase;
334  template <class F>
335  friend class TracedReference;
336 
337  explicit V8_INLINE Local(T* that) : val_(that) {}
338  V8_INLINE static Local<T> New(Isolate* isolate, T* that);
339  T* val_;
340 };
341 
342 
343 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
344 // Handle is an alias for Local for historical reasons.
345 template <class T>
346 using Handle = Local<T>;
347 #endif
348 
349 
360 template <class T>
361 class MaybeLocal {
362  public:
363  V8_INLINE MaybeLocal() : val_(nullptr) {}
364  template <class S>
366  : val_(reinterpret_cast<T*>(*that)) {
367  static_assert(std::is_base_of<T, S>::value, "type check");
368  }
369 
370  V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
371 
376  template <class S>
378  out->val_ = IsEmpty() ? nullptr : this->val_;
379  return !IsEmpty();
380  }
381 
387 
392  template <class S>
393  V8_INLINE Local<S> FromMaybe(Local<S> default_value) const {
394  return IsEmpty() ? default_value : Local<S>(val_);
395  }
396 
397  private:
398  T* val_;
399 };
400 
405 template <class T> class Eternal {
406  public:
407  V8_INLINE Eternal() : val_(nullptr) {}
408  template <class S>
409  V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : val_(nullptr) {
410  Set(isolate, handle);
411  }
412  // Can only be safely called if already set.
413  V8_INLINE Local<T> Get(Isolate* isolate) const;
414  V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
415  template<class S> V8_INLINE void Set(Isolate* isolate, Local<S> handle);
416 
417  private:
418  T* val_;
419 };
420 
421 
422 static const int kInternalFieldsInWeakCallback = 2;
423 static const int kEmbedderFieldsInWeakCallback = 2;
424 
425 template <typename T>
427  public:
428  typedef void (*Callback)(const WeakCallbackInfo<T>& data);
429 
430  WeakCallbackInfo(Isolate* isolate, T* parameter,
431  void* embedder_fields[kEmbedderFieldsInWeakCallback],
432  Callback* callback)
433  : isolate_(isolate), parameter_(parameter), callback_(callback) {
434  for (int i = 0; i < kEmbedderFieldsInWeakCallback; ++i) {
435  embedder_fields_[i] = embedder_fields[i];
436  }
437  }
438 
439  V8_INLINE Isolate* GetIsolate() const { return isolate_; }
440  V8_INLINE T* GetParameter() const { return parameter_; }
441  V8_INLINE void* GetInternalField(int index) const;
442 
443  // When first called, the embedder MUST Reset() the Global which triggered the
444  // callback. The Global itself is unusable for anything else. No v8 other api
445  // calls may be called in the first callback. Should additional work be
446  // required, the embedder must set a second pass callback, which will be
447  // called after all the initial callbacks are processed.
448  // Calling SetSecondPassCallback on the second pass will immediately crash.
449  void SetSecondPassCallback(Callback callback) const { *callback_ = callback; }
450 
451  private:
452  Isolate* isolate_;
453  T* parameter_;
454  Callback* callback_;
455  void* embedder_fields_[kEmbedderFieldsInWeakCallback];
456 };
457 
458 
459 // kParameter will pass a void* parameter back to the callback, kInternalFields
460 // will pass the first two internal fields back to the callback, kFinalizer
461 // will pass a void* parameter back, but is invoked before the object is
462 // actually collected, so it can be resurrected. In the last case, it is not
463 // possible to request a second pass callback.
465 
479 template <class T> class PersistentBase {
480  public:
485  V8_INLINE void Reset();
490  template <class S>
491  V8_INLINE void Reset(Isolate* isolate, const Local<S>& other);
492 
497  template <class S>
498  V8_INLINE void Reset(Isolate* isolate, const PersistentBase<S>& other);
499 
500  V8_INLINE bool IsEmpty() const { return val_ == nullptr; }
501  V8_INLINE void Empty() { val_ = 0; }
502 
503  V8_INLINE Local<T> Get(Isolate* isolate) const {
504  return Local<T>::New(isolate, *this);
505  }
506 
507  template <class S>
508  V8_INLINE bool operator==(const PersistentBase<S>& that) const {
509  internal::Address* a = reinterpret_cast<internal::Address*>(this->val_);
510  internal::Address* b = reinterpret_cast<internal::Address*>(that.val_);
511  if (a == nullptr) return b == nullptr;
512  if (b == nullptr) return false;
513  return *a == *b;
514  }
515 
516  template <class S>
517  V8_INLINE bool operator==(const Local<S>& that) const {
518  internal::Address* a = reinterpret_cast<internal::Address*>(this->val_);
519  internal::Address* b = reinterpret_cast<internal::Address*>(that.val_);
520  if (a == nullptr) return b == nullptr;
521  if (b == nullptr) return false;
522  return *a == *b;
523  }
524 
525  template <class S>
526  V8_INLINE bool operator!=(const PersistentBase<S>& that) const {
527  return !operator==(that);
528  }
529 
530  template <class S>
531  V8_INLINE bool operator!=(const Local<S>& that) const {
532  return !operator==(that);
533  }
534 
547  template <typename P>
548  V8_INLINE void SetWeak(P* parameter,
549  typename WeakCallbackInfo<P>::Callback callback,
550  WeakCallbackType type);
551 
559  V8_INLINE void SetWeak();
560 
561  template<typename P>
562  V8_INLINE P* ClearWeak();
563 
564  // TODO(dcarney): remove this.
565  V8_INLINE void ClearWeak() { ClearWeak<void>(); }
566 
573  V8_INLINE void AnnotateStrongRetainer(const char* label);
574 
576  V8_INLINE bool IsWeak() const;
577 
581  V8_INLINE void SetWrapperClassId(uint16_t class_id);
582 
587  V8_INLINE uint16_t WrapperClassId() const;
588 
589  PersistentBase(const PersistentBase& other) = delete; // NOLINT
590  void operator=(const PersistentBase&) = delete;
591 
592  private:
593  friend class Isolate;
594  friend class Utils;
595  template<class F> friend class Local;
596  template<class F1, class F2> friend class Persistent;
597  template <class F>
598  friend class Global;
599  template<class F> friend class PersistentBase;
600  template<class F> friend class ReturnValue;
601  template <class F1, class F2, class F3>
603  template<class F1, class F2> friend class PersistentValueVector;
604  friend class Object;
605 
606  explicit V8_INLINE PersistentBase(T* val) : val_(val) {}
607  V8_INLINE static T* New(Isolate* isolate, T* that);
608 
609  T* val_;
610 };
611 
612 
619 template<class T>
620 class NonCopyablePersistentTraits {
621  public:
623  static const bool kResetInDestructor = false;
624  template<class S, class M>
625  V8_INLINE static void Copy(const Persistent<S, M>& source,
626  NonCopyablePersistent* dest) {
627  static_assert(sizeof(S) < 0,
628  "NonCopyablePersistentTraits::Copy is not instantiable");
629  }
630 };
631 
632 
637 template<class T>
640  static const bool kResetInDestructor = true;
641  template<class S, class M>
642  static V8_INLINE void Copy(const Persistent<S, M>& source,
643  CopyablePersistent* dest) {
644  // do nothing, just allow copy
645  }
646 };
647 
648 
657 template <class T, class M> class Persistent : public PersistentBase<T> {
658  public:
668  template <class S>
670  : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) {
671  static_assert(std::is_base_of<T, S>::value, "type check");
672  }
678  template <class S, class M2>
680  : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) {
681  static_assert(std::is_base_of<T, S>::value, "type check");
682  }
689  V8_INLINE Persistent(const Persistent& that) : PersistentBase<T>(nullptr) {
690  Copy(that);
691  }
692  template <class S, class M2>
694  Copy(that);
695  }
697  Copy(that);
698  return *this;
699  }
700  template <class S, class M2>
702  Copy(that);
703  return *this;
704  }
711  if (M::kResetInDestructor) this->Reset();
712  }
713 
714  // TODO(dcarney): this is pretty useless, fix or remove
715  template <class S>
716  V8_INLINE static Persistent<T>& Cast(const Persistent<S>& that) { // NOLINT
717 #ifdef V8_ENABLE_CHECKS
718  // If we're going to perform the type check then we have to check
719  // that the handle isn't empty before doing the checked cast.
720  if (!that.IsEmpty()) T::Cast(*that);
721 #endif
722  return reinterpret_cast<Persistent<T>&>(const_cast<Persistent<S>&>(that));
723  }
724 
725  // TODO(dcarney): this is pretty useless, fix or remove
726  template <class S>
727  V8_INLINE Persistent<S>& As() const { // NOLINT
728  return Persistent<S>::Cast(*this);
729  }
730 
731  private:
732  friend class Isolate;
733  friend class Utils;
734  template<class F> friend class Local;
735  template<class F1, class F2> friend class Persistent;
736  template<class F> friend class ReturnValue;
737 
738  explicit V8_INLINE Persistent(T* that) : PersistentBase<T>(that) {}
739  V8_INLINE T* operator*() const { return this->val_; }
740  template<class S, class M2>
741  V8_INLINE void Copy(const Persistent<S, M2>& that);
742 };
743 
744 
750 template <class T>
751 class Global : public PersistentBase<T> {
752  public:
756  V8_INLINE Global() : PersistentBase<T>(nullptr) {}
757 
763  template <class S>
765  : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) {
766  static_assert(std::is_base_of<T, S>::value, "type check");
767  }
768 
774  template <class S>
775  V8_INLINE Global(Isolate* isolate, const PersistentBase<S>& that)
776  : PersistentBase<T>(PersistentBase<T>::New(isolate, that.val_)) {
777  static_assert(std::is_base_of<T, S>::value, "type check");
778  }
779 
783  V8_INLINE Global(Global&& other);
784 
785  V8_INLINE ~Global() { this->Reset(); }
786 
790  template <class S>
792 
796  Global Pass() { return static_cast<Global&&>(*this); } // NOLINT
797 
798  /*
799  * For compatibility with Chromium's base::Bind (base::Passed).
800  */
801  typedef void MoveOnlyTypeForCPP03;
802 
803  Global(const Global&) = delete;
804  void operator=(const Global&) = delete;
805 
806  private:
807  template <class F>
808  friend class ReturnValue;
809  V8_INLINE T* operator*() const { return this->val_; }
810 };
811 
812 
813 // UniquePersistent is an alias for Global for historical reason.
814 template <class T>
816 
820 template <typename T>
822 
838 template <typename T>
839 class TracedReferenceBase {
840  public:
845  bool IsEmpty() const { return val_ == nullptr; }
846 
851  V8_INLINE void Reset();
852 
856  Local<T> Get(Isolate* isolate) const { return Local<T>::New(isolate, *this); }
857 
858  template <class S>
859  V8_INLINE bool operator==(const TracedReferenceBase<S>& that) const {
860  internal::Address* a = reinterpret_cast<internal::Address*>(val_);
861  internal::Address* b = reinterpret_cast<internal::Address*>(that.val_);
862  if (a == nullptr) return b == nullptr;
863  if (b == nullptr) return false;
864  return *a == *b;
865  }
866 
867  template <class S>
868  V8_INLINE bool operator==(const Local<S>& that) const {
869  internal::Address* a = reinterpret_cast<internal::Address*>(val_);
870  internal::Address* b = reinterpret_cast<internal::Address*>(that.val_);
871  if (a == nullptr) return b == nullptr;
872  if (b == nullptr) return false;
873  return *a == *b;
874  }
875 
876  template <class S>
877  V8_INLINE bool operator!=(const TracedReferenceBase<S>& that) const {
878  return !operator==(that);
879  }
880 
881  template <class S>
882  V8_INLINE bool operator!=(const Local<S>& that) const {
883  return !operator==(that);
884  }
885 
889  V8_INLINE void SetWrapperClassId(uint16_t class_id);
890 
895  V8_INLINE uint16_t WrapperClassId() const;
896 
897  template <class S>
899  return reinterpret_cast<TracedReferenceBase<S>&>(
900  const_cast<TracedReferenceBase<T>&>(*this));
901  }
902 
903  private:
904  enum DestructionMode { kWithDestructor, kWithoutDestructor };
905 
909  TracedReferenceBase() = default;
910 
911  V8_INLINE static T* New(Isolate* isolate, T* that, void* slot,
912  DestructionMode destruction_mode);
913 
914  T* val_ = nullptr;
915 
916  friend class EmbedderHeapTracer;
917  template <typename F>
918  friend class Local;
919  friend class Object;
920  template <typename F>
921  friend class TracedGlobal;
922  template <typename F>
923  friend class TracedReference;
924  template <typename F>
925  friend class ReturnValue;
926 };
927 
932 template <typename T>
933 class TracedGlobal : public TracedReferenceBase<T> {
934  public:
936 
940  ~TracedGlobal() { this->Reset(); }
941 
946 
953  template <class S>
955  this->val_ = this->New(isolate, that.val_, &this->val_,
957  static_assert(std::is_base_of<T, S>::value, "type check");
958  }
959 
964  // Forward to operator=.
965  *this = std::move(other);
966  }
967 
971  template <typename S>
973  // Forward to operator=.
974  *this = std::move(other);
975  }
976 
981  // Forward to operator=;
982  *this = other;
983  }
984 
988  template <typename S>
990  // Forward to operator=;
991  *this = other;
992  }
993 
998 
1002  template <class S>
1004 
1012 
1019  template <class S>
1021 
1026  template <class S>
1027  V8_INLINE void Reset(Isolate* isolate, const Local<S>& other);
1028 
1029  template <class S>
1031  return reinterpret_cast<TracedGlobal<S>&>(
1032  const_cast<TracedGlobal<T>&>(*this));
1033  }
1034 
1046  void* parameter, WeakCallbackInfo<void>::Callback callback);
1047 };
1048 
1060 template <typename T>
1061 class TracedReference : public TracedReferenceBase<T> {
1062  public:
1064 
1069 
1076  template <class S>
1078  this->val_ = this->New(isolate, that.val_, &this->val_,
1080  static_assert(std::is_base_of<T, S>::value, "type check");
1081  }
1082 
1088  // Forward to operator=.
1089  *this = std::move(other);
1090  }
1091 
1096  template <typename S>
1098  // Forward to operator=.
1099  *this = std::move(other);
1100  }
1101 
1107  // Forward to operator=;
1108  *this = other;
1109  }
1110 
1115  template <typename S>
1117  // Forward to operator=;
1118  *this = other;
1119  }
1120 
1125 
1129  template <class S>
1131 
1136 
1140  template <class S>
1142 
1147  template <class S>
1148  V8_INLINE void Reset(Isolate* isolate, const Local<S>& other);
1149 
1150  template <class S>
1152  return reinterpret_cast<TracedReference<S>&>(
1153  const_cast<TracedReference<T>&>(*this));
1154  }
1155 };
1156 
1172  public:
1173  explicit HandleScope(Isolate* isolate);
1174 
1175  ~HandleScope();
1176 
1180  static int NumberOfHandles(Isolate* isolate);
1181 
1183  return reinterpret_cast<Isolate*>(isolate_);
1184  }
1185 
1186  HandleScope(const HandleScope&) = delete;
1187  void operator=(const HandleScope&) = delete;
1188 
1189  protected:
1190  V8_INLINE HandleScope() = default;
1191 
1192  void Initialize(Isolate* isolate);
1193 
1194  static internal::Address* CreateHandle(internal::Isolate* isolate,
1195  internal::Address value);
1196 
1197  private:
1198  // Declaring operator new and delete as deleted is not spec compliant.
1199  // Therefore declare them private instead to disable dynamic alloc
1200  void* operator new(size_t size);
1201  void* operator new[](size_t size);
1202  void operator delete(void*, size_t);
1203  void operator delete[](void*, size_t);
1204 
1205  internal::Isolate* isolate_;
1206  internal::Address* prev_next_;
1207  internal::Address* prev_limit_;
1208 
1209  // Local::New uses CreateHandle with an Isolate* parameter.
1210  template<class F> friend class Local;
1211 
1212  // Object::GetInternalField and Context::GetEmbedderData use CreateHandle with
1213  // a HeapObject in their shortcuts.
1214  friend class Object;
1215  friend class Context;
1216 };
1217 
1218 
1224  public:
1225  explicit EscapableHandleScope(Isolate* isolate);
1226  V8_INLINE ~EscapableHandleScope() = default;
1227 
1232  template <class T>
1234  internal::Address* slot =
1235  Escape(reinterpret_cast<internal::Address*>(*value));
1236  return Local<T>(reinterpret_cast<T*>(slot));
1237  }
1238 
1239  template <class T>
1241  return Escape(value.FromMaybe(Local<T>()));
1242  }
1243 
1244  EscapableHandleScope(const EscapableHandleScope&) = delete;
1245  void operator=(const EscapableHandleScope&) = delete;
1246 
1247  private:
1248  // Declaring operator new and delete as deleted is not spec compliant.
1249  // Therefore declare them private instead to disable dynamic alloc
1250  void* operator new(size_t size);
1251  void* operator new[](size_t size);
1252  void operator delete(void*, size_t);
1253  void operator delete[](void*, size_t);
1254 
1255  internal::Address* Escape(internal::Address* escape_value);
1256  internal::Address* escape_slot_;
1257 };
1258 
1265  public:
1266  explicit SealHandleScope(Isolate* isolate);
1267  ~SealHandleScope();
1268 
1269  SealHandleScope(const SealHandleScope&) = delete;
1270  void operator=(const SealHandleScope&) = delete;
1271 
1272  private:
1273  // Declaring operator new and delete as deleted is not spec compliant.
1274  // Therefore declare them private instead to disable dynamic alloc
1275  void* operator new(size_t size);
1276  void* operator new[](size_t size);
1277  void operator delete(void*, size_t);
1278  void operator delete[](void*, size_t);
1279 
1280  internal::Isolate* const isolate_;
1281  internal::Address* prev_limit_;
1282  int prev_sealed_level_;
1283 };
1284 
1285 
1286 // --- Special objects ---
1287 
1292  private:
1293  Data();
1294 };
1295 
1303  public:
1308  Local<Value> GetResourceName();
1309 
1314  Local<PrimitiveArray> GetHostDefinedOptions();
1315 };
1316 
1326  public:
1327  static Local<PrimitiveArray> New(Isolate* isolate, int length);
1328  int Length() const;
1329  void Set(Isolate* isolate, int index, Local<Primitive> item);
1330  Local<Primitive> Get(Isolate* isolate, int index);
1331 };
1332 
1337  public:
1338  V8_INLINE ScriptOriginOptions(bool is_shared_cross_origin = false,
1339  bool is_opaque = false, bool is_wasm = false,
1340  bool is_module = false)
1341  : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
1342  (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) |
1343  (is_module ? kIsModule : 0)) {}
1345  : flags_(flags &
1346  (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {}
1347 
1348  bool IsSharedCrossOrigin() const {
1349  return (flags_ & kIsSharedCrossOrigin) != 0;
1350  }
1351  bool IsOpaque() const { return (flags_ & kIsOpaque) != 0; }
1352  bool IsWasm() const { return (flags_ & kIsWasm) != 0; }
1353  bool IsModule() const { return (flags_ & kIsModule) != 0; }
1354 
1355  int Flags() const { return flags_; }
1356 
1357  private:
1358  enum {
1359  kIsSharedCrossOrigin = 1,
1360  kIsOpaque = 1 << 1,
1361  kIsWasm = 1 << 2,
1362  kIsModule = 1 << 3
1363  };
1364  const int flags_;
1365 };
1366 
1371  public:
1373  Local<Value> resource_name,
1374  Local<Integer> resource_line_offset = Local<Integer>(),
1375  Local<Integer> resource_column_offset = Local<Integer>(),
1376  Local<Boolean> resource_is_shared_cross_origin = Local<Boolean>(),
1377  Local<Integer> script_id = Local<Integer>(),
1378  Local<Value> source_map_url = Local<Value>(),
1379  Local<Boolean> resource_is_opaque = Local<Boolean>(),
1380  Local<Boolean> is_wasm = Local<Boolean>(),
1381  Local<Boolean> is_module = Local<Boolean>(),
1382  Local<PrimitiveArray> host_defined_options = Local<PrimitiveArray>());
1383 
1390  V8_INLINE ScriptOriginOptions Options() const { return options_; }
1391 
1392  private:
1393  Local<Value> resource_name_;
1394  Local<Integer> resource_line_offset_;
1395  Local<Integer> resource_column_offset_;
1396  ScriptOriginOptions options_;
1397  Local<Integer> script_id_;
1398  Local<Value> source_map_url_;
1399  Local<PrimitiveArray> host_defined_options_;
1400 };
1401 
1406  public:
1410  Local<Script> BindToCurrentContext();
1411 
1412  int GetId();
1413  Local<Value> GetScriptName();
1414 
1418  Local<Value> GetSourceURL();
1422  Local<Value> GetSourceMappingURL();
1423 
1428  int GetLineNumber(int code_pos);
1429 
1430  static const int kNoScriptId = 0;
1431 };
1432 
1437  // Only used as a container for code caching.
1438 };
1439 
1444  public:
1445  int GetLineNumber() { return line_number_; }
1446  int GetColumnNumber() { return column_number_; }
1447 
1448  Location(int line_number, int column_number)
1449  : line_number_(line_number), column_number_(column_number) {}
1450 
1451  private:
1452  int line_number_;
1453  int column_number_;
1454 };
1455 
1459 class V8_EXPORT Module : public Data {
1460  public:
1468  enum Status {
1474  kErrored
1475  };
1476 
1480  Status GetStatus() const;
1481 
1485  Local<Value> GetException() const;
1486 
1490  int GetModuleRequestsLength() const;
1491 
1496  Local<String> GetModuleRequest(int i) const;
1497 
1502  Location GetModuleRequestLocation(int i) const;
1503 
1507  int GetIdentityHash() const;
1508 
1509  typedef MaybeLocal<Module> (*ResolveCallback)(Local<Context> context,
1510  Local<String> specifier,
1511  Local<Module> referrer);
1512 
1520  V8_WARN_UNUSED_RESULT Maybe<bool> InstantiateModule(Local<Context> context,
1521  ResolveCallback callback);
1522 
1532 
1538  Local<Value> GetModuleNamespace();
1539 
1546  Local<UnboundModuleScript> GetUnboundModuleScript();
1547 
1548  /*
1549  * Callback defined in the embedder. This is responsible for setting
1550  * the module's exported values with calls to SetSyntheticModuleExport().
1551  * The callback must return a Value to indicate success (where no
1552  * exception was thrown) and return an empy MaybeLocal to indicate falure
1553  * (where an exception was thrown).
1554  */
1555  typedef MaybeLocal<Value> (*SyntheticModuleEvaluationSteps)(
1556  Local<Context> context, Local<Module> module);
1557 
1565  static Local<Module> CreateSyntheticModule(
1566  Isolate* isolate, Local<String> module_name,
1567  const std::vector<Local<String>>& export_names,
1568  SyntheticModuleEvaluationSteps evaluation_steps);
1569 
1577  V8_WARN_UNUSED_RESULT Maybe<bool> SetSyntheticModuleExport(
1578  Isolate* isolate, Local<String> export_name, Local<Value> export_value);
1580  "Use the preceding SetSyntheticModuleExport with an Isolate parameter, "
1581  "instead of the one that follows. The former will throw a runtime "
1582  "error if called for an export that doesn't exist (as per spec); "
1583  "the latter will crash with a failed CHECK().")
1584  void SetSyntheticModuleExport(Local<String> export_name,
1585  Local<Value> export_value);
1586 };
1587 
1593  public:
1598  Local<Context> context, Local<String> source,
1599  ScriptOrigin* origin = nullptr);
1600 
1607 
1611  Local<UnboundScript> GetUnboundScript();
1612 };
1613 
1614 
1619  public:
1630  BufferOwned
1631  };
1632 
1634  : data(nullptr),
1635  length(0),
1636  rejected(false),
1637  buffer_policy(BufferNotOwned) {}
1638 
1639  // If buffer_policy is BufferNotOwned, the caller keeps the ownership of
1640  // data and guarantees that it stays alive until the CachedData object is
1641  // destroyed. If the policy is BufferOwned, the given data will be deleted
1642  // (with delete[]) when the CachedData object is destroyed.
1643  CachedData(const uint8_t* data, int length,
1644  BufferPolicy buffer_policy = BufferNotOwned);
1645  ~CachedData();
1646  // TODO(marja): Async compilation; add constructors which take a callback
1647  // which will be called when V8 no longer needs the data.
1648  const uint8_t* data;
1649  int length;
1650  bool rejected;
1652 
1653  // Prevent copying.
1654  CachedData(const CachedData&) = delete;
1655  CachedData& operator=(const CachedData&) = delete;
1656  };
1657 
1661  class Source {
1662  public:
1663  // Source takes ownership of CachedData.
1664  V8_INLINE Source(Local<String> source_string, const ScriptOrigin& origin,
1665  CachedData* cached_data = nullptr);
1666  V8_INLINE Source(Local<String> source_string,
1667  CachedData* cached_data = nullptr);
1668  V8_INLINE ~Source();
1669 
1670  // Ownership of the CachedData or its buffers is *not* transferred to the
1671  // caller. The CachedData object is alive as long as the Source object is
1672  // alive.
1673  V8_INLINE const CachedData* GetCachedData() const;
1674 
1675  V8_INLINE const ScriptOriginOptions& GetResourceOptions() const;
1676 
1677  // Prevent copying.
1678  Source(const Source&) = delete;
1679  Source& operator=(const Source&) = delete;
1680 
1681  private:
1682  friend class ScriptCompiler;
1683 
1684  Local<String> source_string;
1685 
1686  // Origin information
1687  Local<Value> resource_name;
1688  Local<Integer> resource_line_offset;
1689  Local<Integer> resource_column_offset;
1690  ScriptOriginOptions resource_options;
1691  Local<Value> source_map_url;
1692  Local<PrimitiveArray> host_defined_options;
1693 
1694  // Cached data from previous compilation (if a kConsume*Cache flag is
1695  // set), or hold newly generated cache data (kProduce*Cache flags) are
1696  // set when calling a compile method.
1697  CachedData* cached_data;
1698  };
1699 
1705  public:
1706  virtual ~ExternalSourceStream() = default;
1707 
1729  virtual size_t GetMoreData(const uint8_t** src) = 0;
1730 
1741  virtual bool SetBookmark();
1742 
1746  virtual void ResetToBookmark();
1747  };
1748 
1756  public:
1757  enum Encoding { ONE_BYTE, TWO_BYTE, UTF8 };
1758 
1760  "This class takes ownership of source_stream, so use the constructor "
1761  "taking a unique_ptr to make these semantics clearer")
1762  StreamedSource(ExternalSourceStream* source_stream, Encoding encoding);
1763  StreamedSource(std::unique_ptr<ExternalSourceStream> source_stream,
1764  Encoding encoding);
1765  ~StreamedSource();
1766 
1767  internal::ScriptStreamingData* impl() const { return impl_.get(); }
1768 
1769  // Prevent copying.
1770  StreamedSource(const StreamedSource&) = delete;
1771  StreamedSource& operator=(const StreamedSource&) = delete;
1772 
1773  private:
1774  std::unique_ptr<internal::ScriptStreamingData> impl_;
1775  };
1776 
1782  public:
1783  void Run();
1784 
1785  private:
1786  friend class ScriptCompiler;
1787 
1788  explicit ScriptStreamingTask(internal::ScriptStreamingData* data)
1789  : data_(data) {}
1790 
1791  internal::ScriptStreamingData* data_;
1792  };
1793 
1795  kNoCompileOptions = 0,
1797  kEagerCompile
1798  };
1799 
1804  kNoCacheNoReason = 0,
1818  kNoCacheBecauseDeferredProduceCodeCache
1819  };
1820 
1834  static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundScript(
1835  Isolate* isolate, Source* source,
1836  CompileOptions options = kNoCompileOptions,
1837  NoCacheReason no_cache_reason = kNoCacheNoReason);
1838 
1851  Local<Context> context, Source* source,
1852  CompileOptions options = kNoCompileOptions,
1853  NoCacheReason no_cache_reason = kNoCacheNoReason);
1854 
1866  static ScriptStreamingTask* StartStreamingScript(
1867  Isolate* isolate, StreamedSource* source,
1868  CompileOptions options = kNoCompileOptions);
1869 
1878  Local<Context> context, StreamedSource* source,
1879  Local<String> full_source_string, const ScriptOrigin& origin);
1880 
1899  static uint32_t CachedDataVersionTag();
1900 
1908  static V8_WARN_UNUSED_RESULT MaybeLocal<Module> CompileModule(
1909  Isolate* isolate, Source* source,
1910  CompileOptions options = kNoCompileOptions,
1911  NoCacheReason no_cache_reason = kNoCacheNoReason);
1912 
1923  static V8_WARN_UNUSED_RESULT MaybeLocal<Function> CompileFunctionInContext(
1924  Local<Context> context, Source* source, size_t arguments_count,
1925  Local<String> arguments[], size_t context_extension_count,
1926  Local<Object> context_extensions[],
1927  CompileOptions options = kNoCompileOptions,
1928  NoCacheReason no_cache_reason = kNoCacheNoReason,
1929  Local<ScriptOrModule>* script_or_module_out = nullptr);
1930 
1936  static CachedData* CreateCodeCache(Local<UnboundScript> unbound_script);
1937 
1943  static CachedData* CreateCodeCache(
1944  Local<UnboundModuleScript> unbound_module_script);
1945 
1952  static CachedData* CreateCodeCacheForFunction(Local<Function> function);
1953 
1954  private:
1955  static V8_WARN_UNUSED_RESULT MaybeLocal<UnboundScript> CompileUnboundInternal(
1956  Isolate* isolate, Source* source, CompileOptions options,
1957  NoCacheReason no_cache_reason);
1958 };
1959 
1960 
1965  public:
1966  Local<String> Get() const;
1967 
1971  Isolate* GetIsolate() const;
1972 
1974  Local<Context> context) const;
1975 
1980  ScriptOrigin GetScriptOrigin() const;
1981 
1986  Local<Value> GetScriptResourceName() const;
1987 
1993  Local<StackTrace> GetStackTrace() const;
1994 
1998  V8_WARN_UNUSED_RESULT Maybe<int> GetLineNumber(Local<Context> context) const;
1999 
2004  int GetStartPosition() const;
2005 
2010  int GetEndPosition() const;
2011 
2016  int GetWasmFunctionIndex() const;
2017 
2021  int ErrorLevel() const;
2022 
2027  int GetStartColumn() const;
2028  V8_WARN_UNUSED_RESULT Maybe<int> GetStartColumn(Local<Context> context) const;
2029 
2034  int GetEndColumn() const;
2035  V8_WARN_UNUSED_RESULT Maybe<int> GetEndColumn(Local<Context> context) const;
2036 
2041  bool IsSharedCrossOrigin() const;
2042  bool IsOpaque() const;
2043 
2044  // TODO(1245381): Print to a string instead of on a FILE.
2045  static void PrintCurrentStackTrace(Isolate* isolate, FILE* out);
2046 
2047  static const int kNoLineNumberInfo = 0;
2048  static const int kNoColumnInfo = 0;
2049  static const int kNoScriptIdInfo = 0;
2050  static const int kNoWasmFunctionIndexInfo = -1;
2051 };
2052 
2053 
2060  public:
2068  kLineNumber = 1,
2069  kColumnOffset = 1 << 1 | kLineNumber,
2070  kScriptName = 1 << 2,
2071  kFunctionName = 1 << 3,
2072  kIsEval = 1 << 4,
2073  kIsConstructor = 1 << 5,
2074  kScriptNameOrSourceURL = 1 << 6,
2075  kScriptId = 1 << 7,
2076  kExposeFramesAcrossSecurityOrigins = 1 << 8,
2077  kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName,
2078  kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
2079  };
2080 
2084  Local<StackFrame> GetFrame(Isolate* isolate, uint32_t index) const;
2085 
2089  int GetFrameCount() const;
2090 
2098  static Local<StackTrace> CurrentStackTrace(
2099  Isolate* isolate, int frame_limit, StackTraceOptions options = kDetailed);
2100 };
2101 
2102 
2107  public:
2114  int GetLineNumber() const;
2115 
2123  int GetColumn() const;
2124 
2131  int GetScriptId() const;
2132 
2137  Local<String> GetScriptName() const;
2138 
2145  Local<String> GetScriptNameOrSourceURL() const;
2146 
2150  Local<String> GetFunctionName() const;
2151 
2156  bool IsEval() const;
2157 
2162  bool IsConstructor() const;
2163 
2167  bool IsWasm() const;
2168 
2172  bool IsUserJavaScript() const;
2173 };
2174 
2175 
2176 // A StateTag represents a possible state of the VM.
2177 enum StateTag {
2187 };
2188 
2189 // A RegisterState represents the current state of registers used
2190 // by the sampling profiler API.
2192  RegisterState() : pc(nullptr), sp(nullptr), fp(nullptr), lr(nullptr) {}
2193  void* pc; // Instruction pointer.
2194  void* sp; // Stack pointer.
2195  void* fp; // Frame pointer.
2196  void* lr; // Link register (or nullptr on platforms without a link register).
2197 };
2198 
2199 // The output structure filled up by GetStackSample API function.
2200 struct SampleInfo {
2201  size_t frames_count; // Number of frames collected.
2202  StateTag vm_state; // Current VM state.
2203  void* external_callback_entry; // External callback address if VM is
2204  // executing an external callback.
2205  void* top_context; // Incumbent native context address.
2206 };
2207 
2208 struct MemoryRange {
2209  const void* start = nullptr;
2210  size_t length_in_bytes = 0;
2211 };
2212 
2213 struct JSEntryStub {
2215 };
2216 
2217 struct UnwindState {
2223 };
2224 
2229 };
2230 
2235  public:
2245  Local<Context> context, Local<String> json_string);
2246 
2254  static V8_WARN_UNUSED_RESULT MaybeLocal<String> Stringify(
2255  Local<Context> context, Local<Value> json_object,
2256  Local<String> gap = Local<String>());
2257 };
2258 
2264  public:
2266  public:
2267  virtual ~Delegate() = default;
2268 
2274  virtual void ThrowDataCloneError(Local<String> message) = 0;
2275 
2281  virtual Maybe<bool> WriteHostObject(Isolate* isolate, Local<Object> object);
2282 
2293  virtual Maybe<uint32_t> GetSharedArrayBufferId(
2294  Isolate* isolate, Local<SharedArrayBuffer> shared_array_buffer);
2295 
2296  virtual Maybe<uint32_t> GetWasmModuleTransferId(
2297  Isolate* isolate, Local<WasmModuleObject> module);
2309  virtual void* ReallocateBufferMemory(void* old_buffer, size_t size,
2310  size_t* actual_size);
2311 
2317  virtual void FreeBufferMemory(void* buffer);
2318  };
2319 
2320  explicit ValueSerializer(Isolate* isolate);
2321  ValueSerializer(Isolate* isolate, Delegate* delegate);
2322  ~ValueSerializer();
2323 
2327  void WriteHeader();
2328 
2333  Local<Value> value);
2334 
2341  V8_WARN_UNUSED_RESULT std::pair<uint8_t*, size_t> Release();
2342 
2348  void TransferArrayBuffer(uint32_t transfer_id,
2349  Local<ArrayBuffer> array_buffer);
2350 
2351 
2359  void SetTreatArrayBufferViewsAsHostObjects(bool mode);
2360 
2366  void WriteUint32(uint32_t value);
2367  void WriteUint64(uint64_t value);
2368  void WriteDouble(double value);
2369  void WriteRawBytes(const void* source, size_t length);
2370 
2371  ValueSerializer(const ValueSerializer&) = delete;
2372  void operator=(const ValueSerializer&) = delete;
2373 
2374  private:
2375  struct PrivateData;
2376  PrivateData* private_;
2377 };
2378 
2384  public:
2386  public:
2387  virtual ~Delegate() = default;
2388 
2394  virtual MaybeLocal<Object> ReadHostObject(Isolate* isolate);
2395 
2400  virtual MaybeLocal<WasmModuleObject> GetWasmModuleFromId(
2401  Isolate* isolate, uint32_t transfer_id);
2402 
2407  virtual MaybeLocal<SharedArrayBuffer> GetSharedArrayBufferFromId(
2408  Isolate* isolate, uint32_t clone_id);
2409  };
2410 
2411  ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size);
2412  ValueDeserializer(Isolate* isolate, const uint8_t* data, size_t size,
2413  Delegate* delegate);
2414  ~ValueDeserializer();
2415 
2420  V8_WARN_UNUSED_RESULT Maybe<bool> ReadHeader(Local<Context> context);
2421 
2426 
2431  void TransferArrayBuffer(uint32_t transfer_id,
2432  Local<ArrayBuffer> array_buffer);
2433 
2439  void TransferSharedArrayBuffer(uint32_t id,
2440  Local<SharedArrayBuffer> shared_array_buffer);
2441 
2449  void SetSupportsLegacyWireFormat(bool supports_legacy_wire_format);
2450 
2456  uint32_t GetWireFormatVersion() const;
2457 
2463  V8_WARN_UNUSED_RESULT bool ReadUint32(uint32_t* value);
2464  V8_WARN_UNUSED_RESULT bool ReadUint64(uint64_t* value);
2465  V8_WARN_UNUSED_RESULT bool ReadDouble(double* value);
2466  V8_WARN_UNUSED_RESULT bool ReadRawBytes(size_t length, const void** data);
2467 
2468  ValueDeserializer(const ValueDeserializer&) = delete;
2469  void operator=(const ValueDeserializer&) = delete;
2470 
2471  private:
2472  struct PrivateData;
2473  PrivateData* private_;
2474 };
2475 
2476 
2477 // --- Value ---
2478 
2479 
2483 class V8_EXPORT Value : public Data {
2484  public:
2491  V8_INLINE bool IsUndefined() const;
2492 
2499  V8_INLINE bool IsNull() const;
2500 
2508  V8_INLINE bool IsNullOrUndefined() const;
2509 
2517  bool IsTrue() const;
2518 
2526  bool IsFalse() const;
2527 
2534  bool IsName() const;
2535 
2542  V8_INLINE bool IsString() const;
2543 
2549  bool IsSymbol() const;
2550 
2556  bool IsFunction() const;
2557 
2562  bool IsArray() const;
2563 
2567  bool IsObject() const;
2568 
2574  bool IsBigInt() const;
2575 
2581  bool IsBoolean() const;
2582 
2588  bool IsNumber() const;
2589 
2593  bool IsExternal() const;
2594 
2598  bool IsInt32() const;
2599 
2603  bool IsUint32() const;
2604 
2608  bool IsDate() const;
2609 
2613  bool IsArgumentsObject() const;
2614 
2618  bool IsBigIntObject() const;
2619 
2623  bool IsBooleanObject() const;
2624 
2628  bool IsNumberObject() const;
2629 
2633  bool IsStringObject() const;
2634 
2638  bool IsSymbolObject() const;
2639 
2643  bool IsNativeError() const;
2644 
2648  bool IsRegExp() const;
2649 
2653  bool IsAsyncFunction() const;
2654 
2658  bool IsGeneratorFunction() const;
2659 
2663  bool IsGeneratorObject() const;
2664 
2668  bool IsPromise() const;
2669 
2673  bool IsMap() const;
2674 
2678  bool IsSet() const;
2679 
2683  bool IsMapIterator() const;
2684 
2688  bool IsSetIterator() const;
2689 
2693  bool IsWeakMap() const;
2694 
2698  bool IsWeakSet() const;
2699 
2703  bool IsArrayBuffer() const;
2704 
2708  bool IsArrayBufferView() const;
2709 
2713  bool IsTypedArray() const;
2714 
2718  bool IsUint8Array() const;
2719 
2723  bool IsUint8ClampedArray() const;
2724 
2728  bool IsInt8Array() const;
2729 
2733  bool IsUint16Array() const;
2734 
2738  bool IsInt16Array() const;
2739 
2743  bool IsUint32Array() const;
2744 
2748  bool IsInt32Array() const;
2749 
2753  bool IsFloat32Array() const;
2754 
2758  bool IsFloat64Array() const;
2759 
2763  bool IsBigInt64Array() const;
2764 
2768  bool IsBigUint64Array() const;
2769 
2773  bool IsDataView() const;
2774 
2778  bool IsSharedArrayBuffer() const;
2779 
2783  bool IsProxy() const;
2784 
2788  bool IsWasmModuleObject() const;
2789 
2793  bool IsModuleNamespaceObject() const;
2794 
2799  Local<Context> context) const;
2804  Local<Context> context) const;
2809  Local<Context> context) const;
2816  Local<Context> context) const;
2821  Local<Context> context) const;
2828  Local<Context> context) const;
2835  Local<Context> context) const;
2842 
2846  Local<Boolean> ToBoolean(Isolate* isolate) const;
2847 
2853  Local<Context> context) const;
2854 
2856  bool BooleanValue(Isolate* isolate) const;
2857 
2859  V8_WARN_UNUSED_RESULT Maybe<double> NumberValue(Local<Context> context) const;
2862  Local<Context> context) const;
2865  Local<Context> context) const;
2867  V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;
2868 
2871  Local<Value> that) const;
2872  bool StrictEquals(Local<Value> that) const;
2873  bool SameValue(Local<Value> that) const;
2874 
2875  template <class T> V8_INLINE static Value* Cast(T* value);
2876 
2877  Local<String> TypeOf(Isolate*);
2878 
2879  Maybe<bool> InstanceOf(Local<Context> context, Local<Object> object);
2880 
2881  private:
2882  V8_INLINE bool QuickIsUndefined() const;
2883  V8_INLINE bool QuickIsNull() const;
2884  V8_INLINE bool QuickIsNullOrUndefined() const;
2885  V8_INLINE bool QuickIsString() const;
2886  bool FullIsUndefined() const;
2887  bool FullIsNull() const;
2888  bool FullIsString() const;
2889 };
2890 
2891 
2895 class V8_EXPORT Primitive : public Value { };
2896 
2897 
2902 class V8_EXPORT Boolean : public Primitive {
2903  public:
2904  bool Value() const;
2905  V8_INLINE static Boolean* Cast(v8::Value* obj);
2906  V8_INLINE static Local<Boolean> New(Isolate* isolate, bool value);
2907 
2908  private:
2909  static void CheckCast(v8::Value* obj);
2910 };
2911 
2912 
2916 class V8_EXPORT Name : public Primitive {
2917  public:
2925  int GetIdentityHash();
2926 
2927  V8_INLINE static Name* Cast(Value* obj);
2928 
2929  private:
2930  static void CheckCast(Value* obj);
2931 };
2932 
2939 enum class NewStringType {
2943  kNormal,
2944 
2951 };
2952 
2956 class V8_EXPORT String : public Name {
2957  public:
2958  static constexpr int kMaxLength =
2959  internal::kApiSystemPointerSize == 4 ? (1 << 28) - 16 : (1 << 29) - 24;
2960 
2961  enum Encoding {
2962  UNKNOWN_ENCODING = 0x1,
2963  TWO_BYTE_ENCODING = 0x0,
2964  ONE_BYTE_ENCODING = 0x8
2965  };
2969  int Length() const;
2970 
2975  int Utf8Length(Isolate* isolate) const;
2976 
2983  bool IsOneByte() const;
2984 
2990  bool ContainsOnlyOneByte() const;
2991 
3018  NO_OPTIONS = 0,
3019  HINT_MANY_WRITES_EXPECTED = 1,
3020  NO_NULL_TERMINATION = 2,
3021  PRESERVE_ONE_BYTE_NULL = 4,
3022  // Used by WriteUtf8 to replace orphan surrogate code units with the
3023  // unicode replacement character. Needs to be set to guarantee valid UTF-8
3024  // output.
3025  REPLACE_INVALID_UTF8 = 8
3026  };
3027 
3028  // 16-bit character codes.
3029  int Write(Isolate* isolate, uint16_t* buffer, int start = 0, int length = -1,
3030  int options = NO_OPTIONS) const;
3031  // One byte characters.
3032  int WriteOneByte(Isolate* isolate, uint8_t* buffer, int start = 0,
3033  int length = -1, int options = NO_OPTIONS) const;
3034  // UTF-8 encoded characters.
3035  int WriteUtf8(Isolate* isolate, char* buffer, int length = -1,
3036  int* nchars_ref = nullptr, int options = NO_OPTIONS) const;
3037 
3041  V8_INLINE static Local<String> Empty(Isolate* isolate);
3042 
3046  bool IsExternal() const;
3047 
3051  bool IsExternalOneByte() const;
3052 
3054  public:
3055  virtual ~ExternalStringResourceBase() = default;
3056 
3062  virtual bool IsCacheable() const { return true; }
3063 
3064  // Disallow copying and assigning.
3066  void operator=(const ExternalStringResourceBase&) = delete;
3067 
3068  protected:
3069  ExternalStringResourceBase() = default;
3070 
3077  virtual void Dispose() { delete this; }
3078 
3090  virtual void Lock() const {}
3091 
3095  virtual void Unlock() const {}
3096 
3097  private:
3098  friend class internal::ExternalString;
3099  friend class v8::String;
3100  friend class internal::ScopedExternalStringLock;
3101  };
3102 
3110  : public ExternalStringResourceBase {
3111  public:
3116  ~ExternalStringResource() override = default;
3117 
3121  virtual const uint16_t* data() const = 0;
3122 
3126  virtual size_t length() const = 0;
3127 
3128  protected:
3129  ExternalStringResource() = default;
3130  };
3131 
3143  : public ExternalStringResourceBase {
3144  public:
3149  ~ExternalOneByteStringResource() override = default;
3151  virtual const char* data() const = 0;
3153  virtual size_t length() const = 0;
3154  protected:
3155  ExternalOneByteStringResource() = default;
3156  };
3157 
3163  V8_INLINE ExternalStringResourceBase* GetExternalStringResourceBase(
3164  Encoding* encoding_out) const;
3165 
3170  V8_INLINE ExternalStringResource* GetExternalStringResource() const;
3171 
3176  const ExternalOneByteStringResource* GetExternalOneByteStringResource() const;
3177 
3178  V8_INLINE static String* Cast(v8::Value* obj);
3179 
3189  template <int N>
3191  Isolate* isolate, const char (&literal)[N],
3193  static_assert(N <= kMaxLength, "String is too long");
3194  return NewFromUtf8Literal(isolate, literal, type, N - 1);
3195  }
3196 
3199  static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromUtf8(
3200  Isolate* isolate, const char* data,
3201  NewStringType type = NewStringType::kNormal, int length = -1);
3202 
3205  static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte(
3206  Isolate* isolate, const uint8_t* data,
3207  NewStringType type = NewStringType::kNormal, int length = -1);
3208 
3211  static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte(
3212  Isolate* isolate, const uint16_t* data,
3213  NewStringType type = NewStringType::kNormal, int length = -1);
3214 
3219  static Local<String> Concat(Isolate* isolate, Local<String> left,
3220  Local<String> right);
3221 
3230  static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalTwoByte(
3231  Isolate* isolate, ExternalStringResource* resource);
3232 
3242  bool MakeExternal(ExternalStringResource* resource);
3243 
3252  static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte(
3253  Isolate* isolate, ExternalOneByteStringResource* resource);
3254 
3264  bool MakeExternal(ExternalOneByteStringResource* resource);
3265 
3269  bool CanMakeExternal();
3270 
3274  bool StringEquals(Local<String> str);
3275 
3284  public:
3285  Utf8Value(Isolate* isolate, Local<v8::Value> obj);
3286  ~Utf8Value();
3287  char* operator*() { return str_; }
3288  const char* operator*() const { return str_; }
3289  int length() const { return length_; }
3290 
3291  // Disallow copying and assigning.
3292  Utf8Value(const Utf8Value&) = delete;
3293  void operator=(const Utf8Value&) = delete;
3294 
3295  private:
3296  char* str_;
3297  int length_;
3298  };
3299 
3307  public:
3308  Value(Isolate* isolate, Local<v8::Value> obj);
3309  ~Value();
3310  uint16_t* operator*() { return str_; }
3311  const uint16_t* operator*() const { return str_; }
3312  int length() const { return length_; }
3313 
3314  // Disallow copying and assigning.
3315  Value(const Value&) = delete;
3316  void operator=(const Value&) = delete;
3317 
3318  private:
3319  uint16_t* str_;
3320  int length_;
3321  };
3322 
3323  private:
3324  void VerifyExternalStringResourceBase(ExternalStringResourceBase* v,
3325  Encoding encoding) const;
3326  void VerifyExternalStringResource(ExternalStringResource* val) const;
3327  ExternalStringResource* GetExternalStringResourceSlow() const;
3328  ExternalStringResourceBase* GetExternalStringResourceBaseSlow(
3329  String::Encoding* encoding_out) const;
3330 
3331  static Local<v8::String> NewFromUtf8Literal(Isolate* isolate,
3332  const char* literal,
3333  NewStringType type, int length);
3334 
3335  static void CheckCast(v8::Value* obj);
3336 };
3337 
3338 // Zero-length string specialization (templated string size includes
3339 // terminator).
3340 template <>
3342  Isolate* isolate, const char (&literal)[1], NewStringType type) {
3343  return String::Empty(isolate);
3344 }
3345 
3349 class V8_EXPORT Symbol : public Name {
3350  public:
3354  Local<Value> Description() const;
3355 
3356  V8_DEPRECATE_SOON("Use Symbol::Description()")
3357  Local<Value> Name() const { return Description(); }
3358 
3363  static Local<Symbol> New(Isolate* isolate,
3364  Local<String> description = Local<String>());
3365 
3374  static Local<Symbol> For(Isolate* isolate, Local<String> description);
3375 
3380  static Local<Symbol> ForApi(Isolate* isolate, Local<String> description);
3381 
3382  // Well-known symbols
3383  static Local<Symbol> GetAsyncIterator(Isolate* isolate);
3384  static Local<Symbol> GetHasInstance(Isolate* isolate);
3385  static Local<Symbol> GetIsConcatSpreadable(Isolate* isolate);
3386  static Local<Symbol> GetIterator(Isolate* isolate);
3387  static Local<Symbol> GetMatch(Isolate* isolate);
3388  static Local<Symbol> GetReplace(Isolate* isolate);
3389  static Local<Symbol> GetSearch(Isolate* isolate);
3390  static Local<Symbol> GetSplit(Isolate* isolate);
3391  static Local<Symbol> GetToPrimitive(Isolate* isolate);
3392  static Local<Symbol> GetToStringTag(Isolate* isolate);
3393  static Local<Symbol> GetUnscopables(Isolate* isolate);
3394 
3395  V8_INLINE static Symbol* Cast(Value* obj);
3396 
3397  private:
3398  Symbol();
3399  static void CheckCast(Value* obj);
3400 };
3401 
3402 
3408 class V8_EXPORT Private : public Data {
3409  public:
3413  Local<Value> Name() const;
3414 
3418  static Local<Private> New(Isolate* isolate,
3419  Local<String> name = Local<String>());
3420 
3430  static Local<Private> ForApi(Isolate* isolate, Local<String> name);
3431 
3432  V8_INLINE static Private* Cast(Data* data);
3433 
3434  private:
3435  Private();
3436 
3437  static void CheckCast(Data* that);
3438 };
3439 
3440 
3444 class V8_EXPORT Number : public Primitive {
3445  public:
3446  double Value() const;
3447  static Local<Number> New(Isolate* isolate, double value);
3448  V8_INLINE static Number* Cast(v8::Value* obj);
3449  private:
3450  Number();
3451  static void CheckCast(v8::Value* obj);
3452 };
3453 
3454 
3458 class V8_EXPORT Integer : public Number {
3459  public:
3460  static Local<Integer> New(Isolate* isolate, int32_t value);
3461  static Local<Integer> NewFromUnsigned(Isolate* isolate, uint32_t value);
3462  int64_t Value() const;
3463  V8_INLINE static Integer* Cast(v8::Value* obj);
3464  private:
3465  Integer();
3466  static void CheckCast(v8::Value* obj);
3467 };
3468 
3469 
3473 class V8_EXPORT Int32 : public Integer {
3474  public:
3475  int32_t Value() const;
3476  V8_INLINE static Int32* Cast(v8::Value* obj);
3477 
3478  private:
3479  Int32();
3480  static void CheckCast(v8::Value* obj);
3481 };
3482 
3483 
3487 class V8_EXPORT Uint32 : public Integer {
3488  public:
3489  uint32_t Value() const;
3490  V8_INLINE static Uint32* Cast(v8::Value* obj);
3491 
3492  private:
3493  Uint32();
3494  static void CheckCast(v8::Value* obj);
3495 };
3496 
3500 class V8_EXPORT BigInt : public Primitive {
3501  public:
3502  static Local<BigInt> New(Isolate* isolate, int64_t value);
3503  static Local<BigInt> NewFromUnsigned(Isolate* isolate, uint64_t value);
3511  static MaybeLocal<BigInt> NewFromWords(Local<Context> context, int sign_bit,
3512  int word_count, const uint64_t* words);
3513 
3520  uint64_t Uint64Value(bool* lossless = nullptr) const;
3521 
3527  int64_t Int64Value(bool* lossless = nullptr) const;
3528 
3533  int WordCount() const;
3534 
3543  void ToWordsArray(int* sign_bit, int* word_count, uint64_t* words) const;
3544 
3545  V8_INLINE static BigInt* Cast(v8::Value* obj);
3546 
3547  private:
3548  BigInt();
3549  static void CheckCast(v8::Value* obj);
3550 };
3551 
3557  None = 0,
3559  ReadOnly = 1 << 0,
3561  DontEnum = 1 << 1,
3563  DontDelete = 1 << 2
3564 };
3565 
3571 typedef void (*AccessorGetterCallback)(
3572  Local<String> property,
3573  const PropertyCallbackInfo<Value>& info);
3575  Local<Name> property,
3576  const PropertyCallbackInfo<Value>& info);
3577 
3578 
3579 typedef void (*AccessorSetterCallback)(
3580  Local<String> property,
3581  Local<Value> value,
3582  const PropertyCallbackInfo<void>& info);
3584  Local<Name> property,
3585  Local<Value> value,
3586  const PropertyCallbackInfo<void>& info);
3587 
3588 
3599  DEFAULT = 0,
3601  ALL_CAN_WRITE = 1 << 1,
3603 };
3604 
3615 };
3616 
3627 enum class SideEffectType {
3631 };
3632 
3641 
3647 
3653 
3658 
3662 class V8_EXPORT Object : public Value {
3663  public:
3669  Local<Value> key, Local<Value> value);
3670 
3671  V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,
3672  Local<Value> value);
3673 
3674  // Implements CreateDataProperty (ECMA-262, 7.3.4).
3675  //
3676  // Defines a configurable, writable, enumerable property with the given value
3677  // on the object unless the property already exists and is not configurable
3678  // or the object is not extensible.
3679  //
3680  // Returns true on success.
3681  V8_WARN_UNUSED_RESULT Maybe<bool> CreateDataProperty(Local<Context> context,
3682  Local<Name> key,
3683  Local<Value> value);
3684  V8_WARN_UNUSED_RESULT Maybe<bool> CreateDataProperty(Local<Context> context,
3685  uint32_t index,
3686  Local<Value> value);
3687 
3688  // Implements DefineOwnProperty.
3689  //
3690  // In general, CreateDataProperty will be faster, however, does not allow
3691  // for specifying attributes.
3692  //
3693  // Returns true on success.
3694  V8_WARN_UNUSED_RESULT Maybe<bool> DefineOwnProperty(
3695  Local<Context> context, Local<Name> key, Local<Value> value,
3696  PropertyAttribute attributes = None);
3697 
3698  // Implements Object.DefineProperty(O, P, Attributes), see Ecma-262 19.1.2.4.
3699  //
3700  // The defineProperty function is used to add an own property or
3701  // update the attributes of an existing own property of an object.
3702  //
3703  // Both data and accessor descriptors can be used.
3704  //
3705  // In general, CreateDataProperty is faster, however, does not allow
3706  // for specifying attributes or an accessor descriptor.
3707  //
3708  // The PropertyDescriptor can change when redefining a property.
3709  //
3710  // Returns true on success.
3711  V8_WARN_UNUSED_RESULT Maybe<bool> DefineProperty(
3712  Local<Context> context, Local<Name> key,
3713  PropertyDescriptor& descriptor); // NOLINT(runtime/references)
3714 
3716  Local<Value> key);
3717 
3719  uint32_t index);
3720 
3726  V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> GetPropertyAttributes(
3727  Local<Context> context, Local<Value> key);
3728 
3732  V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetOwnPropertyDescriptor(
3733  Local<Context> context, Local<Name> key);
3734 
3751  Local<Value> key);
3752 
3754  Local<Value> key);
3755 
3756  V8_WARN_UNUSED_RESULT Maybe<bool> Has(Local<Context> context, uint32_t index);
3757 
3759  uint32_t index);
3760 
3764  V8_WARN_UNUSED_RESULT Maybe<bool> SetAccessor(
3765  Local<Context> context, Local<Name> name,
3767  AccessorNameSetterCallback setter = nullptr,
3769  AccessControl settings = DEFAULT, PropertyAttribute attribute = None,
3770  SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
3771  SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
3772 
3773  void SetAccessorProperty(Local<Name> name, Local<Function> getter,
3774  Local<Function> setter = Local<Function>(),
3775  PropertyAttribute attribute = None,
3776  AccessControl settings = DEFAULT);
3777 
3782  V8_WARN_UNUSED_RESULT Maybe<bool> SetNativeDataProperty(
3783  Local<Context> context, Local<Name> name,
3785  AccessorNameSetterCallback setter = nullptr,
3786  Local<Value> data = Local<Value>(), PropertyAttribute attributes = None,
3787  SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
3788  SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
3789 
3798  V8_WARN_UNUSED_RESULT Maybe<bool> SetLazyDataProperty(
3799  Local<Context> context, Local<Name> name,
3801  PropertyAttribute attributes = None,
3802  SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
3803  SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
3804 
3811  Maybe<bool> HasPrivate(Local<Context> context, Local<Private> key);
3812  Maybe<bool> SetPrivate(Local<Context> context, Local<Private> key,
3813  Local<Value> value);
3814  Maybe<bool> DeletePrivate(Local<Context> context, Local<Private> key);
3815  MaybeLocal<Value> GetPrivate(Local<Context> context, Local<Private> key);
3816 
3823  V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetPropertyNames(
3824  Local<Context> context);
3825  V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetPropertyNames(
3826  Local<Context> context, KeyCollectionMode mode,
3827  PropertyFilter property_filter, IndexFilter index_filter,
3829 
3835  V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetOwnPropertyNames(
3836  Local<Context> context);
3837 
3844  V8_WARN_UNUSED_RESULT MaybeLocal<Array> GetOwnPropertyNames(
3845  Local<Context> context, PropertyFilter filter,
3847 
3853  Local<Value> GetPrototype();
3854 
3860  V8_WARN_UNUSED_RESULT Maybe<bool> SetPrototype(Local<Context> context,
3861  Local<Value> prototype);
3862 
3867  Local<Object> FindInstanceInPrototypeChain(Local<FunctionTemplate> tmpl);
3868 
3874  V8_WARN_UNUSED_RESULT MaybeLocal<String> ObjectProtoToString(
3875  Local<Context> context);
3876 
3880  Local<String> GetConstructorName();
3881 
3885  Maybe<bool> SetIntegrityLevel(Local<Context> context, IntegrityLevel level);
3886 
3888  int InternalFieldCount();
3889 
3892  const PersistentBase<Object>& object) {
3893  return object.val_->InternalFieldCount();
3894  }
3895 
3898  const TracedReferenceBase<Object>& object) {
3899  return object.val_->InternalFieldCount();
3900  }
3901 
3903  V8_INLINE Local<Value> GetInternalField(int index);
3904 
3906  void SetInternalField(int index, Local<Value> value);
3907 
3913  V8_INLINE void* GetAlignedPointerFromInternalField(int index);
3914 
3917  const PersistentBase<Object>& object, int index) {
3918  return object.val_->GetAlignedPointerFromInternalField(index);
3919  }
3920 
3923  const TracedReferenceBase<Object>& object, int index) {
3924  return object.val_->GetAlignedPointerFromInternalField(index);
3925  }
3926 
3932  void SetAlignedPointerInInternalField(int index, void* value);
3933  void SetAlignedPointerInInternalFields(int argc, int indices[],
3934  void* values[]);
3935 
3941  V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context,
3942  Local<Name> key);
3943  V8_WARN_UNUSED_RESULT Maybe<bool> HasOwnProperty(Local<Context> context,
3944  uint32_t index);
3958  V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedProperty(Local<Context> context,
3959  Local<Name> key);
3960  V8_WARN_UNUSED_RESULT Maybe<bool> HasRealIndexedProperty(
3961  Local<Context> context, uint32_t index);
3962  V8_WARN_UNUSED_RESULT Maybe<bool> HasRealNamedCallbackProperty(
3963  Local<Context> context, Local<Name> key);
3964 
3969  V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetRealNamedPropertyInPrototypeChain(
3970  Local<Context> context, Local<Name> key);
3971 
3978  GetRealNamedPropertyAttributesInPrototypeChain(Local<Context> context,
3979  Local<Name> key);
3980 
3986  V8_WARN_UNUSED_RESULT MaybeLocal<Value> GetRealNamedProperty(
3987  Local<Context> context, Local<Name> key);
3988 
3994  V8_WARN_UNUSED_RESULT Maybe<PropertyAttribute> GetRealNamedPropertyAttributes(
3995  Local<Context> context, Local<Name> key);
3996 
3998  bool HasNamedLookupInterceptor();
3999 
4001  bool HasIndexedLookupInterceptor();
4002 
4010  int GetIdentityHash();
4011 
4016  // TODO(dcarney): take an isolate and optionally bail out?
4017  Local<Object> Clone();
4018 
4022  Local<Context> CreationContext();
4023 
4026  const PersistentBase<Object>& object) {
4027  return object.val_->CreationContext();
4028  }
4029 
4035  bool IsCallable();
4036 
4040  bool IsConstructor();
4041 
4049  bool IsApiWrapper();
4050 
4056  bool IsUndetectable();
4057 
4063  Local<Value> recv,
4064  int argc,
4065  Local<Value> argv[]);
4066 
4072  V8_WARN_UNUSED_RESULT MaybeLocal<Value> CallAsConstructor(
4073  Local<Context> context, int argc, Local<Value> argv[]);
4074 
4078  Isolate* GetIsolate();
4079 
4089  MaybeLocal<Array> PreviewEntries(bool* is_key_value);
4090 
4091  static Local<Object> New(Isolate* isolate);
4092 
4101  static Local<Object> New(Isolate* isolate, Local<Value> prototype_or_null,
4102  Local<Name>* names, Local<Value>* values,
4103  size_t length);
4104 
4105  V8_INLINE static Object* Cast(Value* obj);
4106 
4107  private:
4108  Object();
4109  static void CheckCast(Value* obj);
4110  Local<Value> SlowGetInternalField(int index);
4111  void* SlowGetAlignedPointerFromInternalField(int index);
4112 };
4113 
4114 
4118 class V8_EXPORT Array : public Object {
4119  public:
4120  uint32_t Length() const;
4121 
4126  static Local<Array> New(Isolate* isolate, int length = 0);
4127 
4132  static Local<Array> New(Isolate* isolate, Local<Value>* elements,
4133  size_t length);
4134  V8_INLINE static Array* Cast(Value* obj);
4135  private:
4136  Array();
4137  static void CheckCast(Value* obj);
4138 };
4139 
4140 
4144 class V8_EXPORT Map : public Object {
4145  public:
4146  size_t Size() const;
4147  void Clear();
4149  Local<Value> key);
4151  Local<Value> key,
4152  Local<Value> value);
4154  Local<Value> key);
4156  Local<Value> key);
4157 
4162  Local<Array> AsArray() const;
4163 
4167  static Local<Map> New(Isolate* isolate);
4168 
4169  V8_INLINE static Map* Cast(Value* obj);
4170 
4171  private:
4172  Map();
4173  static void CheckCast(Value* obj);
4174 };
4175 
4176 
4180 class V8_EXPORT Set : public Object {
4181  public:
4182  size_t Size() const;
4183  void Clear();
4185  Local<Value> key);
4187  Local<Value> key);
4189  Local<Value> key);
4190 
4194  Local<Array> AsArray() const;
4195 
4199  static Local<Set> New(Isolate* isolate);
4200 
4201  V8_INLINE static Set* Cast(Value* obj);
4202 
4203  private:
4204  Set();
4205  static void CheckCast(Value* obj);
4206 };
4207 
4208 
4209 template<typename T>
4210 class ReturnValue {
4211  public:
4212  template <class S> V8_INLINE ReturnValue(const ReturnValue<S>& that)
4213  : value_(that.value_) {
4214  static_assert(std::is_base_of<T, S>::value, "type check");
4215  }
4216  // Local setters
4217  template <typename S>
4218  V8_INLINE void Set(const Global<S>& handle);
4219  template <typename S>
4220  V8_INLINE void Set(const TracedReferenceBase<S>& handle);
4221  template <typename S>
4222  V8_INLINE void Set(const Local<S> handle);
4223  // Fast primitive setters
4224  V8_INLINE void Set(bool value);
4225  V8_INLINE void Set(double i);
4226  V8_INLINE void Set(int32_t i);
4227  V8_INLINE void Set(uint32_t i);
4228  // Fast JS primitive setters
4229  V8_INLINE void SetNull();
4230  V8_INLINE void SetUndefined();
4231  V8_INLINE void SetEmptyString();
4232  // Convenience getter for Isolate
4233  V8_INLINE Isolate* GetIsolate() const;
4234 
4235  // Pointer setter: Uncompilable to prevent inadvertent misuse.
4236  template <typename S>
4237  V8_INLINE void Set(S* whatever);
4238 
4239  // Getter. Creates a new Local<> so it comes with a certain performance
4240  // hit. If the ReturnValue was not yet set, this will return the undefined
4241  // value.
4242  V8_INLINE Local<Value> Get() const;
4243 
4244  private:
4245  template<class F> friend class ReturnValue;
4246  template<class F> friend class FunctionCallbackInfo;
4247  template<class F> friend class PropertyCallbackInfo;
4248  template <class F, class G, class H>
4250  V8_INLINE void SetInternal(internal::Address value) { *value_ = value; }
4251  V8_INLINE internal::Address GetDefaultValue();
4252  V8_INLINE explicit ReturnValue(internal::Address* slot);
4253  internal::Address* value_;
4254 };
4255 
4256 
4263 template<typename T>
4264 class FunctionCallbackInfo {
4265  public:
4267  V8_INLINE int Length() const;
4272  V8_INLINE Local<Value> operator[](int i) const;
4274  V8_INLINE Local<Object> This() const;
4285  V8_INLINE Local<Object> Holder() const;
4287  V8_INLINE Local<Value> NewTarget() const;
4289  V8_INLINE bool IsConstructCall() const;
4291  V8_INLINE Local<Value> Data() const;
4293  V8_INLINE Isolate* GetIsolate() const;
4295  V8_INLINE ReturnValue<T> GetReturnValue() const;
4296  // This shouldn't be public, but the arm compiler needs it.
4297  static const int kArgsLength = 6;
4298 
4299  protected:
4300  friend class internal::FunctionCallbackArguments;
4302  friend class debug::ConsoleCallArguments;
4303  static const int kHolderIndex = 0;
4304  static const int kIsolateIndex = 1;
4305  static const int kReturnValueDefaultValueIndex = 2;
4306  static const int kReturnValueIndex = 3;
4307  static const int kDataIndex = 4;
4308  static const int kNewTargetIndex = 5;
4309 
4311  internal::Address* values, int length);
4314  int length_;
4315 };
4316 
4317 
4322 template<typename T>
4323 class PropertyCallbackInfo {
4324  public:
4328  V8_INLINE Isolate* GetIsolate() const;
4329 
4335  V8_INLINE Local<Value> Data() const;
4336 
4378  V8_INLINE Local<Object> This() const;
4379 
4389  V8_INLINE Local<Object> Holder() const;
4390 
4399  V8_INLINE ReturnValue<T> GetReturnValue() const;
4400 
4408  V8_INLINE bool ShouldThrowOnError() const;
4409 
4410  // This shouldn't be public, but the arm compiler needs it.
4411  static const int kArgsLength = 7;
4412 
4413  protected:
4414  friend class MacroAssembler;
4415  friend class internal::PropertyCallbackArguments;
4417  static const int kShouldThrowOnErrorIndex = 0;
4418  static const int kHolderIndex = 1;
4419  static const int kIsolateIndex = 2;
4420  static const int kReturnValueDefaultValueIndex = 3;
4421  static const int kReturnValueIndex = 4;
4422  static const int kDataIndex = 5;
4423  static const int kThisIndex = 6;
4424 
4427 };
4428 
4429 
4430 typedef void (*FunctionCallback)(const FunctionCallbackInfo<Value>& info);
4431 
4433 
4437 class V8_EXPORT Function : public Object {
4438  public:
4443  static MaybeLocal<Function> New(
4444  Local<Context> context, FunctionCallback callback,
4445  Local<Value> data = Local<Value>(), int length = 0,
4447  SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
4448 
4450  Local<Context> context, int argc, Local<Value> argv[]) const;
4451 
4453  Local<Context> context) const {
4454  return NewInstance(context, 0, nullptr);
4455  }
4456 
4462  V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewInstanceWithSideEffectType(
4463  Local<Context> context, int argc, Local<Value> argv[],
4464  SideEffectType side_effect_type = SideEffectType::kHasSideEffect) const;
4465 
4467  Local<Value> recv, int argc,
4468  Local<Value> argv[]);
4469 
4470  void SetName(Local<String> name);
4471  Local<Value> GetName() const;
4472 
4479  Local<Value> GetInferredName() const;
4480 
4485  Local<Value> GetDebugName() const;
4486 
4491  Local<Value> GetDisplayName() const;
4492 
4497  int GetScriptLineNumber() const;
4502  int GetScriptColumnNumber() const;
4503 
4507  int ScriptId() const;
4508 
4513  Local<Value> GetBoundFunction() const;
4514 
4515  ScriptOrigin GetScriptOrigin() const;
4516  V8_INLINE static Function* Cast(Value* obj);
4517  static const int kLineOffsetNotFound;
4518 
4519  private:
4520  Function();
4521  static void CheckCast(Value* obj);
4522 };
4523 
4524 #ifndef V8_PROMISE_INTERNAL_FIELD_COUNT
4525 // The number of required internal fields can be defined by embedder.
4526 #define V8_PROMISE_INTERNAL_FIELD_COUNT 0
4527 #endif
4528 
4532 class V8_EXPORT Promise : public Object {
4533  public:
4538  enum PromiseState { kPending, kFulfilled, kRejected };
4539 
4540  class V8_EXPORT Resolver : public Object {
4541  public:
4546  Local<Context> context);
4547 
4551  Local<Promise> GetPromise();
4552 
4558  Local<Value> value);
4559 
4561  Local<Value> value);
4562 
4563  V8_INLINE static Resolver* Cast(Value* obj);
4564 
4565  private:
4566  Resolver();
4567  static void CheckCast(Value* obj);
4568  };
4569 
4577  Local<Function> handler);
4578 
4580  Local<Function> handler);
4581 
4583  Local<Function> on_fulfilled,
4584  Local<Function> on_rejected);
4585 
4590  bool HasHandler();
4591 
4596  Local<Value> Result();
4597 
4601  PromiseState State();
4602 
4606  void MarkAsHandled();
4607 
4608  V8_INLINE static Promise* Cast(Value* obj);
4609 
4610  static const int kEmbedderFieldCount = V8_PROMISE_INTERNAL_FIELD_COUNT;
4611 
4612  private:
4613  Promise();
4614  static void CheckCast(Value* obj);
4615 };
4616 
4646  public:
4647  // GenericDescriptor
4649 
4650  // DataDescriptor
4651  explicit PropertyDescriptor(Local<Value> value);
4652 
4653  // DataDescriptor with writable property
4654  PropertyDescriptor(Local<Value> value, bool writable);
4655 
4656  // AccessorDescriptor
4658 
4659  ~PropertyDescriptor();
4660 
4661  Local<Value> value() const;
4662  bool has_value() const;
4663 
4664  Local<Value> get() const;
4665  bool has_get() const;
4666  Local<Value> set() const;
4667  bool has_set() const;
4668 
4669  void set_enumerable(bool enumerable);
4670  bool enumerable() const;
4671  bool has_enumerable() const;
4672 
4673  void set_configurable(bool configurable);
4674  bool configurable() const;
4675  bool has_configurable() const;
4676 
4677  bool writable() const;
4678  bool has_writable() const;
4679 
4680  struct PrivateData;
4681  PrivateData* get_private() const { return private_; }
4682 
4683  PropertyDescriptor(const PropertyDescriptor&) = delete;
4684  void operator=(const PropertyDescriptor&) = delete;
4685 
4686  private:
4687  PrivateData* private_;
4688 };
4689 
4694 class V8_EXPORT Proxy : public Object {
4695  public:
4696  Local<Value> GetTarget();
4697  Local<Value> GetHandler();
4698  bool IsRevoked();
4699  void Revoke();
4700 
4704  static MaybeLocal<Proxy> New(Local<Context> context,
4705  Local<Object> local_target,
4706  Local<Object> local_handler);
4707 
4708  V8_INLINE static Proxy* Cast(Value* obj);
4709 
4710  private:
4711  Proxy();
4712  static void CheckCast(Value* obj);
4713 };
4714 
4725 template <typename T>
4727  public:
4729  constexpr MemorySpan() = default;
4730 
4731  constexpr MemorySpan(T* data, size_t size) : data_(data), size_(size) {}
4732 
4734  constexpr T* data() const { return data_; }
4736  constexpr size_t size() const { return size_; }
4737 
4738  private:
4739  T* data_ = nullptr;
4740  size_t size_ = 0;
4741 };
4742 
4746 struct OwnedBuffer {
4747  std::unique_ptr<const uint8_t[]> buffer;
4748  size_t size = 0;
4749  OwnedBuffer(std::unique_ptr<const uint8_t[]> buffer, size_t size)
4750  : buffer(std::move(buffer)), size(size) {}
4751  OwnedBuffer() = default;
4752 };
4753 
4754 // Wrapper around a compiled WebAssembly module, which is potentially shared by
4755 // different WasmModuleObjects.
4757  public:
4762  OwnedBuffer Serialize();
4763 
4767  MemorySpan<const uint8_t> GetWireBytesRef();
4768 
4769  const std::string& source_url() const { return source_url_; }
4770 
4771  private:
4772  friend class WasmModuleObject;
4773  friend class WasmStreaming;
4774 
4775  explicit CompiledWasmModule(std::shared_ptr<internal::wasm::NativeModule>,
4776  const char* source_url, size_t url_length);
4777 
4778  const std::shared_ptr<internal::wasm::NativeModule> native_module_;
4779  const std::string source_url_;
4780 };
4781 
4782 // An instance of WebAssembly.Module.
4784  public:
4785  WasmModuleObject() = delete;
4786 
4791  static MaybeLocal<WasmModuleObject> FromCompiledModule(
4792  Isolate* isolate, const CompiledWasmModule&);
4793 
4798  CompiledWasmModule GetCompiledModule();
4799 
4800  V8_INLINE static WasmModuleObject* Cast(Value* obj);
4801 
4802  private:
4803  static void CheckCast(Value* obj);
4804 };
4805 
4813  public:
4814  class WasmStreamingImpl;
4815 
4819  class Client {
4820  public:
4821  virtual ~Client() = default;
4826  virtual void OnModuleCompiled(CompiledWasmModule compiled_module) = 0;
4827  };
4828 
4829  explicit WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl);
4830 
4831  ~WasmStreaming();
4832 
4837  void OnBytesReceived(const uint8_t* bytes, size_t size);
4838 
4844  void Finish();
4845 
4851  void Abort(MaybeLocal<Value> exception);
4852 
4860  bool SetCompiledModuleBytes(const uint8_t* bytes, size_t size);
4861 
4866  void SetClient(std::shared_ptr<Client> client);
4867 
4868  /*
4869  * Sets the UTF-8 encoded source URL for the {Script} object. This must be
4870  * called before {Finish}.
4871  */
4872  void SetUrl(const char* url, size_t length);
4873 
4879  static std::shared_ptr<WasmStreaming> Unpack(Isolate* isolate,
4880  Local<Value> value);
4881 
4882  private:
4883  std::unique_ptr<WasmStreamingImpl> impl_;
4884 };
4885 
4886 // TODO(mtrofin): when streaming compilation is done, we can rename this
4887 // to simply WasmModuleObjectBuilder
4889  public:
4890  explicit WasmModuleObjectBuilderStreaming(Isolate* isolate);
4894  void OnBytesReceived(const uint8_t*, size_t size);
4895  void Finish();
4901  void Abort(MaybeLocal<Value> exception);
4902  Local<Promise> GetPromise();
4903 
4904  ~WasmModuleObjectBuilderStreaming() = default;
4905 
4906  private:
4908  delete;
4910  default;
4912  const WasmModuleObjectBuilderStreaming&) = delete;
4914  WasmModuleObjectBuilderStreaming&&) = default;
4915  Isolate* isolate_ = nullptr;
4916 
4917 #if V8_CC_MSVC
4918 
4926 #else
4927  Persistent<Promise> promise_;
4928 #endif
4929  std::shared_ptr<internal::wasm::StreamingDecoder> streaming_decoder_;
4930 };
4931 
4932 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
4933 // The number of required internal fields can be defined by embedder.
4934 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
4935 #endif
4936 
4937 
4939 
4954  public:
4955  ~BackingStore();
4956 
4962  void* Data() const;
4963 
4967  size_t ByteLength() const;
4968 
4973  bool IsShared() const;
4974 
4980  static std::unique_ptr<BackingStore> Reallocate(
4981  v8::Isolate* isolate, std::unique_ptr<BackingStore> backing_store,
4982  size_t byte_length);
4983 
4989  using DeleterCallback = void (*)(void* data, size_t length,
4990  void* deleter_data);
4991 
5001  static void EmptyDeleter(void* data, size_t length, void* deleter_data);
5002 
5003  private:
5008  BackingStore();
5009 };
5010 
5011 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
5012 // Use v8::BackingStore::DeleterCallback instead.
5013 using BackingStoreDeleterCallback = void (*)(void* data, size_t length,
5014  void* deleter_data);
5015 
5016 #endif
5017 
5021 class V8_EXPORT ArrayBuffer : public Object {
5022  public:
5038  class V8_EXPORT Allocator { // NOLINT
5039  public:
5040  virtual ~Allocator() = default;
5041 
5046  virtual void* Allocate(size_t length) = 0;
5047 
5052  virtual void* AllocateUninitialized(size_t length) = 0;
5053 
5058  virtual void Free(void* data, size_t length) = 0;
5059 
5072  virtual void* Reallocate(void* data, size_t old_length, size_t new_length);
5073 
5079  enum class AllocationMode { kNormal, kReservation };
5080 
5087  static Allocator* NewDefaultAllocator();
5088  };
5089 
5099  class V8_EXPORT Contents { // NOLINT
5100  public:
5101  using DeleterCallback = void (*)(void* buffer, size_t length, void* info);
5102 
5104  : data_(nullptr),
5105  byte_length_(0),
5106  allocation_base_(nullptr),
5107  allocation_length_(0),
5108  allocation_mode_(Allocator::AllocationMode::kNormal),
5109  deleter_(nullptr),
5110  deleter_data_(nullptr) {}
5111 
5112  void* AllocationBase() const { return allocation_base_; }
5113  size_t AllocationLength() const { return allocation_length_; }
5115  return allocation_mode_;
5116  }
5117 
5118  void* Data() const { return data_; }
5119  size_t ByteLength() const { return byte_length_; }
5120  DeleterCallback Deleter() const { return deleter_; }
5121  void* DeleterData() const { return deleter_data_; }
5122 
5123  private:
5124  Contents(void* data, size_t byte_length, void* allocation_base,
5125  size_t allocation_length,
5126  Allocator::AllocationMode allocation_mode, DeleterCallback deleter,
5127  void* deleter_data);
5128 
5129  void* data_;
5130  size_t byte_length_;
5131  void* allocation_base_;
5132  size_t allocation_length_;
5133  Allocator::AllocationMode allocation_mode_;
5134  DeleterCallback deleter_;
5135  void* deleter_data_;
5136 
5137  friend class ArrayBuffer;
5138  };
5139 
5140 
5144  size_t ByteLength() const;
5145 
5152  static Local<ArrayBuffer> New(Isolate* isolate, size_t byte_length);
5153 
5164  "Use the version that takes a BackingStore. "
5165  "See http://crbug.com/v8/9908.")
5166  static Local<ArrayBuffer> New(
5167  Isolate* isolate, void* data, size_t byte_length,
5169 
5182  static Local<ArrayBuffer> New(Isolate* isolate,
5183  std::shared_ptr<BackingStore> backing_store);
5184 
5194  static std::unique_ptr<BackingStore> NewBackingStore(Isolate* isolate,
5195  size_t byte_length);
5204  static std::unique_ptr<BackingStore> NewBackingStore(
5205  void* data, size_t byte_length, v8::BackingStore::DeleterCallback deleter,
5206  void* deleter_data);
5207 
5213  "With v8::BackingStore externalized ArrayBuffers are "
5214  "the same as ordinary ArrayBuffers. See http://crbug.com/v8/9908.")
5215  bool IsExternal() const;
5216 
5220  bool IsDetachable() const;
5221 
5228  void Detach();
5229 
5241  "Use GetBackingStore or Detach. See http://crbug.com/v8/9908.")
5242  Contents Externalize();
5243 
5251  V8_DEPRECATE_SOON("This will be removed together with IsExternal.")
5252  void Externalize(const std::shared_ptr<BackingStore>& backing_store);
5253 
5262  V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
5263  Contents GetContents();
5264 
5273  std::shared_ptr<BackingStore> GetBackingStore();
5274 
5275  V8_INLINE static ArrayBuffer* Cast(Value* obj);
5276 
5277  static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
5278  static const int kEmbedderFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
5279 
5280  private:
5281  ArrayBuffer();
5282  static void CheckCast(Value* obj);
5283  Contents GetContents(bool externalize);
5284 };
5285 
5286 
5287 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
5288 // The number of required internal fields can be defined by embedder.
5289 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
5290 #endif
5291 
5292 
5298  public:
5302  Local<ArrayBuffer> Buffer();
5306  size_t ByteOffset();
5310  size_t ByteLength();
5311 
5321  size_t CopyContents(void* dest, size_t byte_length);
5322 
5327  bool HasBuffer() const;
5328 
5329  V8_INLINE static ArrayBufferView* Cast(Value* obj);
5330 
5331  static const int kInternalFieldCount =
5333  static const int kEmbedderFieldCount =
5335 
5336  private:
5337  ArrayBufferView();
5338  static void CheckCast(Value* obj);
5339 };
5340 
5341 
5347  public:
5348  /*
5349  * The largest typed array size that can be constructed using New.
5350  */
5351  static constexpr size_t kMaxLength = internal::kApiSystemPointerSize == 4
5353  : 0xFFFFFFFF;
5354 
5359  size_t Length();
5360 
5361  V8_INLINE static TypedArray* Cast(Value* obj);
5362 
5363  private:
5364  TypedArray();
5365  static void CheckCast(Value* obj);
5366 };
5367 
5368 
5373  public:
5374  static Local<Uint8Array> New(Local<ArrayBuffer> array_buffer,
5375  size_t byte_offset, size_t length);
5376  static Local<Uint8Array> New(Local<SharedArrayBuffer> shared_array_buffer,
5377  size_t byte_offset, size_t length);
5378  V8_INLINE static Uint8Array* Cast(Value* obj);
5379 
5380  private:
5381  Uint8Array();
5382  static void CheckCast(Value* obj);
5383 };
5384 
5385 
5390  public:
5391  static Local<Uint8ClampedArray> New(Local<ArrayBuffer> array_buffer,
5392  size_t byte_offset, size_t length);
5393  static Local<Uint8ClampedArray> New(
5394  Local<SharedArrayBuffer> shared_array_buffer, size_t byte_offset,
5395  size_t length);
5396  V8_INLINE static Uint8ClampedArray* Cast(Value* obj);
5397 
5398  private:
5400  static void CheckCast(Value* obj);
5401 };
5402 
5407  public:
5408  static Local<Int8Array> New(Local<ArrayBuffer> array_buffer,
5409  size_t byte_offset, size_t length);
5410  static Local<Int8Array> New(Local<SharedArrayBuffer> shared_array_buffer,
5411  size_t byte_offset, size_t length);
5412  V8_INLINE static Int8Array* Cast(Value* obj);
5413 
5414  private:
5415  Int8Array();
5416  static void CheckCast(Value* obj);
5417 };
5418 
5419 
5424  public:
5425  static Local<Uint16Array> New(Local<ArrayBuffer> array_buffer,
5426  size_t byte_offset, size_t length);
5427  static Local<Uint16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
5428  size_t byte_offset, size_t length);
5429  V8_INLINE static Uint16Array* Cast(Value* obj);
5430 
5431  private:
5432  Uint16Array();
5433  static void CheckCast(Value* obj);
5434 };
5435 
5436 
5441  public:
5442  static Local<Int16Array> New(Local<ArrayBuffer> array_buffer,
5443  size_t byte_offset, size_t length);
5444  static Local<Int16Array> New(Local<SharedArrayBuffer> shared_array_buffer,
5445  size_t byte_offset, size_t length);
5446  V8_INLINE static Int16Array* Cast(Value* obj);
5447 
5448  private:
5449  Int16Array();
5450  static void CheckCast(Value* obj);
5451 };
5452 
5453 
5458  public:
5459  static Local<Uint32Array> New(Local<ArrayBuffer> array_buffer,
5460  size_t byte_offset, size_t length);
5461  static Local<Uint32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
5462  size_t byte_offset, size_t length);
5463  V8_INLINE static Uint32Array* Cast(Value* obj);
5464 
5465  private:
5466  Uint32Array();
5467  static void CheckCast(Value* obj);
5468 };
5469 
5470 
5475  public:
5476  static Local<Int32Array> New(Local<ArrayBuffer> array_buffer,
5477  size_t byte_offset, size_t length);
5478  static Local<Int32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
5479  size_t byte_offset, size_t length);
5480  V8_INLINE static Int32Array* Cast(Value* obj);
5481 
5482  private:
5483  Int32Array();
5484  static void CheckCast(Value* obj);
5485 };
5486 
5487 
5492  public:
5493  static Local<Float32Array> New(Local<ArrayBuffer> array_buffer,
5494  size_t byte_offset, size_t length);
5495  static Local<Float32Array> New(Local<SharedArrayBuffer> shared_array_buffer,
5496  size_t byte_offset, size_t length);
5497  V8_INLINE static Float32Array* Cast(Value* obj);
5498 
5499  private:
5500  Float32Array();
5501  static void CheckCast(Value* obj);
5502 };
5503 
5504 
5509  public:
5510  static Local<Float64Array> New(Local<ArrayBuffer> array_buffer,
5511  size_t byte_offset, size_t length);
5512  static Local<Float64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
5513  size_t byte_offset, size_t length);
5514  V8_INLINE static Float64Array* Cast(Value* obj);
5515 
5516  private:
5517  Float64Array();
5518  static void CheckCast(Value* obj);
5519 };
5520 
5525  public:
5526  static Local<BigInt64Array> New(Local<ArrayBuffer> array_buffer,
5527  size_t byte_offset, size_t length);
5528  static Local<BigInt64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
5529  size_t byte_offset, size_t length);
5530  V8_INLINE static BigInt64Array* Cast(Value* obj);
5531 
5532  private:
5533  BigInt64Array();
5534  static void CheckCast(Value* obj);
5535 };
5536 
5541  public:
5542  static Local<BigUint64Array> New(Local<ArrayBuffer> array_buffer,
5543  size_t byte_offset, size_t length);
5544  static Local<BigUint64Array> New(Local<SharedArrayBuffer> shared_array_buffer,
5545  size_t byte_offset, size_t length);
5546  V8_INLINE static BigUint64Array* Cast(Value* obj);
5547 
5548  private:
5549  BigUint64Array();
5550  static void CheckCast(Value* obj);
5551 };
5552 
5557  public:
5558  static Local<DataView> New(Local<ArrayBuffer> array_buffer,
5559  size_t byte_offset, size_t length);
5560  static Local<DataView> New(Local<SharedArrayBuffer> shared_array_buffer,
5561  size_t byte_offset, size_t length);
5562  V8_INLINE static DataView* Cast(Value* obj);
5563 
5564  private:
5565  DataView();
5566  static void CheckCast(Value* obj);
5567 };
5568 
5569 
5574  public:
5584  class V8_EXPORT Contents { // NOLINT
5585  public:
5587  using DeleterCallback = void (*)(void* buffer, size_t length, void* info);
5588 
5590  : data_(nullptr),
5591  byte_length_(0),
5592  allocation_base_(nullptr),
5593  allocation_length_(0),
5594  allocation_mode_(Allocator::AllocationMode::kNormal),
5595  deleter_(nullptr),
5596  deleter_data_(nullptr) {}
5597 
5598  void* AllocationBase() const { return allocation_base_; }
5599  size_t AllocationLength() const { return allocation_length_; }
5601  return allocation_mode_;
5602  }
5603 
5604  void* Data() const { return data_; }
5605  size_t ByteLength() const { return byte_length_; }
5606  DeleterCallback Deleter() const { return deleter_; }
5607  void* DeleterData() const { return deleter_data_; }
5608 
5609  private:
5610  Contents(void* data, size_t byte_length, void* allocation_base,
5611  size_t allocation_length,
5612  Allocator::AllocationMode allocation_mode, DeleterCallback deleter,
5613  void* deleter_data);
5614 
5615  void* data_;
5616  size_t byte_length_;
5617  void* allocation_base_;
5618  size_t allocation_length_;
5619  Allocator::AllocationMode allocation_mode_;
5620  DeleterCallback deleter_;
5621  void* deleter_data_;
5622 
5623  friend class SharedArrayBuffer;
5624  };
5625 
5629  size_t ByteLength() const;
5630 
5637  static Local<SharedArrayBuffer> New(Isolate* isolate, size_t byte_length);
5638 
5646  "Use the version that takes a BackingStore. "
5647  "See http://crbug.com/v8/9908.")
5648  static Local<SharedArrayBuffer> New(
5649  Isolate* isolate, void* data, size_t byte_length,
5651 
5664  static Local<SharedArrayBuffer> New(
5665  Isolate* isolate, std::shared_ptr<BackingStore> backing_store);
5666 
5676  static std::unique_ptr<BackingStore> NewBackingStore(Isolate* isolate,
5677  size_t byte_length);
5686  static std::unique_ptr<BackingStore> NewBackingStore(
5687  void* data, size_t byte_length, v8::BackingStore::DeleterCallback deleter,
5688  void* deleter_data);
5689 
5694  V8_DEPRECATED(
5695  "Use the version that takes a BackingStore. "
5696  "See http://crbug.com/v8/9908.")
5697  static Local<SharedArrayBuffer> New(
5698  Isolate* isolate, const SharedArrayBuffer::Contents&,
5700 
5706  "With v8::BackingStore externalized SharedArrayBuffers are the same "
5707  "as ordinary SharedArrayBuffers. See http://crbug.com/v8/9908.")
5708  bool IsExternal() const;
5709 
5723  "Use GetBackingStore or Detach. See http://crbug.com/v8/9908.")
5724  Contents Externalize();
5725 
5733  V8_DEPRECATE_SOON("This will be removed together with IsExternal.")
5734  void Externalize(const std::shared_ptr<BackingStore>& backing_store);
5735 
5748  V8_DEPRECATE_SOON("Use GetBackingStore. See http://crbug.com/v8/9908.")
5749  Contents GetContents();
5750 
5759  std::shared_ptr<BackingStore> GetBackingStore();
5760 
5761  V8_INLINE static SharedArrayBuffer* Cast(Value* obj);
5762 
5763  static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
5764 
5765  private:
5767  static void CheckCast(Value* obj);
5768  Contents GetContents(bool externalize);
5769 };
5770 
5771 
5775 class V8_EXPORT Date : public Object {
5776  public:
5778  double time);
5779 
5784  double ValueOf() const;
5785 
5786  V8_INLINE static Date* Cast(Value* obj);
5787 
5788  private:
5789  static void CheckCast(Value* obj);
5790 };
5791 
5792 
5797  public:
5798  static Local<Value> New(Isolate* isolate, double value);
5799 
5800  double ValueOf() const;
5801 
5802  V8_INLINE static NumberObject* Cast(Value* obj);
5803 
5804  private:
5805  static void CheckCast(Value* obj);
5806 };
5807 
5812  public:
5813  static Local<Value> New(Isolate* isolate, int64_t value);
5814 
5815  Local<BigInt> ValueOf() const;
5816 
5817  V8_INLINE static BigIntObject* Cast(Value* obj);
5818 
5819  private:
5820  static void CheckCast(Value* obj);
5821 };
5822 
5827  public:
5828  static Local<Value> New(Isolate* isolate, bool value);
5829 
5830  bool ValueOf() const;
5831 
5832  V8_INLINE static BooleanObject* Cast(Value* obj);
5833 
5834  private:
5835  static void CheckCast(Value* obj);
5836 };
5837 
5838 
5843  public:
5844  static Local<Value> New(Isolate* isolate, Local<String> value);
5845 
5846  Local<String> ValueOf() const;
5847 
5848  V8_INLINE static StringObject* Cast(Value* obj);
5849 
5850  private:
5851  static void CheckCast(Value* obj);
5852 };
5853 
5854 
5859  public:
5860  static Local<Value> New(Isolate* isolate, Local<Symbol> value);
5861 
5862  Local<Symbol> ValueOf() const;
5863 
5864  V8_INLINE static SymbolObject* Cast(Value* obj);
5865 
5866  private:
5867  static void CheckCast(Value* obj);
5868 };
5869 
5870 
5874 class V8_EXPORT RegExp : public Object {
5875  public:
5880  enum Flags {
5881  kNone = 0,
5882  kGlobal = 1 << 0,
5883  kIgnoreCase = 1 << 1,
5884  kMultiline = 1 << 2,
5885  kSticky = 1 << 3,
5886  kUnicode = 1 << 4,
5887  kDotAll = 1 << 5,
5888  };
5889 
5890  static constexpr int kFlagCount = 6;
5891 
5903  Local<String> pattern,
5904  Flags flags);
5905 
5911  static V8_WARN_UNUSED_RESULT MaybeLocal<RegExp> NewWithBacktrackLimit(
5912  Local<Context> context, Local<String> pattern, Flags flags,
5913  uint32_t backtrack_limit);
5914 
5927  Local<String> subject);
5928 
5933  Local<String> GetSource() const;
5934 
5938  Flags GetFlags() const;
5939 
5940  V8_INLINE static RegExp* Cast(Value* obj);
5941 
5942  private:
5943  static void CheckCast(Value* obj);
5944 };
5945 
5950 class V8_EXPORT External : public Value {
5951  public:
5952  static Local<External> New(Isolate* isolate, void* value);
5953  V8_INLINE static External* Cast(Value* obj);
5954  void* Value() const;
5955  private:
5956  static void CheckCast(v8::Value* obj);
5957 };
5958 
5959 #define V8_INTRINSICS_LIST(F) \
5960  F(ArrayProto_entries, array_entries_iterator) \
5961  F(ArrayProto_forEach, array_for_each_iterator) \
5962  F(ArrayProto_keys, array_keys_iterator) \
5963  F(ArrayProto_values, array_values_iterator) \
5964  F(ErrorPrototype, initial_error_prototype) \
5965  F(IteratorPrototype, initial_iterator_prototype) \
5966  F(ObjProto_valueOf, object_value_of_function)
5967 
5969 #define V8_DECL_INTRINSIC(name, iname) k##name,
5971 #undef V8_DECL_INTRINSIC
5972 };
5973 
5974 
5975 // --- Templates ---
5976 
5977 
5981 class V8_EXPORT Template : public Data {
5982  public:
5988  void Set(Local<Name> name, Local<Data> value,
5989  PropertyAttribute attributes = None);
5990  void SetPrivate(Local<Private> name, Local<Data> value,
5991  PropertyAttribute attributes = None);
5992  V8_INLINE void Set(Isolate* isolate, const char* name, Local<Data> value);
5993 
5994  void SetAccessorProperty(
5995  Local<Name> name,
5998  PropertyAttribute attribute = None,
5999  AccessControl settings = DEFAULT);
6000 
6028  void SetNativeDataProperty(
6030  AccessorSetterCallback setter = nullptr,
6031  // TODO(dcarney): gcc can't handle Local below
6032  Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
6034  AccessControl settings = DEFAULT,
6035  SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
6036  SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
6037  void SetNativeDataProperty(
6039  AccessorNameSetterCallback setter = nullptr,
6040  // TODO(dcarney): gcc can't handle Local below
6041  Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
6043  AccessControl settings = DEFAULT,
6044  SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
6045  SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
6046 
6051  void SetLazyDataProperty(
6053  Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
6054  SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
6055  SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
6056 
6061  void SetIntrinsicDataProperty(Local<Name> name, Intrinsic intrinsic,
6062  PropertyAttribute attribute = None);
6063 
6064  private:
6065  Template();
6066 
6067  friend class ObjectTemplate;
6068  friend class FunctionTemplate;
6069 };
6070 
6071 // TODO(dcarney): Replace GenericNamedPropertyFooCallback with just
6072 // NamedPropertyFooCallback.
6073 
6111  Local<Name> property, const PropertyCallbackInfo<Value>& info);
6112 
6135  Local<Name> property, Local<Value> value,
6136  const PropertyCallbackInfo<Value>& info);
6137 
6160  Local<Name> property, const PropertyCallbackInfo<Integer>& info);
6161 
6184  Local<Name> property, const PropertyCallbackInfo<Boolean>& info);
6185 
6193  const PropertyCallbackInfo<Array>& info);
6194 
6216  Local<Name> property, const PropertyDescriptor& desc,
6217  const PropertyCallbackInfo<Value>& info);
6218 
6239  Local<Name> property, const PropertyCallbackInfo<Value>& info);
6240 
6245  uint32_t index,
6246  const PropertyCallbackInfo<Value>& info);
6247 
6252  uint32_t index,
6253  Local<Value> value,
6254  const PropertyCallbackInfo<Value>& info);
6255 
6260  uint32_t index,
6261  const PropertyCallbackInfo<Integer>& info);
6262 
6267  uint32_t index,
6268  const PropertyCallbackInfo<Boolean>& info);
6269 
6277  const PropertyCallbackInfo<Array>& info);
6278 
6283  uint32_t index, const PropertyDescriptor& desc,
6284  const PropertyCallbackInfo<Value>& info);
6285 
6290  uint32_t index, const PropertyCallbackInfo<Value>& info);
6291 
6301 };
6302 
6303 
6308 typedef bool (*AccessCheckCallback)(Local<Context> accessing_context,
6309  Local<Object> accessed_object,
6310  Local<Value> data);
6311 
6312 class CFunction;
6421  public:
6423  static Local<FunctionTemplate> New(
6424  Isolate* isolate, FunctionCallback callback = nullptr,
6425  Local<Value> data = Local<Value>(),
6426  Local<Signature> signature = Local<Signature>(), int length = 0,
6429  const CFunction* c_function = nullptr);
6430 
6434  static Local<FunctionTemplate> NewWithCache(
6435  Isolate* isolate, FunctionCallback callback,
6436  Local<Private> cache_property, Local<Value> data = Local<Value>(),
6437  Local<Signature> signature = Local<Signature>(), int length = 0,
6438  SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
6439 
6442  Local<Context> context);
6443 
6451  V8_WARN_UNUSED_RESULT MaybeLocal<Object> NewRemoteInstance();
6452 
6459  void SetCallHandler(
6460  FunctionCallback callback, Local<Value> data = Local<Value>(),
6462  const CFunction* c_function = nullptr);
6463 
6465  void SetLength(int length);
6466 
6468  Local<ObjectTemplate> InstanceTemplate();
6469 
6475  void Inherit(Local<FunctionTemplate> parent);
6476 
6481  Local<ObjectTemplate> PrototypeTemplate();
6482 
6489  void SetPrototypeProviderTemplate(Local<FunctionTemplate> prototype_provider);
6490 
6496  void SetClassName(Local<String> name);
6497 
6498 
6503  void SetAcceptAnyReceiver(bool value);
6504 
6509  void ReadOnlyPrototype();
6510 
6515  void RemovePrototype();
6516 
6521  bool HasInstance(Local<Value> object);
6522 
6523  V8_INLINE static FunctionTemplate* Cast(Data* data);
6524 
6525  private:
6526  FunctionTemplate();
6527 
6528  static void CheckCast(Data* that);
6529  friend class Context;
6530  friend class ObjectTemplate;
6531 };
6532 
6541  kNone = 0,
6542 
6546  kAllCanRead = 1,
6547 
6552  kNonMasking = 1 << 1,
6553 
6558  kOnlyInterceptStrings = 1 << 2,
6559 
6563  kHasNoSideEffect = 1 << 3,
6564 };
6565 
6575  Local<Value> data = Local<Value>(),
6577  : getter(getter),
6578  setter(setter),
6579  query(query),
6580  deleter(deleter),
6581  enumerator(enumerator),
6582  definer(definer),
6583  descriptor(descriptor),
6584  data(data),
6585  flags(flags) {}
6586 
6589  GenericNamedPropertyGetterCallback getter = nullptr,
6590  GenericNamedPropertySetterCallback setter = nullptr,
6591  GenericNamedPropertyQueryCallback query = nullptr,
6592  GenericNamedPropertyDeleterCallback deleter = nullptr,
6593  GenericNamedPropertyEnumeratorCallback enumerator = nullptr,
6594  Local<Value> data = Local<Value>(),
6596  : getter(getter),
6597  setter(setter),
6598  query(query),
6599  deleter(deleter),
6600  enumerator(enumerator),
6601  definer(nullptr),
6602  descriptor(nullptr),
6603  data(data),
6604  flags(flags) {}
6605 
6613  Local<Value> data = Local<Value>(),
6615  : getter(getter),
6616  setter(setter),
6617  query(nullptr),
6618  deleter(deleter),
6619  enumerator(enumerator),
6620  definer(definer),
6621  descriptor(descriptor),
6622  data(data),
6623  flags(flags) {}
6624 
6634 };
6635 
6636 
6645  Local<Value> data = Local<Value>(),
6647  : getter(getter),
6648  setter(setter),
6649  query(query),
6650  deleter(deleter),
6651  enumerator(enumerator),
6652  definer(definer),
6653  descriptor(descriptor),
6654  data(data),
6655  flags(flags) {}
6656 
6659  IndexedPropertyGetterCallback getter = nullptr,
6660  IndexedPropertySetterCallback setter = nullptr,
6661  IndexedPropertyQueryCallback query = nullptr,
6662  IndexedPropertyDeleterCallback deleter = nullptr,
6663  IndexedPropertyEnumeratorCallback enumerator = nullptr,
6664  Local<Value> data = Local<Value>(),
6666  : getter(getter),
6667  setter(setter),
6668  query(query),
6669  deleter(deleter),
6670  enumerator(enumerator),
6671  definer(nullptr),
6672  descriptor(nullptr),
6673  data(data),
6674  flags(flags) {}
6675 
6683  Local<Value> data = Local<Value>(),
6685  : getter(getter),
6686  setter(setter),
6687  query(nullptr),
6688  deleter(deleter),
6689  enumerator(enumerator),
6690  definer(definer),
6691  descriptor(descriptor),
6692  data(data),
6693  flags(flags) {}
6694 
6704 };
6705 
6706 
6714  public:
6716  static Local<ObjectTemplate> New(
6717  Isolate* isolate,
6719 
6722 
6752  void SetAccessor(
6754  AccessorSetterCallback setter = nullptr,
6755  Local<Value> data = Local<Value>(), AccessControl settings = DEFAULT,
6756  PropertyAttribute attribute = None,
6758  SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
6759  SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
6760  void SetAccessor(
6762  AccessorNameSetterCallback setter = nullptr,
6763  Local<Value> data = Local<Value>(), AccessControl settings = DEFAULT,
6764  PropertyAttribute attribute = None,
6766  SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect,
6767  SideEffectType setter_side_effect_type = SideEffectType::kHasSideEffect);
6768 
6780  void SetHandler(const NamedPropertyHandlerConfiguration& configuration);
6781 
6798  // TODO(dcarney): deprecate
6801  IndexedPropertySetterCallback setter = nullptr,
6802  IndexedPropertyQueryCallback query = nullptr,
6803  IndexedPropertyDeleterCallback deleter = nullptr,
6804  IndexedPropertyEnumeratorCallback enumerator = nullptr,
6805  Local<Value> data = Local<Value>()) {
6806  SetHandler(IndexedPropertyHandlerConfiguration(getter, setter, query,
6807  deleter, enumerator, data));
6808  }
6809 
6820  void SetHandler(const IndexedPropertyHandlerConfiguration& configuration);
6821 
6828  void SetCallAsFunctionHandler(FunctionCallback callback,
6829  Local<Value> data = Local<Value>());
6830 
6839  void MarkAsUndetectable();
6840 
6849  void SetAccessCheckCallback(AccessCheckCallback callback,
6850  Local<Value> data = Local<Value>());
6851 
6858  void SetAccessCheckCallbackAndHandler(
6859  AccessCheckCallback callback,
6860  const NamedPropertyHandlerConfiguration& named_handler,
6861  const IndexedPropertyHandlerConfiguration& indexed_handler,
6862  Local<Value> data = Local<Value>());
6863 
6868  int InternalFieldCount();
6869 
6874  void SetInternalFieldCount(int value);
6875 
6879  bool IsImmutableProto();
6880 
6885  void SetImmutableProto();
6886 
6887  V8_INLINE static ObjectTemplate* Cast(Data* data);
6888 
6889  private:
6890  ObjectTemplate();
6891  static Local<ObjectTemplate> New(internal::Isolate* isolate,
6892  Local<FunctionTemplate> constructor);
6893  static void CheckCast(Data* that);
6894  friend class FunctionTemplate;
6895 };
6896 
6905 class V8_EXPORT Signature : public Data {
6906  public:
6907  static Local<Signature> New(
6908  Isolate* isolate,
6910 
6911  V8_INLINE static Signature* Cast(Data* data);
6912 
6913  private:
6914  Signature();
6915 
6916  static void CheckCast(Data* that);
6917 };
6918 
6919 
6925  public:
6926  static Local<AccessorSignature> New(
6927  Isolate* isolate,
6929 
6930  V8_INLINE static AccessorSignature* Cast(Data* data);
6931 
6932  private:
6934 
6935  static void CheckCast(Data* that);
6936 };
6937 
6938 
6939 // --- Extensions ---
6940 
6944 class V8_EXPORT Extension { // NOLINT
6945  public:
6946  // Note that the strings passed into this constructor must live as long
6947  // as the Extension itself.
6948  Extension(const char* name, const char* source = nullptr, int dep_count = 0,
6949  const char** deps = nullptr, int source_length = -1);
6950  virtual ~Extension() { delete source_; }
6952  Isolate* isolate, Local<String> name) {
6953  return Local<FunctionTemplate>();
6954  }
6955 
6956  const char* name() const { return name_; }
6957  size_t source_length() const { return source_length_; }
6959  return source_;
6960  }
6961  int dependency_count() const { return dep_count_; }
6962  const char** dependencies() const { return deps_; }
6963  void set_auto_enable(bool value) { auto_enable_ = value; }
6964  bool auto_enable() { return auto_enable_; }
6965 
6966  // Disallow copying and assigning.
6967  Extension(const Extension&) = delete;
6968  void operator=(const Extension&) = delete;
6969 
6970  private:
6971  const char* name_;
6972  size_t source_length_; // expected to initialize before source_
6974  int dep_count_;
6975  const char** deps_;
6976  bool auto_enable_;
6977 };
6978 
6979 void V8_EXPORT RegisterExtension(std::unique_ptr<Extension>);
6980 
6981 // --- Statics ---
6982 
6983 V8_INLINE Local<Primitive> Undefined(Isolate* isolate);
6984 V8_INLINE Local<Primitive> Null(Isolate* isolate);
6985 V8_INLINE Local<Boolean> True(Isolate* isolate);
6986 V8_INLINE Local<Boolean> False(Isolate* isolate);
6987 
7003  public:
7022  void ConfigureDefaultsFromHeapSize(size_t initial_heap_size_in_bytes,
7023  size_t maximum_heap_size_in_bytes);
7024 
7034  void ConfigureDefaults(uint64_t physical_memory,
7035  uint64_t virtual_memory_limit);
7036 
7040  uint32_t* stack_limit() const { return stack_limit_; }
7041  void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
7042 
7047  size_t code_range_size_in_bytes() const { return code_range_size_; }
7048  void set_code_range_size_in_bytes(size_t limit) { code_range_size_ = limit; }
7049 
7058  return max_old_generation_size_;
7059  }
7061  max_old_generation_size_ = limit;
7062  }
7063 
7070  return max_young_generation_size_;
7071  }
7073  max_young_generation_size_ = limit;
7074  }
7075 
7077  return initial_old_generation_size_;
7078  }
7079  void set_initial_old_generation_size_in_bytes(size_t initial_size) {
7080  initial_old_generation_size_ = initial_size;
7081  }
7082 
7084  return initial_young_generation_size_;
7085  }
7087  initial_young_generation_size_ = initial_size;
7088  }
7089 
7093  V8_DEPRECATE_SOON("Use code_range_size_in_bytes.")
7094  size_t code_range_size() const { return code_range_size_ / kMB; }
7095  V8_DEPRECATE_SOON("Use set_code_range_size_in_bytes.")
7096  void set_code_range_size(size_t limit_in_mb) {
7097  code_range_size_ = limit_in_mb * kMB;
7098  }
7099  V8_DEPRECATE_SOON("Use max_young_generation_size_in_bytes.")
7100  size_t max_semi_space_size_in_kb() const;
7101  V8_DEPRECATE_SOON("Use set_max_young_generation_size_in_bytes.")
7102  void set_max_semi_space_size_in_kb(size_t limit_in_kb);
7103  V8_DEPRECATE_SOON("Use max_old_generation_size_in_bytes.")
7104  size_t max_old_space_size() const { return max_old_generation_size_ / kMB; }
7105  V8_DEPRECATE_SOON("Use set_max_old_generation_size_in_bytes.")
7106  void set_max_old_space_size(size_t limit_in_mb) {
7107  max_old_generation_size_ = limit_in_mb * kMB;
7108  }
7109  V8_DEPRECATE_SOON("Zone does not pool memory any more.")
7110  size_t max_zone_pool_size() const { return max_zone_pool_size_; }
7111  V8_DEPRECATE_SOON("Zone does not pool memory any more.")
7112  void set_max_zone_pool_size(size_t bytes) { max_zone_pool_size_ = bytes; }
7113 
7114  private:
7115  static constexpr size_t kMB = 1048576u;
7116  size_t code_range_size_ = 0;
7117  size_t max_old_generation_size_ = 0;
7118  size_t max_young_generation_size_ = 0;
7119  size_t max_zone_pool_size_ = 0;
7120  size_t initial_old_generation_size_ = 0;
7121  size_t initial_young_generation_size_ = 0;
7122  uint32_t* stack_limit_ = nullptr;
7123 };
7124 
7125 
7126 // --- Exceptions ---
7127 
7128 
7129 typedef void (*FatalErrorCallback)(const char* location, const char* message);
7130 
7131 typedef void (*OOMErrorCallback)(const char* location, bool is_heap_oom);
7132 
7133 typedef void (*DcheckErrorCallback)(const char* file, int line,
7134  const char* message);
7135 
7136 typedef void (*MessageCallback)(Local<Message> message, Local<Value> data);
7137 
7138 // --- Tracing ---
7139 
7140 typedef void (*LogEventCallback)(const char* name, int event);
7141 
7147  public:
7148  static Local<Value> RangeError(Local<String> message);
7149  static Local<Value> ReferenceError(Local<String> message);
7150  static Local<Value> SyntaxError(Local<String> message);
7151  static Local<Value> TypeError(Local<String> message);
7152  static Local<Value> WasmCompileError(Local<String> message);
7153  static Local<Value> WasmLinkError(Local<String> message);
7154  static Local<Value> WasmRuntimeError(Local<String> message);
7155  static Local<Value> Error(Local<String> message);
7156 
7162  static Local<Message> CreateMessage(Isolate* isolate, Local<Value> exception);
7163 
7168  static Local<StackTrace> GetStackTrace(Local<Value> exception);
7169 };
7170 
7171 
7172 // --- Counters Callbacks ---
7173 
7174 typedef int* (*CounterLookupCallback)(const char* name);
7175 
7176 typedef void* (*CreateHistogramCallback)(const char* name,
7177  int min,
7178  int max,
7179  size_t buckets);
7180 
7181 typedef void (*AddHistogramSampleCallback)(void* histogram, int sample);
7182 
7183 // --- Crashkeys Callback ---
7184 enum class CrashKeyId {
7189  kDumpType,
7190 };
7191 
7192 typedef void (*AddCrashKeyCallback)(CrashKeyId id, const std::string& value);
7193 
7194 // --- Enter/Leave Script Callback ---
7196 typedef void (*CallCompletedCallback)(Isolate*);
7197 
7219  Local<Context> context, Local<ScriptOrModule> referrer,
7220  Local<String> specifier);
7221 
7234  Local<Module> module,
7235  Local<Object> meta);
7236 
7245  Local<Value> error,
7246  Local<Array> sites);
7247 
7265 
7266 typedef void (*PromiseHook)(PromiseHookType type, Local<Promise> promise,
7267  Local<Value> parent);
7268 
7269 // --- Promise Reject Callback ---
7275 };
7276 
7278  public:
7280  Local<Value> value)
7281  : promise_(promise), event_(event), value_(value) {}
7282 
7283  V8_INLINE Local<Promise> GetPromise() const { return promise_; }
7284  V8_INLINE PromiseRejectEvent GetEvent() const { return event_; }
7285  V8_INLINE Local<Value> GetValue() const { return value_; }
7286 
7287  private:
7288  Local<Promise> promise_;
7289  PromiseRejectEvent event_;
7290  Local<Value> value_;
7291 };
7292 
7294 
7295 // --- Microtasks Callbacks ---
7296 V8_DEPRECATE_SOON("Use *WithData version.")
7299 typedef void (*MicrotaskCallback)(void* data);
7300 
7310 
7327  public:
7331  static std::unique_ptr<MicrotaskQueue> New(
7332  Isolate* isolate, MicrotasksPolicy policy = MicrotasksPolicy::kAuto);
7333 
7334  virtual ~MicrotaskQueue() = default;
7335 
7339  virtual void EnqueueMicrotask(Isolate* isolate,
7340  Local<Function> microtask) = 0;
7341 
7345  virtual void EnqueueMicrotask(v8::Isolate* isolate,
7346  MicrotaskCallback callback,
7347  void* data = nullptr) = 0;
7348 
7361  virtual void AddMicrotasksCompletedCallback(
7362  MicrotasksCompletedCallbackWithData callback, void* data = nullptr) = 0;
7363 
7367  virtual void RemoveMicrotasksCompletedCallback(
7368  MicrotasksCompletedCallbackWithData callback, void* data = nullptr) = 0;
7369 
7373  virtual void PerformCheckpoint(Isolate* isolate) = 0;
7374 
7378  virtual bool IsRunningMicrotasks() const = 0;
7379 
7384  virtual int GetMicrotasksScopeDepth() const = 0;
7385 
7386  MicrotaskQueue(const MicrotaskQueue&) = delete;
7387  MicrotaskQueue& operator=(const MicrotaskQueue&) = delete;
7388 
7389  private:
7390  friend class internal::MicrotaskQueue;
7391  MicrotaskQueue() = default;
7392 };
7393 
7404  public:
7405  enum Type { kRunMicrotasks, kDoNotRunMicrotasks };
7406 
7407  MicrotasksScope(Isolate* isolate, Type type);
7408  MicrotasksScope(Isolate* isolate, MicrotaskQueue* microtask_queue, Type type);
7409  ~MicrotasksScope();
7410 
7414  static void PerformCheckpoint(Isolate* isolate);
7415 
7419  static int GetCurrentDepth(Isolate* isolate);
7420 
7424  static bool IsRunningMicrotasks(Isolate* isolate);
7425 
7426  // Prevent copying.
7427  MicrotasksScope(const MicrotasksScope&) = delete;
7428  MicrotasksScope& operator=(const MicrotasksScope&) = delete;
7429 
7430  private:
7431  internal::Isolate* const isolate_;
7432  internal::MicrotaskQueue* const microtask_queue_;
7433  bool run_;
7434 };
7435 
7436 
7437 // --- Failed Access Check Callback ---
7439  AccessType type,
7440  Local<Value> data);
7441 
7442 // --- AllowCodeGenerationFromStrings callbacks ---
7443 
7449  Local<String> source);
7450 
7452  // If true, proceed with the codegen algorithm. Otherwise, block it.
7453  bool codegen_allowed = false;
7454  // Overwrite the original source with this string, if present.
7455  // Use the original source if empty.
7456  // This field is considered only if codegen_allowed is true.
7458 };
7459 
7466  Local<Value> source);
7467 
7468 // --- WebAssembly compilation callbacks ---
7470 
7472  Local<String> source);
7473 
7474 // --- Callback for APIs defined on v8-supported objects, but implemented
7475 // by the embedder. Example: WebAssembly.{compile|instantiate}Streaming ---
7477 
7478 // --- Callback for WebAssembly.compileStreaming ---
7480 
7481 // --- Callback for checking if WebAssembly threads are enabled ---
7483 
7484 // --- Callback for loading source map file for Wasm profiling support
7486  const char* name);
7487 
7488 // --- Callback for checking if WebAssembly Simd is enabled ---
7489 typedef bool (*WasmSimdEnabledCallback)(Local<Context> context);
7490 
7491 // --- Garbage Collection Callbacks ---
7492 
7500 enum GCType {
7507 };
7508 
7531 };
7532 
7533 typedef void (*GCCallback)(GCType type, GCCallbackFlags flags);
7534 
7535 typedef void (*InterruptCallback)(Isolate* isolate, void* data);
7536 
7544 typedef size_t (*NearHeapLimitCallback)(void* data, size_t current_heap_limit,
7545  size_t initial_heap_limit);
7546 
7554  public:
7556  size_t read_only_space_size() { return read_only_space_size_; }
7557  size_t read_only_space_used_size() { return read_only_space_used_size_; }
7559  return read_only_space_physical_size_;
7560  }
7561 
7562  private:
7563  size_t read_only_space_size_;
7564  size_t read_only_space_used_size_;
7565  size_t read_only_space_physical_size_;
7566 
7567  friend class V8;
7568  friend class internal::ReadOnlyHeap;
7569 };
7570 
7578  public:
7579  HeapStatistics();
7580  size_t total_heap_size() { return total_heap_size_; }
7581  size_t total_heap_size_executable() { return total_heap_size_executable_; }
7582  size_t total_physical_size() { return total_physical_size_; }
7583  size_t total_available_size() { return total_available_size_; }
7584  size_t total_global_handles_size() { return total_global_handles_size_; }
7585  size_t used_global_handles_size() { return used_global_handles_size_; }
7586  size_t used_heap_size() { return used_heap_size_; }
7587  size_t heap_size_limit() { return heap_size_limit_; }
7588  size_t malloced_memory() { return malloced_memory_; }
7589  size_t external_memory() { return external_memory_; }
7590  size_t peak_malloced_memory() { return peak_malloced_memory_; }
7591  size_t number_of_native_contexts() { return number_of_native_contexts_; }
7592  size_t number_of_detached_contexts() { return number_of_detached_contexts_; }
7593 
7598  size_t does_zap_garbage() { return does_zap_garbage_; }
7599 
7600  private:
7601  size_t total_heap_size_;
7602  size_t total_heap_size_executable_;
7603  size_t total_physical_size_;
7604  size_t total_available_size_;
7605  size_t used_heap_size_;
7606  size_t heap_size_limit_;
7607  size_t malloced_memory_;
7608  size_t external_memory_;
7609  size_t peak_malloced_memory_;
7610  bool does_zap_garbage_;
7611  size_t number_of_native_contexts_;
7612  size_t number_of_detached_contexts_;
7613  size_t total_global_handles_size_;
7614  size_t used_global_handles_size_;
7615 
7616  friend class V8;
7617  friend class Isolate;
7618 };
7619 
7620 
7622  public:
7624  const char* space_name() { return space_name_; }
7625  size_t space_size() { return space_size_; }
7626  size_t space_used_size() { return space_used_size_; }
7627  size_t space_available_size() { return space_available_size_; }
7628  size_t physical_space_size() { return physical_space_size_; }
7629 
7630  private:
7631  const char* space_name_;
7632  size_t space_size_;
7633  size_t space_used_size_;
7634  size_t space_available_size_;
7635  size_t physical_space_size_;
7636 
7637  friend class Isolate;
7638 };
7639 
7640 
7642  public:
7644  const char* object_type() { return object_type_; }
7645  const char* object_sub_type() { return object_sub_type_; }
7646  size_t object_count() { return object_count_; }
7647  size_t object_size() { return object_size_; }
7648 
7649  private:
7650  const char* object_type_;
7651  const char* object_sub_type_;
7652  size_t object_count_;
7653  size_t object_size_;
7654 
7655  friend class Isolate;
7656 };
7657 
7659  public:
7661  size_t code_and_metadata_size() { return code_and_metadata_size_; }
7662  size_t bytecode_and_metadata_size() { return bytecode_and_metadata_size_; }
7663  size_t external_script_source_size() { return external_script_source_size_; }
7664 
7665  private:
7666  size_t code_and_metadata_size_;
7667  size_t bytecode_and_metadata_size_;
7668  size_t external_script_source_size_;
7669 
7670  friend class Isolate;
7671 };
7672 
7679  enum EventType {
7685  CODE_END_LINE_INFO_RECORDING
7686  };
7687  // Definition of the code position type. The "POSITION" type means the place
7688  // in the source code which are of interest when making stack traces to
7689  // pin-point the source location of a stack frame as close as possible.
7690  // The "STATEMENT_POSITION" means the place at the beginning of each
7691  // statement, and is used to indicate possible break locations.
7692  enum PositionType { POSITION, STATEMENT_POSITION };
7693 
7694  // There are two different kinds of JitCodeEvents, one for JIT code generated
7695  // by the optimizing compiler, and one for byte code generated for the
7696  // interpreter. For JIT_CODE events, the |code_start| member of the event
7697  // points to the beginning of jitted assembly code, while for BYTE_CODE
7698  // events, |code_start| points to the first bytecode of the interpreted
7699  // function.
7700  enum CodeType { BYTE_CODE, JIT_CODE };
7701 
7702  // Type of event.
7705  // Start of the instructions.
7706  void* code_start;
7707  // Size of the instructions.
7708  size_t code_len;
7709  // Script info for CODE_ADDED event.
7711  // User-defined data for *_LINE_INFO_* event. It's used to hold the source
7712  // code line information which is returned from the
7713  // CODE_START_LINE_INFO_RECORDING event. And it's passed to subsequent
7714  // CODE_ADD_LINE_POS_INFO and CODE_END_LINE_INFO_RECORDING events.
7715  void* user_data;
7716 
7717  struct name_t {
7718  // Name of the object associated with the code, note that the string is not
7719  // zero-terminated.
7720  const char* str;
7721  // Number of chars in str.
7722  size_t len;
7723  };
7724 
7725  struct line_info_t {
7726  // PC offset
7727  size_t offset;
7728  // Code position
7729  size_t pos;
7730  // The position type.
7732  };
7733 
7735  // Source file name.
7736  const char* filename;
7737  // Length of filename.
7739  // Line number table, which maps offsets of JITted code to line numbers of
7740  // source file.
7742  // Number of entries in the line number table.
7744  };
7745 
7747 
7748  union {
7749  // Only valid for CODE_ADDED.
7750  struct name_t name;
7751 
7752  // Only valid for CODE_ADD_LINE_POS_INFO
7753  struct line_info_t line_info;
7754 
7755  // New location of instructions. Only valid for CODE_MOVED.
7757  };
7758 
7760 };
7761 
7767 enum RAILMode : unsigned {
7768  // Response performance mode: In this mode very low virtual machine latency
7769  // is provided. V8 will try to avoid JavaScript execution interruptions.
7770  // Throughput may be throttled.
7772  // Animation performance mode: In this mode low virtual machine latency is
7773  // provided. V8 will try to avoid as many JavaScript execution interruptions
7774  // as possible. Throughput may be throttled. This is the default mode.
7776  // Idle performance mode: The embedder is idle. V8 can complete deferred work
7777  // in this mode.
7779  // Load performance mode: In this mode high throughput is provided. V8 may
7780  // turn off latency optimizations.
7782 };
7783 
7789  // Generate callbacks for already existent code.
7791 };
7792 
7793 
7799 typedef void (*JitCodeEventHandler)(const JitCodeEvent* event);
7800 
7804 #if defined(V8_OS_WIN)
7805 typedef int (*UnhandledExceptionCallback)(
7806  _EXCEPTION_POINTERS* exception_pointers);
7807 #endif
7808 
7813  public:
7814  virtual ~ExternalResourceVisitor() = default;
7815  virtual void VisitExternalString(Local<String> string) {}
7816 };
7817 
7818 
7823  public:
7824  virtual ~PersistentHandleVisitor() = default;
7826  uint16_t class_id) {}
7827 };
7828 
7838 
7847  public:
7849 
7850  enum TraceFlags : uint64_t {
7851  kNoFlags = 0,
7852  kReduceMemory = 1 << 0,
7853  kForced = 1 << 2,
7854  };
7855 
7860  public:
7861  virtual ~TracedGlobalHandleVisitor() = default;
7862  virtual void VisitTracedGlobalHandle(const TracedGlobal<Value>& handle) {}
7863  virtual void VisitTracedReference(const TracedReference<Value>& handle) {}
7864  };
7865 
7870  struct TraceSummary {
7875  double time = 0.0;
7876 
7881  size_t allocated_size = 0;
7882  };
7883 
7884  virtual ~EmbedderHeapTracer() = default;
7885 
7890  void IterateTracedGlobalHandles(TracedGlobalHandleVisitor* visitor);
7891 
7896  void SetStackStart(void* stack_start);
7897 
7901  void NotifyEmptyEmbedderStack();
7902 
7909  virtual void RegisterV8References(
7910  const std::vector<std::pair<void*, void*> >& embedder_fields) = 0;
7911 
7912  void RegisterEmbedderReference(const TracedReferenceBase<v8::Data>& ref);
7913 
7917  virtual void TracePrologue(TraceFlags flags) {}
7918 
7929  virtual bool AdvanceTracing(double deadline_in_ms) = 0;
7930 
7931  /*
7932  * Returns true if there no more tracing work to be done (see AdvanceTracing)
7933  * and false otherwise.
7934  */
7935  virtual bool IsTracingDone() = 0;
7936 
7944  virtual void TraceEpilogue(TraceSummary* trace_summary) {}
7945 
7950  virtual void EnterFinalPause(EmbedderStackState stack_state) = 0;
7951 
7952  /*
7953  * Called by the embedder to request immediate finalization of the currently
7954  * running tracing phase that has been started with TracePrologue and not
7955  * yet finished with TraceEpilogue.
7956  *
7957  * Will be a noop when currently not in tracing.
7958  *
7959  * This is an experimental feature.
7960  */
7961  void FinalizeTracing();
7962 
7980  virtual bool IsRootForNonTracingGC(
7981  const v8::TracedReference<v8::Value>& handle);
7982  virtual bool IsRootForNonTracingGC(const v8::TracedGlobal<v8::Value>& handle);
7983 
7993  virtual void ResetHandleInNonTracingGC(
7994  const v8::TracedReference<v8::Value>& handle);
7995 
7996  /*
7997  * Called by the embedder to immediately perform a full garbage collection.
7998  *
7999  * Should only be used in testing code.
8000  */
8001  void GarbageCollectionForTesting(EmbedderStackState stack_state);
8002 
8003  /*
8004  * Called by the embedder to signal newly allocated or freed memory. Not bound
8005  * to tracing phases. Embedders should trade off when increments are reported
8006  * as V8 may consult global heuristics on whether to trigger garbage
8007  * collection on this change.
8008  */
8009  void IncreaseAllocatedSize(size_t bytes);
8010  void DecreaseAllocatedSize(size_t bytes);
8011 
8012  /*
8013  * Returns the v8::Isolate this tracer is attached too and |nullptr| if it
8014  * is not attached to any v8::Isolate.
8015  */
8016  v8::Isolate* isolate() const { return isolate_; }
8017 
8018  protected:
8019  v8::Isolate* isolate_ = nullptr;
8020 
8021  friend class internal::LocalEmbedderHeapTracer;
8022 };
8023 
8033  typedef StartupData (*CallbackFunction)(Local<Object> holder, int index,
8034  void* data);
8035  SerializeInternalFieldsCallback(CallbackFunction function = nullptr,
8036  void* data_arg = nullptr)
8037  : callback(function), data(data_arg) {}
8038  CallbackFunction callback;
8039  void* data;
8040 };
8041 // Note that these fields are called "internal fields" in the API and called
8042 // "embedder fields" within V8.
8044 
8050  typedef void (*CallbackFunction)(Local<Object> holder, int index,
8051  StartupData payload, void* data);
8052  DeserializeInternalFieldsCallback(CallbackFunction function = nullptr,
8053  void* data_arg = nullptr)
8054  : callback(function), data(data_arg) {}
8055  void (*callback)(Local<Object> holder, int index, StartupData payload,
8056  void* data);
8057  void* data;
8058 };
8060 
8067 
8075 
8083  public:
8084  virtual ~MeasureMemoryDelegate() = default;
8085 
8089  virtual bool ShouldMeasure(Local<Context> context) = 0;
8090 
8101  virtual void MeasurementComplete(
8102  const std::vector<std::pair<Local<Context>, size_t>>&
8103  context_sizes_in_bytes,
8104  size_t unattributed_size_in_bytes) = 0;
8105 
8116  static std::unique_ptr<MeasureMemoryDelegate> Default(
8117  Isolate* isolate, Local<Context> context,
8118  Local<Promise::Resolver> promise_resolver, MeasureMemoryMode mode);
8119 };
8120 
8130  public:
8134  struct CreateParams {
8136  : code_event_handler(nullptr),
8137  snapshot_blob(nullptr),
8138  counter_lookup_callback(nullptr),
8139  create_histogram_callback(nullptr),
8140  add_histogram_sample_callback(nullptr),
8141  array_buffer_allocator(nullptr),
8142  array_buffer_allocator_shared(),
8143  external_references(nullptr),
8144  allow_atomics_wait(true),
8145  only_terminate_in_safe_scope(false),
8146  embedder_wrapper_type_index(-1),
8147  embedder_wrapper_object_index(-1) {}
8148 
8154 
8159 
8164 
8165 
8171 
8180 
8191  std::shared_ptr<ArrayBuffer::Allocator> array_buffer_allocator_shared;
8192 
8199  const intptr_t* external_references;
8200 
8206 
8211 
8219  };
8220 
8221 
8227  public:
8228  explicit Scope(Isolate* isolate) : isolate_(isolate) {
8229  isolate->Enter();
8230  }
8231 
8232  ~Scope() { isolate_->Exit(); }
8233 
8234  // Prevent copying of Scope objects.
8235  Scope(const Scope&) = delete;
8236  Scope& operator=(const Scope&) = delete;
8237 
8238  private:
8239  Isolate* const isolate_;
8240  };
8241 
8242 
8247  public:
8248  enum OnFailure { CRASH_ON_FAILURE, THROW_ON_FAILURE, DUMP_ON_FAILURE };
8249 
8250  DisallowJavascriptExecutionScope(Isolate* isolate, OnFailure on_failure);
8252 
8253  // Prevent copying of Scope objects.
8255  delete;
8257  const DisallowJavascriptExecutionScope&) = delete;
8258 
8259  private:
8260  OnFailure on_failure_;
8261  void* internal_;
8262  };
8263 
8264 
8269  public:
8270  explicit AllowJavascriptExecutionScope(Isolate* isolate);
8272 
8273  // Prevent copying of Scope objects.
8275  delete;
8276  AllowJavascriptExecutionScope& operator=(
8277  const AllowJavascriptExecutionScope&) = delete;
8278 
8279  private:
8280  void* internal_throws_;
8281  void* internal_assert_;
8282  void* internal_dump_;
8283  };
8284 
8290  public:
8292  Isolate* isolate, MicrotaskQueue* microtask_queue = nullptr);
8294 
8295  // Prevent copying of Scope objects.
8297  delete;
8299  const SuppressMicrotaskExecutionScope&) = delete;
8300 
8301  private:
8302  internal::Isolate* const isolate_;
8303  internal::MicrotaskQueue* const microtask_queue_;
8304  internal::Address previous_stack_height_;
8305 
8306  friend class internal::ThreadLocalTop;
8307  };
8308 
8314  public:
8315  explicit SafeForTerminationScope(v8::Isolate* isolate);
8317 
8318  // Prevent copying of Scope objects.
8320  SafeForTerminationScope& operator=(const SafeForTerminationScope&) = delete;
8321 
8322  private:
8323  internal::Isolate* isolate_;
8324  bool prev_value_;
8325  };
8326 
8333  kMinorGarbageCollection
8334  };
8335 
8342  kUseAsm = 0,
8343  kBreakIterator = 1,
8344  kLegacyConst = 2,
8345  kMarkDequeOverflow = 3,
8346  kStoreBufferOverflow = 4,
8347  kSlotsBufferOverflow = 5,
8348  kObjectObserve = 6,
8349  kForcedGC = 7,
8350  kSloppyMode = 8,
8351  kStrictMode = 9,
8352  kStrongMode = 10,
8353  kRegExpPrototypeStickyGetter = 11,
8354  kRegExpPrototypeToString = 12,
8355  kRegExpPrototypeUnicodeGetter = 13,
8356  kIntlV8Parse = 14,
8357  kIntlPattern = 15,
8358  kIntlResolved = 16,
8359  kPromiseChain = 17,
8360  kPromiseAccept = 18,
8361  kPromiseDefer = 19,
8362  kHtmlCommentInExternalScript = 20,
8363  kHtmlComment = 21,
8364  kSloppyModeBlockScopedFunctionRedefinition = 22,
8365  kForInInitializer = 23,
8366  kArrayProtectorDirtied = 24,
8367  kArraySpeciesModified = 25,
8368  kArrayPrototypeConstructorModified = 26,
8369  kArrayInstanceProtoModified = 27,
8370  kArrayInstanceConstructorModified = 28,
8371  kLegacyFunctionDeclaration = 29,
8372  kRegExpPrototypeSourceGetter = 30,
8373  kRegExpPrototypeOldFlagGetter = 31,
8374  kDecimalWithLeadingZeroInStrictMode = 32,
8375  kLegacyDateParser = 33,
8376  kDefineGetterOrSetterWouldThrow = 34,
8377  kFunctionConstructorReturnedUndefined = 35,
8378  kAssigmentExpressionLHSIsCallInSloppy = 36,
8379  kAssigmentExpressionLHSIsCallInStrict = 37,
8380  kPromiseConstructorReturnedUndefined = 38,
8381  kConstructorNonUndefinedPrimitiveReturn = 39,
8382  kLabeledExpressionStatement = 40,
8383  kLineOrParagraphSeparatorAsLineTerminator = 41,
8384  kIndexAccessor = 42,
8385  kErrorCaptureStackTrace = 43,
8386  kErrorPrepareStackTrace = 44,
8387  kErrorStackTraceLimit = 45,
8388  kWebAssemblyInstantiation = 46,
8389  kDeoptimizerDisableSpeculation = 47,
8390  kArrayPrototypeSortJSArrayModifiedPrototype = 48,
8391  kFunctionTokenOffsetTooLongForToString = 49,
8392  kWasmSharedMemory = 50,
8393  kWasmThreadOpcodes = 51,
8394  kAtomicsNotify = 52,
8395  kAtomicsWake = 53,
8396  kCollator = 54,
8397  kNumberFormat = 55,
8398  kDateTimeFormat = 56,
8399  kPluralRules = 57,
8400  kRelativeTimeFormat = 58,
8401  kLocale = 59,
8402  kListFormat = 60,
8403  kSegmenter = 61,
8404  kStringLocaleCompare = 62,
8405  kStringToLocaleUpperCase = 63,
8406  kStringToLocaleLowerCase = 64,
8407  kNumberToLocaleString = 65,
8408  kDateToLocaleString = 66,
8409  kDateToLocaleDateString = 67,
8410  kDateToLocaleTimeString = 68,
8411  kAttemptOverrideReadOnlyOnPrototypeSloppy = 69,
8412  kAttemptOverrideReadOnlyOnPrototypeStrict = 70,
8413  kOptimizedFunctionWithOneShotBytecode = 71,
8414  kRegExpMatchIsTrueishOnNonJSRegExp = 72,
8415  kRegExpMatchIsFalseishOnJSRegExp = 73,
8416  kDateGetTimezoneOffset = 74, // Unused.
8417  kStringNormalize = 75,
8418  kCallSiteAPIGetFunctionSloppyCall = 76,
8419  kCallSiteAPIGetThisSloppyCall = 77,
8420  kRegExpMatchAllWithNonGlobalRegExp = 78,
8421  kRegExpExecCalledOnSlowRegExp = 79,
8422  kRegExpReplaceCalledOnSlowRegExp = 80,
8423  kDisplayNames = 81,
8424  kSharedArrayBufferConstructed = 82,
8425  kArrayPrototypeHasElements = 83,
8426  kObjectPrototypeHasElements = 84,
8427  kNumberFormatStyleUnit = 85,
8428  kDateTimeFormatRange = 86,
8429  kDateTimeFormatDateTimeStyle = 87,
8430  kBreakIteratorTypeWord = 88,
8431  kBreakIteratorTypeLine = 89,
8432  kInvalidatedArrayBufferDetachingProtector = 90,
8433  kInvalidatedArrayConstructorProtector = 91,
8434  kInvalidatedArrayIteratorLookupChainProtector = 92,
8435  kInvalidatedArraySpeciesLookupChainProtector = 93,
8436  kInvalidatedIsConcatSpreadableLookupChainProtector = 94,
8437  kInvalidatedMapIteratorLookupChainProtector = 95,
8438  kInvalidatedNoElementsProtector = 96,
8439  kInvalidatedPromiseHookProtector = 97,
8440  kInvalidatedPromiseResolveLookupChainProtector = 98,
8441  kInvalidatedPromiseSpeciesLookupChainProtector = 99,
8442  kInvalidatedPromiseThenLookupChainProtector = 100,
8443  kInvalidatedRegExpSpeciesLookupChainProtector = 101,
8444  kInvalidatedSetIteratorLookupChainProtector = 102,
8445  kInvalidatedStringIteratorLookupChainProtector = 103,
8446  kInvalidatedStringLengthOverflowLookupChainProtector = 104,
8447  kInvalidatedTypedArraySpeciesLookupChainProtector = 105,
8448  kWasmSimdOpcodes = 106,
8449  kVarRedeclaredCatchBinding = 107,
8450 
8451  // If you add new values here, you'll also need to update Chromium's:
8452  // web_feature.mojom, use_counter_callback.cc, and enums.xml. V8 changes to
8453  // this list need to be landed first, then changes on the Chromium side.
8454  kUseCounterFeatureCount // This enum value must be last.
8455  };
8456 
8458  kMessageLog = (1 << 0),
8459  kMessageDebug = (1 << 1),
8460  kMessageInfo = (1 << 2),
8461  kMessageError = (1 << 3),
8462  kMessageWarning = (1 << 4),
8463  kMessageAll = kMessageLog | kMessageDebug | kMessageInfo | kMessageError |
8464  kMessageWarning,
8465  };
8466 
8467  typedef void (*UseCounterCallback)(Isolate* isolate,
8468  UseCounterFeature feature);
8469 
8484  static Isolate* Allocate();
8485 
8489  static void Initialize(Isolate* isolate, const CreateParams& params);
8490 
8500  static Isolate* New(const CreateParams& params);
8501 
8508  static Isolate* GetCurrent();
8509 
8523  void ClearKeptObjects();
8524 
8534  typedef bool (*AbortOnUncaughtExceptionCallback)(Isolate*);
8535  void SetAbortOnUncaughtExceptionCallback(
8536  AbortOnUncaughtExceptionCallback callback);
8537 
8542  void SetHostImportModuleDynamicallyCallback(
8544 
8549  void SetHostInitializeImportMetaObjectCallback(
8551 
8556  void SetPrepareStackTraceCallback(PrepareStackTraceCallback callback);
8557 
8564  void MemoryPressureNotification(MemoryPressureLevel level);
8565 
8576  void Enter();
8577 
8585  void Exit();
8586 
8591  void Dispose();
8592 
8597  void DumpAndResetStats();
8598 
8606  void DiscardThreadSpecificMetadata();
8607 
8612  V8_INLINE void SetData(uint32_t slot, void* data);
8613 
8618  V8_INLINE void* GetData(uint32_t slot);
8619 
8624  V8_INLINE static uint32_t GetNumberOfDataSlots();
8625 
8631  template <class T>
8632  V8_INLINE MaybeLocal<T> GetDataFromSnapshotOnce(size_t index);
8633 
8637  void GetHeapStatistics(HeapStatistics* heap_statistics);
8638 
8642  size_t NumberOfHeapSpaces();
8643 
8653  bool GetHeapSpaceStatistics(HeapSpaceStatistics* space_statistics,
8654  size_t index);
8655 
8659  size_t NumberOfTrackedHeapObjectTypes();
8660 
8670  bool GetHeapObjectStatisticsAtLastGC(HeapObjectStatistics* object_statistics,
8671  size_t type_index);
8672 
8680  bool GetHeapCodeAndMetadataStatistics(HeapCodeStatistics* object_statistics);
8681 
8694  bool MeasureMemory(
8695  std::unique_ptr<MeasureMemoryDelegate> delegate,
8697 
8698  V8_DEPRECATE_SOON("Use the version with a delegate")
8699  MaybeLocal<Promise> MeasureMemory(Local<Context> context,
8700  MeasureMemoryMode mode);
8701 
8714  void GetStackSample(const RegisterState& state, void** frames,
8715  size_t frames_limit, SampleInfo* sample_info);
8716 
8730  V8_INLINE int64_t
8731  AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
8732 
8737  size_t NumberOfPhantomHandleResetsSinceLastCall();
8738 
8743  HeapProfiler* GetHeapProfiler();
8744 
8748  void SetIdle(bool is_idle);
8749 
8751  ArrayBuffer::Allocator* GetArrayBufferAllocator();
8752 
8754  bool InContext();
8755 
8760  Local<Context> GetCurrentContext();
8761 
8763  V8_DEPRECATED("Use GetEnteredOrMicrotaskContext().")
8764  Local<Context> GetEnteredContext();
8765 
8772  Local<Context> GetEnteredOrMicrotaskContext();
8773 
8778  Local<Context> GetIncumbentContext();
8779 
8786  Local<Value> ThrowException(Local<Value> exception);
8787 
8788  typedef void (*GCCallback)(Isolate* isolate, GCType type,
8789  GCCallbackFlags flags);
8790  typedef void (*GCCallbackWithData)(Isolate* isolate, GCType type,
8791  GCCallbackFlags flags, void* data);
8792 
8802  void AddGCPrologueCallback(GCCallbackWithData callback, void* data = nullptr,
8803  GCType gc_type_filter = kGCTypeAll);
8804  void AddGCPrologueCallback(GCCallback callback,
8805  GCType gc_type_filter = kGCTypeAll);
8806 
8811  void RemoveGCPrologueCallback(GCCallbackWithData, void* data = nullptr);
8812  void RemoveGCPrologueCallback(GCCallback callback);
8813 
8817  void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer);
8818 
8819  /*
8820  * Gets the currently active heap tracer for the isolate.
8821  */
8822  EmbedderHeapTracer* GetEmbedderHeapTracer();
8823 
8827  enum class AtomicsWaitEvent {
8829  kStartWait,
8831  kWokenUp,
8833  kTimedOut,
8835  kTerminatedExecution,
8837  kAPIStopped,
8839  kNotEqual
8840  };
8841 
8847  public:
8862  void Wake();
8863  };
8864 
8888  typedef void (*AtomicsWaitCallback)(AtomicsWaitEvent event,
8889  Local<SharedArrayBuffer> array_buffer,
8890  size_t offset_in_bytes, int64_t value,
8891  double timeout_in_ms,
8892  AtomicsWaitWakeHandle* stop_handle,
8893  void* data);
8894 
8901  void SetAtomicsWaitCallback(AtomicsWaitCallback callback, void* data);
8902 
8912  void AddGCEpilogueCallback(GCCallbackWithData callback, void* data = nullptr,
8913  GCType gc_type_filter = kGCTypeAll);
8914  void AddGCEpilogueCallback(GCCallback callback,
8915  GCType gc_type_filter = kGCTypeAll);
8916 
8921  void RemoveGCEpilogueCallback(GCCallbackWithData callback,
8922  void* data = nullptr);
8923  void RemoveGCEpilogueCallback(GCCallback callback);
8924 
8925  typedef size_t (*GetExternallyAllocatedMemoryInBytesCallback)();
8926 
8933  void SetGetExternallyAllocatedMemoryInBytesCallback(
8934  GetExternallyAllocatedMemoryInBytesCallback callback);
8935 
8943  void TerminateExecution();
8944 
8953  bool IsExecutionTerminating();
8954 
8969  void CancelTerminateExecution();
8970 
8979  void RequestInterrupt(InterruptCallback callback, void* data);
8980 
8991  void RequestGarbageCollectionForTesting(GarbageCollectionType type);
8992 
8996  void SetEventLogger(LogEventCallback that);
8997 
9004  void AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback);
9005 
9009  void RemoveBeforeCallEnteredCallback(BeforeCallEnteredCallback callback);
9010 
9018  void AddCallCompletedCallback(CallCompletedCallback callback);
9019 
9023  void RemoveCallCompletedCallback(CallCompletedCallback callback);
9024 
9029  void SetPromiseHook(PromiseHook hook);
9030 
9035  void SetPromiseRejectCallback(PromiseRejectCallback callback);
9036 
9040  V8_DEPRECATE_SOON("Use PerformMicrotaskCheckpoint.")
9041  void RunMicrotasks() { PerformMicrotaskCheckpoint(); }
9042 
9049  void PerformMicrotaskCheckpoint();
9050 
9054  void EnqueueMicrotask(Local<Function> microtask);
9055 
9059  void EnqueueMicrotask(MicrotaskCallback callback, void* data = nullptr);
9060 
9064  void SetMicrotasksPolicy(MicrotasksPolicy policy);
9065 
9069  MicrotasksPolicy GetMicrotasksPolicy() const;
9070 
9084  V8_DEPRECATE_SOON("Use *WithData version.")
9085  void AddMicrotasksCompletedCallback(MicrotasksCompletedCallback callback);
9086  void AddMicrotasksCompletedCallback(
9087  MicrotasksCompletedCallbackWithData callback, void* data = nullptr);
9088 
9092  V8_DEPRECATE_SOON("Use *WithData version.")
9093  void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallback callback);
9094  void RemoveMicrotasksCompletedCallback(
9095  MicrotasksCompletedCallbackWithData callback, void* data = nullptr);
9096 
9100  void SetUseCounterCallback(UseCounterCallback callback);
9101 
9106  void SetCounterFunction(CounterLookupCallback);
9107 
9114  void SetCreateHistogramFunction(CreateHistogramCallback);
9115  void SetAddHistogramSampleFunction(AddHistogramSampleCallback);
9116 
9122  void SetAddCrashKeyCallback(AddCrashKeyCallback);
9123 
9138  bool IdleNotificationDeadline(double deadline_in_seconds);
9139 
9144  void LowMemoryNotification();
9145 
9155  int ContextDisposedNotification(bool dependant_context = true);
9156 
9161  void IsolateInForegroundNotification();
9162 
9167  void IsolateInBackgroundNotification();
9168 
9174  void EnableMemorySavingsMode();
9175 
9179  void DisableMemorySavingsMode();
9180 
9188  void SetRAILMode(RAILMode rail_mode);
9189 
9194  void IncreaseHeapLimitForDebugging();
9195 
9199  void RestoreOriginalHeapLimit();
9200 
9205  bool IsHeapLimitIncreasedForDebugging();
9206 
9229  void SetJitCodeEventHandler(JitCodeEventOptions options,
9230  JitCodeEventHandler event_handler);
9231 
9241  void SetStackLimit(uintptr_t stack_limit);
9242 
9258  void GetCodeRange(void** start, size_t* length_in_bytes);
9259 
9263  // TODO(petermarshall): Remove this API.
9264  V8_DEPRECATED("Use entry_stubs + code_pages version.")
9265  UnwindState GetUnwindState();
9266 
9270  JSEntryStubs GetJSEntryStubs();
9271 
9272  static constexpr size_t kMinCodePagesBufferSize = 32;
9273 
9287  size_t CopyCodePages(size_t capacity, MemoryRange* code_pages_out);
9288 
9290  void SetFatalErrorHandler(FatalErrorCallback that);
9291 
9293  void SetOOMErrorHandler(OOMErrorCallback that);
9294 
9300  void AddNearHeapLimitCallback(NearHeapLimitCallback callback, void* data);
9301 
9309  void RemoveNearHeapLimitCallback(NearHeapLimitCallback callback,
9310  size_t heap_limit);
9311 
9318  void AutomaticallyRestoreInitialHeapLimit(double threshold_percent = 0.5);
9319 
9324  V8_DEPRECATED(
9325  "Use Isolate::SetModifyCodeGenerationFromStringsCallback instead. "
9326  "See http://crbug.com/v8/10096.")
9327  void SetAllowCodeGenerationFromStringsCallback(
9329  void SetModifyCodeGenerationFromStringsCallback(
9331 
9336  void SetAllowWasmCodeGenerationCallback(
9338 
9343  void SetWasmModuleCallback(ExtensionCallback callback);
9344  void SetWasmInstanceCallback(ExtensionCallback callback);
9345 
9346  void SetWasmStreamingCallback(WasmStreamingCallback callback);
9347 
9348  void SetWasmThreadsEnabledCallback(WasmThreadsEnabledCallback callback);
9349 
9350  void SetWasmLoadSourceMapCallback(WasmLoadSourceMapCallback callback);
9351 
9352  void SetWasmSimdEnabledCallback(WasmSimdEnabledCallback callback);
9353 
9358  bool IsDead();
9359 
9369  bool AddMessageListener(MessageCallback that,
9370  Local<Value> data = Local<Value>());
9371 
9383  bool AddMessageListenerWithErrorLevel(MessageCallback that,
9384  int message_levels,
9385  Local<Value> data = Local<Value>());
9386 
9390  void RemoveMessageListeners(MessageCallback that);
9391 
9393  void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
9394 
9399  void SetCaptureStackTraceForUncaughtExceptions(
9400  bool capture, int frame_limit = 10,
9401  StackTrace::StackTraceOptions options = StackTrace::kOverview);
9402 
9408  void VisitExternalResources(ExternalResourceVisitor* visitor);
9409 
9414  void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor);
9415 
9421  void VisitWeakHandles(PersistentHandleVisitor* visitor);
9422 
9427  bool IsInUse();
9428 
9434  void SetAllowAtomicsWait(bool allow);
9435 
9449  enum class TimeZoneDetection { kSkip, kRedetect };
9450 
9461  void DateTimeConfigurationChangeNotification(
9462  TimeZoneDetection time_zone_detection = TimeZoneDetection::kSkip);
9463 
9473  void LocaleConfigurationChangeNotification();
9474 
9475  Isolate() = delete;
9476  ~Isolate() = delete;
9477  Isolate(const Isolate&) = delete;
9478  Isolate& operator=(const Isolate&) = delete;
9479  // Deleting operator new and delete here is allowed as ctor and dtor is also
9480  // deleted.
9481  void* operator new(size_t size) = delete;
9482  void* operator new[](size_t size) = delete;
9483  void operator delete(void*, size_t) = delete;
9484  void operator delete[](void*, size_t) = delete;
9485 
9486  private:
9487  template <class K, class V, class Traits>
9489 
9490  internal::Address* GetDataFromSnapshotOnce(size_t index);
9491  void ReportExternalAllocationLimitReached();
9492 };
9493 
9495  public:
9501  bool CanBeRehashed() const;
9502 
9503  const char* data;
9505 };
9506 
9507 
9512 typedef bool (*EntropySource)(unsigned char* buffer, size_t length);
9513 
9527 typedef uintptr_t (*ReturnAddressLocationResolver)(
9528  uintptr_t return_addr_location);
9529 
9530 
9534 class V8_EXPORT V8 {
9535  public:
9551  static void SetSnapshotDataBlob(StartupData* startup_blob);
9552 
9554  static void SetDcheckErrorHandler(DcheckErrorCallback that);
9555 
9556 
9560  static void SetFlagsFromString(const char* str);
9561  static void SetFlagsFromString(const char* str, size_t length);
9562 
9566  static void SetFlagsFromCommandLine(int* argc,
9567  char** argv,
9568  bool remove_flags);
9569 
9571  static const char* GetVersion();
9572 
9577  V8_INLINE static bool Initialize() {
9578  const int kBuildConfiguration =
9579  (internal::PointerCompressionIsEnabled() ? kPointerCompression : 0) |
9580  (internal::SmiValuesAre31Bits() ? k31BitSmis : 0) |
9581  (internal::HeapSandboxIsEnabled() ? kHeapSandbox : 0);
9582  return Initialize(kBuildConfiguration);
9583  }
9584 
9589  static void SetEntropySource(EntropySource source);
9590 
9595  static void SetReturnAddressLocationResolver(
9596  ReturnAddressLocationResolver return_address_resolver);
9597 
9607  static bool Dispose();
9608 
9616  static bool InitializeICU(const char* icu_data_file = nullptr);
9617 
9630  static bool InitializeICUDefaultLocation(const char* exec_path,
9631  const char* icu_data_file = nullptr);
9632 
9648  static void InitializeExternalStartupData(const char* directory_path);
9649  static void InitializeExternalStartupDataFromFile(const char* snapshot_blob);
9650 
9655  static void InitializePlatform(Platform* platform);
9656 
9661  static void ShutdownPlatform();
9662 
9663 #if V8_OS_POSIX
9664 
9683  V8_DEPRECATE_SOON("Use TryHandleWebAssemblyTrapPosix")
9684  static bool TryHandleSignal(int signal_number, void* info, void* context);
9685 #endif // V8_OS_POSIX
9686 
9693  static bool EnableWebAssemblyTrapHandler(bool use_v8_signal_handler);
9694 
9695 #if defined(V8_OS_WIN)
9696 
9705  static void SetUnhandledExceptionCallback(
9706  UnhandledExceptionCallback unhandled_exception_callback);
9707 #endif
9708 
9712  static void GetSharedMemoryStatistics(SharedMemoryStatistics* statistics);
9713 
9714  private:
9715  V8();
9716 
9717  enum BuildConfigurationFeatures {
9718  kPointerCompression = 1 << 0,
9719  k31BitSmis = 1 << 1,
9720  kHeapSandbox = 1 << 2,
9721  };
9722 
9727  static bool Initialize(int build_config);
9728 
9729  static internal::Address* GlobalizeReference(internal::Isolate* isolate,
9730  internal::Address* handle);
9731  static internal::Address* GlobalizeTracedReference(internal::Isolate* isolate,
9732  internal::Address* handle,
9733  internal::Address* slot,
9734  bool has_destructor);
9735  static void MoveGlobalReference(internal::Address** from,
9736  internal::Address** to);
9737  static void MoveTracedGlobalReference(internal::Address** from,
9738  internal::Address** to);
9739  static void CopyTracedGlobalReference(const internal::Address* const* from,
9740  internal::Address** to);
9741  static internal::Address* CopyGlobalReference(internal::Address* from);
9742  static void DisposeGlobal(internal::Address* global_handle);
9743  static void DisposeTracedGlobal(internal::Address* global_handle);
9744  static void MakeWeak(internal::Address* location, void* data,
9745  WeakCallbackInfo<void>::Callback weak_callback,
9746  WeakCallbackType type);
9747  static void MakeWeak(internal::Address** location_addr);
9748  static void* ClearWeak(internal::Address* location);
9749  static void SetFinalizationCallbackTraced(
9750  internal::Address* location, void* parameter,
9752  static void AnnotateStrongRetainer(internal::Address* location,
9753  const char* label);
9754  static Value* Eternalize(Isolate* isolate, Value* handle);
9755 
9756  template <class K, class V, class T>
9758 
9759  static void FromJustIsNothing();
9760  static void ToLocalEmpty();
9761  static void InternalFieldOutOfBounds(int index);
9762  template <class T>
9763  friend class Global;
9764  template <class T> friend class Local;
9765  template <class T>
9766  friend class MaybeLocal;
9767  template <class T>
9768  friend class Maybe;
9769  template <class T>
9770  friend class TracedReferenceBase;
9771  template <class T>
9772  friend class TracedGlobal;
9773  template <class T>
9774  friend class TracedReference;
9775  template <class T>
9776  friend class WeakCallbackInfo;
9777  template <class T> friend class Eternal;
9778  template <class T> friend class PersistentBase;
9779  template <class T, class M> friend class Persistent;
9780  friend class Context;
9781 };
9782 
9792  public:
9793  enum class FunctionCodeHandling { kClear, kKeep };
9794 
9803  SnapshotCreator(Isolate* isolate,
9804  const intptr_t* external_references = nullptr,
9805  StartupData* existing_blob = nullptr);
9806 
9815  SnapshotCreator(const intptr_t* external_references = nullptr,
9816  StartupData* existing_blob = nullptr);
9817 
9822  ~SnapshotCreator();
9823 
9827  Isolate* GetIsolate();
9828 
9836  void SetDefaultContext(Local<Context> context,
9839 
9848  size_t AddContext(Local<Context> context,
9851 
9858  template <class T>
9859  V8_INLINE size_t AddData(Local<Context> context, Local<T> object);
9860 
9867  template <class T>
9868  V8_INLINE size_t AddData(Local<T> object);
9869 
9878  StartupData CreateBlob(FunctionCodeHandling function_code_handling);
9879 
9880  // Disallow copying and assigning.
9881  SnapshotCreator(const SnapshotCreator&) = delete;
9882  void operator=(const SnapshotCreator&) = delete;
9883 
9884  private:
9885  size_t AddData(Local<Context> context, internal::Address object);
9886  size_t AddData(internal::Address object);
9887 
9888  void* data_;
9889 };
9890 
9901 template <class T>
9902 class Maybe {
9903  public:
9904  V8_INLINE bool IsNothing() const { return !has_value_; }
9905  V8_INLINE bool IsJust() const { return has_value_; }
9906 
9910  V8_INLINE T ToChecked() const { return FromJust(); }
9911 
9916  V8_INLINE void Check() const {
9917  if (V8_UNLIKELY(!IsJust())) V8::FromJustIsNothing();
9918  }
9919 
9924  V8_WARN_UNUSED_RESULT V8_INLINE bool To(T* out) const {
9925  if (V8_LIKELY(IsJust())) *out = value_;
9926  return IsJust();
9927  }
9928 
9933  V8_INLINE T FromJust() const {
9934  if (V8_UNLIKELY(!IsJust())) V8::FromJustIsNothing();
9935  return value_;
9936  }
9937 
9942  V8_INLINE T FromMaybe(const T& default_value) const {
9943  return has_value_ ? value_ : default_value;
9944  }
9945 
9946  V8_INLINE bool operator==(const Maybe& other) const {
9947  return (IsJust() == other.IsJust()) &&
9948  (!IsJust() || FromJust() == other.FromJust());
9949  }
9950 
9951  V8_INLINE bool operator!=(const Maybe& other) const {
9952  return !operator==(other);
9953  }
9954 
9955  private:
9956  Maybe() : has_value_(false) {}
9957  explicit Maybe(const T& t) : has_value_(true), value_(t) {}
9958 
9959  bool has_value_;
9960  T value_;
9961 
9962  template <class U>
9963  friend Maybe<U> Nothing();
9964  template <class U>
9965  friend Maybe<U> Just(const U& u);
9966 };
9967 
9968 template <class T>
9969 inline Maybe<T> Nothing() {
9970  return Maybe<T>();
9971 }
9972 
9973 template <class T>
9974 inline Maybe<T> Just(const T& t) {
9975  return Maybe<T>(t);
9976 }
9977 
9978 // A template specialization of Maybe<T> for the case of T = void.
9979 template <>
9980 class Maybe<void> {
9981  public:
9982  V8_INLINE bool IsNothing() const { return !is_valid_; }
9983  V8_INLINE bool IsJust() const { return is_valid_; }
9984 
9985  V8_INLINE bool operator==(const Maybe& other) const {
9986  return IsJust() == other.IsJust();
9987  }
9988 
9989  V8_INLINE bool operator!=(const Maybe& other) const {
9990  return !operator==(other);
9991  }
9992 
9993  private:
9994  struct JustTag {};
9995 
9996  Maybe() : is_valid_(false) {}
9997  explicit Maybe(JustTag) : is_valid_(true) {}
9998 
9999  bool is_valid_;
10000 
10001  template <class U>
10002  friend Maybe<U> Nothing();
10003  friend Maybe<void> JustVoid();
10004 };
10005 
10007 
10012  public:
10018  explicit TryCatch(Isolate* isolate);
10019 
10023  ~TryCatch();
10024 
10028  bool HasCaught() const;
10029 
10038  bool CanContinue() const;
10039 
10052  bool HasTerminated() const;
10053 
10061  Local<Value> ReThrow();
10062 
10069  Local<Value> Exception() const;
10070 
10076  Local<Context> context, Local<Value> exception);
10077 
10084  Local<Context> context) const;
10085 
10093  Local<v8::Message> Message() const;
10094 
10105  void Reset();
10106 
10115  void SetVerbose(bool value);
10116 
10120  bool IsVerbose() const;
10121 
10127  void SetCaptureMessage(bool value);
10128 
10140  static void* JSStackComparableAddress(TryCatch* handler) {
10141  if (handler == nullptr) return nullptr;
10142  return handler->js_stack_comparable_address_;
10143  }
10144 
10145  TryCatch(const TryCatch&) = delete;
10146  void operator=(const TryCatch&) = delete;
10147 
10148  private:
10149  // Declaring operator new and delete as deleted is not spec compliant.
10150  // Therefore declare them private instead to disable dynamic alloc
10151  void* operator new(size_t size);
10152  void* operator new[](size_t size);
10153  void operator delete(void*, size_t);
10154  void operator delete[](void*, size_t);
10155 
10156  void ResetInternal();
10157 
10158  internal::Isolate* isolate_;
10159  TryCatch* next_;
10160  void* exception_;
10161  void* message_obj_;
10162  void* js_stack_comparable_address_;
10163  bool is_verbose_ : 1;
10164  bool can_continue_ : 1;
10165  bool capture_message_ : 1;
10166  bool rethrow_ : 1;
10167  bool has_terminated_ : 1;
10168 
10169  friend class internal::Isolate;
10170 };
10171 
10172 
10173 // --- Context ---
10174 
10175 
10180  public:
10181  ExtensionConfiguration() : name_count_(0), names_(nullptr) {}
10182  ExtensionConfiguration(int name_count, const char* names[])
10183  : name_count_(name_count), names_(names) { }
10184 
10185  const char** begin() const { return &names_[0]; }
10186  const char** end() const { return &names_[name_count_]; }
10187 
10188  private:
10189  const int name_count_;
10190  const char** names_;
10191 };
10192 
10198  public:
10212 
10217  void DetachGlobal();
10218 
10237  static Local<Context> New(
10238  Isolate* isolate, ExtensionConfiguration* extensions = nullptr,
10240  MaybeLocal<Value> global_object = MaybeLocal<Value>(),
10241  DeserializeInternalFieldsCallback internal_fields_deserializer =
10243  MicrotaskQueue* microtask_queue = nullptr);
10244 
10263  static MaybeLocal<Context> FromSnapshot(
10264  Isolate* isolate, size_t context_snapshot_index,
10265  DeserializeInternalFieldsCallback embedder_fields_deserializer =
10267  ExtensionConfiguration* extensions = nullptr,
10268  MaybeLocal<Value> global_object = MaybeLocal<Value>(),
10269  MicrotaskQueue* microtask_queue = nullptr);
10270 
10288  static MaybeLocal<Object> NewRemoteContext(
10289  Isolate* isolate, Local<ObjectTemplate> global_template,
10290  MaybeLocal<Value> global_object = MaybeLocal<Value>());
10291 
10296  void SetSecurityToken(Local<Value> token);
10297 
10299  void UseDefaultSecurityToken();
10300 
10302  Local<Value> GetSecurityToken();
10303 
10310  void Enter();
10311 
10316  void Exit();
10317 
10319  Isolate* GetIsolate();
10320 
10325  enum EmbedderDataFields { kDebugIdIndex = 0 };
10326 
10330  uint32_t GetNumberOfEmbedderDataFields();
10331 
10336  V8_INLINE Local<Value> GetEmbedderData(int index);
10337 
10344  Local<Object> GetExtrasBindingObject();
10345 
10351  void SetEmbedderData(int index, Local<Value> value);
10352 
10359  V8_INLINE void* GetAlignedPointerFromEmbedderData(int index);
10360 
10366  void SetAlignedPointerInEmbedderData(int index, void* value);
10367 
10381  void AllowCodeGenerationFromStrings(bool allow);
10382 
10387  bool IsCodeGenerationFromStringsAllowed();
10388 
10394  void SetErrorMessageForCodeGenerationFromStrings(Local<String> message);
10395 
10401  template <class T>
10402  V8_INLINE MaybeLocal<T> GetDataFromSnapshotOnce(size_t index);
10403 
10409  typedef void (*AbortScriptExecutionCallback)(Isolate* isolate,
10410  Local<Context> context);
10411  void SetAbortScriptExecution(AbortScriptExecutionCallback callback);
10412 
10417  Local<Value> GetContinuationPreservedEmbedderData() const;
10418 
10423  void SetContinuationPreservedEmbedderData(Local<Value> context);
10424 
10429  class Scope {
10430  public:
10431  explicit V8_INLINE Scope(Local<Context> context) : context_(context) {
10432  context_->Enter();
10433  }
10434  V8_INLINE ~Scope() { context_->Exit(); }
10435 
10436  private:
10437  Local<Context> context_;
10438  };
10439 
10446  public:
10451  explicit BackupIncumbentScope(Local<Context> backup_incumbent_context);
10453 
10459  uintptr_t JSStackComparableAddress() const {
10460  return js_stack_comparable_address_;
10461  }
10462 
10463  private:
10464  friend class internal::Isolate;
10465 
10466  Local<Context> backup_incumbent_context_;
10467  uintptr_t js_stack_comparable_address_ = 0;
10468  const BackupIncumbentScope* prev_ = nullptr;
10469  };
10470 
10471  private:
10472  friend class Value;
10473  friend class Script;
10474  friend class Object;
10475  friend class Function;
10476 
10477  internal::Address* GetDataFromSnapshotOnce(size_t index);
10478  Local<Value> SlowGetEmbedderData(int index);
10479  void* SlowGetAlignedPointerFromEmbedderData(int index);
10480 };
10481 
10482 
10560  public:
10564  V8_INLINE explicit Unlocker(Isolate* isolate) { Initialize(isolate); }
10565 
10566  ~Unlocker();
10567  private:
10568  void Initialize(Isolate* isolate);
10569 
10570  internal::Isolate* isolate_;
10571 };
10572 
10573 
10575  public:
10579  V8_INLINE explicit Locker(Isolate* isolate) { Initialize(isolate); }
10580 
10581  ~Locker();
10582 
10587  static bool IsLocked(Isolate* isolate);
10588 
10592  static bool IsActive();
10593 
10594  // Disallow copying and assigning.
10595  Locker(const Locker&) = delete;
10596  void operator=(const Locker&) = delete;
10597 
10598  private:
10599  void Initialize(Isolate* isolate);
10600 
10601  bool has_lock_;
10602  bool top_level_;
10603  internal::Isolate* isolate_;
10604 };
10605 
10612  public:
10641  // TODO(petermarshall): Remove this API
10642  V8_DEPRECATED("Use entry_stubs + code_pages version.")
10643  static bool TryUnwindV8Frames(const UnwindState& unwind_state,
10644  RegisterState* register_state,
10645  const void* stack_base);
10646 
10655  static bool TryUnwindV8Frames(const JSEntryStubs& entry_stubs,
10656  size_t code_pages_length,
10657  const MemoryRange* code_pages,
10658  RegisterState* register_state,
10659  const void* stack_base);
10660 
10669  // TODO(petermarshall): Remove this API
10670  V8_DEPRECATED("Use code_pages version.")
10671  static bool PCIsInV8(const UnwindState& unwind_state, void* pc);
10672 
10677  static bool PCIsInV8(size_t code_pages_length, const MemoryRange* code_pages,
10678  void* pc);
10679 };
10680 
10681 // --- Implementation ---
10682 
10683 template <class T>
10685  return New(isolate, that.val_);
10686 }
10687 
10688 template <class T>
10690  return New(isolate, that.val_);
10691 }
10692 
10693 template <class T>
10695  return New(isolate, that.val_);
10696 }
10697 
10698 template <class T>
10699 Local<T> Local<T>::New(Isolate* isolate, T* that) {
10700  if (that == nullptr) return Local<T>();
10701  T* that_ptr = that;
10702  internal::Address* p = reinterpret_cast<internal::Address*>(that_ptr);
10703  return Local<T>(reinterpret_cast<T*>(HandleScope::CreateHandle(
10704  reinterpret_cast<internal::Isolate*>(isolate), *p)));
10705 }
10706 
10707 
10708 template<class T>
10709 template<class S>
10710 void Eternal<T>::Set(Isolate* isolate, Local<S> handle) {
10711  static_assert(std::is_base_of<T, S>::value, "type check");
10712  val_ = reinterpret_cast<T*>(
10713  V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle)));
10714 }
10715 
10716 template <class T>
10718  // The eternal handle will never go away, so as with the roots, we don't even
10719  // need to open a handle.
10720  return Local<T>(val_);
10721 }
10722 
10723 
10724 template <class T>
10726  if (V8_UNLIKELY(val_ == nullptr)) V8::ToLocalEmpty();
10727  return Local<T>(val_);
10728 }
10729 
10730 
10731 template <class T>
10733 #ifdef V8_ENABLE_CHECKS
10734  if (index < 0 || index >= kEmbedderFieldsInWeakCallback) {
10735  V8::InternalFieldOutOfBounds(index);
10736  }
10737 #endif
10738  return embedder_fields_[index];
10739 }
10740 
10741 
10742 template <class T>
10743 T* PersistentBase<T>::New(Isolate* isolate, T* that) {
10744  if (that == nullptr) return nullptr;
10745  internal::Address* p = reinterpret_cast<internal::Address*>(that);
10746  return reinterpret_cast<T*>(
10747  V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate),
10748  p));
10749 }
10750 
10751 
10752 template <class T, class M>
10753 template <class S, class M2>
10755  static_assert(std::is_base_of<T, S>::value, "type check");
10756  this->Reset();
10757  if (that.IsEmpty()) return;
10758  internal::Address* p = reinterpret_cast<internal::Address*>(that.val_);
10759  this->val_ = reinterpret_cast<T*>(V8::CopyGlobalReference(p));
10760  M::Copy(that, this);
10761 }
10762 
10763 template <class T>
10765  typedef internal::Internals I;
10766  if (this->IsEmpty()) return false;
10767  return I::GetNodeState(reinterpret_cast<internal::Address*>(this->val_)) ==
10768  I::kNodeStateIsWeakValue;
10769 }
10770 
10771 
10772 template <class T>
10774  if (this->IsEmpty()) return;
10775  V8::DisposeGlobal(reinterpret_cast<internal::Address*>(this->val_));
10776  val_ = nullptr;
10777 }
10778 
10779 
10780 template <class T>
10781 template <class S>
10782 void PersistentBase<T>::Reset(Isolate* isolate, const Local<S>& other) {
10783  static_assert(std::is_base_of<T, S>::value, "type check");
10784  Reset();
10785  if (other.IsEmpty()) return;
10786  this->val_ = New(isolate, other.val_);
10787 }
10788 
10789 
10790 template <class T>
10791 template <class S>
10793  const PersistentBase<S>& other) {
10794  static_assert(std::is_base_of<T, S>::value, "type check");
10795  Reset();
10796  if (other.IsEmpty()) return;
10797  this->val_ = New(isolate, other.val_);
10798 }
10799 
10800 
10801 template <class T>
10802 template <typename P>
10804  P* parameter, typename WeakCallbackInfo<P>::Callback callback,
10805  WeakCallbackType type) {
10806  typedef typename WeakCallbackInfo<void>::Callback Callback;
10807  V8::MakeWeak(reinterpret_cast<internal::Address*>(this->val_), parameter,
10808  reinterpret_cast<Callback>(callback), type);
10809 }
10810 
10811 template <class T>
10813  V8::MakeWeak(reinterpret_cast<internal::Address**>(&this->val_));
10814 }
10815 
10816 template <class T>
10817 template <typename P>
10819  return reinterpret_cast<P*>(
10820  V8::ClearWeak(reinterpret_cast<internal::Address*>(this->val_)));
10821 }
10822 
10823 template <class T>
10825  V8::AnnotateStrongRetainer(reinterpret_cast<internal::Address*>(this->val_),
10826  label);
10827 }
10828 
10829 template <class T>
10830 void PersistentBase<T>::SetWrapperClassId(uint16_t class_id) {
10831  typedef internal::Internals I;
10832  if (this->IsEmpty()) return;
10833  internal::Address* obj = reinterpret_cast<internal::Address*>(this->val_);
10834  uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
10835  *reinterpret_cast<uint16_t*>(addr) = class_id;
10836 }
10837 
10838 
10839 template <class T>
10841  typedef internal::Internals I;
10842  if (this->IsEmpty()) return 0;
10843  internal::Address* obj = reinterpret_cast<internal::Address*>(this->val_);
10844  uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
10845  return *reinterpret_cast<uint16_t*>(addr);
10846 }
10847 
10848 template <class T>
10849 Global<T>::Global(Global&& other) : PersistentBase<T>(other.val_) {
10850  if (other.val_ != nullptr) {
10851  V8::MoveGlobalReference(reinterpret_cast<internal::Address**>(&other.val_),
10852  reinterpret_cast<internal::Address**>(&this->val_));
10853  other.val_ = nullptr;
10854  }
10855 }
10856 
10857 template <class T>
10858 template <class S>
10860  static_assert(std::is_base_of<T, S>::value, "type check");
10861  if (this != &rhs) {
10862  this->Reset();
10863  if (rhs.val_ != nullptr) {
10864  this->val_ = rhs.val_;
10865  V8::MoveGlobalReference(
10866  reinterpret_cast<internal::Address**>(&rhs.val_),
10867  reinterpret_cast<internal::Address**>(&this->val_));
10868  rhs.val_ = nullptr;
10869  }
10870  }
10871  return *this;
10872 }
10873 
10874 template <class T>
10875 T* TracedReferenceBase<T>::New(Isolate* isolate, T* that, void* slot,
10876  DestructionMode destruction_mode) {
10877  if (that == nullptr) return nullptr;
10878  internal::Address* p = reinterpret_cast<internal::Address*>(that);
10879  return reinterpret_cast<T*>(V8::GlobalizeTracedReference(
10880  reinterpret_cast<internal::Isolate*>(isolate), p,
10881  reinterpret_cast<internal::Address*>(slot),
10882  destruction_mode == kWithDestructor));
10883 }
10884 
10885 template <class T>
10887  if (IsEmpty()) return;
10888  V8::DisposeTracedGlobal(reinterpret_cast<internal::Address*>(val_));
10889  val_ = nullptr;
10890 }
10891 
10892 template <class T>
10893 template <class S>
10894 void TracedGlobal<T>::Reset(Isolate* isolate, const Local<S>& other) {
10895  static_assert(std::is_base_of<T, S>::value, "type check");
10896  Reset();
10897  if (other.IsEmpty()) return;
10898  this->val_ = this->New(isolate, other.val_, &this->val_,
10900 }
10901 
10902 template <class T>
10903 template <class S>
10905  static_assert(std::is_base_of<T, S>::value, "type check");
10906  *this = std::move(rhs.template As<T>());
10907  return *this;
10908 }
10909 
10910 template <class T>
10911 template <class S>
10913  static_assert(std::is_base_of<T, S>::value, "type check");
10914  *this = rhs.template As<T>();
10915  return *this;
10916 }
10917 
10918 template <class T>
10920  if (this != &rhs) {
10921  V8::MoveTracedGlobalReference(
10922  reinterpret_cast<internal::Address**>(&rhs.val_),
10923  reinterpret_cast<internal::Address**>(&this->val_));
10924  }
10925  return *this;
10926 }
10927 
10928 template <class T>
10930  if (this != &rhs) {
10931  this->Reset();
10932  if (rhs.val_ != nullptr) {
10933  V8::CopyTracedGlobalReference(
10934  reinterpret_cast<const internal::Address* const*>(&rhs.val_),
10935  reinterpret_cast<internal::Address**>(&this->val_));
10936  }
10937  }
10938  return *this;
10939 }
10940 
10941 template <class T>
10942 template <class S>
10943 void TracedReference<T>::Reset(Isolate* isolate, const Local<S>& other) {
10944  static_assert(std::is_base_of<T, S>::value, "type check");
10945  Reset();
10946  if (other.IsEmpty()) return;
10947  this->val_ = this->New(isolate, other.val_, &this->val_,
10949 }
10950 
10951 template <class T>
10952 template <class S>
10954  static_assert(std::is_base_of<T, S>::value, "type check");
10955  *this = std::move(rhs.template As<T>());
10956  return *this;
10957 }
10958 
10959 template <class T>
10960 template <class S>
10962  const TracedReference<S>& rhs) {
10963  static_assert(std::is_base_of<T, S>::value, "type check");
10964  *this = rhs.template As<T>();
10965  return *this;
10966 }
10967 
10968 template <class T>
10970  if (this != &rhs) {
10971  V8::MoveTracedGlobalReference(
10972  reinterpret_cast<internal::Address**>(&rhs.val_),
10973  reinterpret_cast<internal::Address**>(&this->val_));
10974  }
10975  return *this;
10976 }
10977 
10978 template <class T>
10980  if (this != &rhs) {
10981  this->Reset();
10982  if (rhs.val_ != nullptr) {
10983  V8::CopyTracedGlobalReference(
10984  reinterpret_cast<const internal::Address* const*>(&rhs.val_),
10985  reinterpret_cast<internal::Address**>(&this->val_));
10986  }
10987  }
10988  return *this;
10989 }
10990 
10991 template <class T>
10993  typedef internal::Internals I;
10994  if (IsEmpty()) return;
10995  internal::Address* obj = reinterpret_cast<internal::Address*>(val_);
10996  uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
10997  *reinterpret_cast<uint16_t*>(addr) = class_id;
10998 }
10999 
11000 template <class T>
11002  typedef internal::Internals I;
11003  if (IsEmpty()) return 0;
11004  internal::Address* obj = reinterpret_cast<internal::Address*>(val_);
11005  uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
11006  return *reinterpret_cast<uint16_t*>(addr);
11007 }
11008 
11009 template <class T>
11011  void* parameter, typename WeakCallbackInfo<void>::Callback callback) {
11012  V8::SetFinalizationCallbackTraced(
11013  reinterpret_cast<internal::Address*>(this->val_), parameter, callback);
11014 }
11015 
11016 template <typename T>
11017 ReturnValue<T>::ReturnValue(internal::Address* slot) : value_(slot) {}
11018 
11019 template <typename T>
11020 template <typename S>
11021 void ReturnValue<T>::Set(const Global<S>& handle) {
11022  static_assert(std::is_base_of<T, S>::value, "type check");
11023  if (V8_UNLIKELY(handle.IsEmpty())) {
11024  *value_ = GetDefaultValue();
11025  } else {
11026  *value_ = *reinterpret_cast<internal::Address*>(*handle);
11027  }
11028 }
11029 
11030 template <typename T>
11031 template <typename S>
11033  static_assert(std::is_base_of<T, S>::value, "type check");
11034  if (V8_UNLIKELY(handle.IsEmpty())) {
11035  *value_ = GetDefaultValue();
11036  } else {
11037  *value_ = *reinterpret_cast<internal::Address*>(handle.val_);
11038  }
11039 }
11040 
11041 template <typename T>
11042 template <typename S>
11043 void ReturnValue<T>::Set(const Local<S> handle) {
11044  static_assert(std::is_void<T>::value || std::is_base_of<T, S>::value,
11045  "type check");
11046  if (V8_UNLIKELY(handle.IsEmpty())) {
11047  *value_ = GetDefaultValue();
11048  } else {
11049  *value_ = *reinterpret_cast<internal::Address*>(*handle);
11050  }
11051 }
11052 
11053 template<typename T>
11054 void ReturnValue<T>::Set(double i) {
11055  static_assert(std::is_base_of<T, Number>::value, "type check");
11056  Set(Number::New(GetIsolate(), i));
11057 }
11058 
11059 template<typename T>
11060 void ReturnValue<T>::Set(int32_t i) {
11061  static_assert(std::is_base_of<T, Integer>::value, "type check");
11062  typedef internal::Internals I;
11063  if (V8_LIKELY(I::IsValidSmi(i))) {
11064  *value_ = I::IntToSmi(i);
11065  return;
11066  }
11067  Set(Integer::New(GetIsolate(), i));
11068 }
11069 
11070 template<typename T>
11071 void ReturnValue<T>::Set(uint32_t i) {
11072  static_assert(std::is_base_of<T, Integer>::value, "type check");
11073  // Can't simply use INT32_MAX here for whatever reason.
11074  bool fits_into_int32_t = (i & (1U << 31)) == 0;
11075  if (V8_LIKELY(fits_into_int32_t)) {
11076  Set(static_cast<int32_t>(i));
11077  return;
11078  }
11079  Set(Integer::NewFromUnsigned(GetIsolate(), i));
11080 }
11081 
11082 template<typename T>
11083 void ReturnValue<T>::Set(bool value) {
11084  static_assert(std::is_base_of<T, Boolean>::value, "type check");
11085  typedef internal::Internals I;
11086  int root_index;
11087  if (value) {
11088  root_index = I::kTrueValueRootIndex;
11089  } else {
11090  root_index = I::kFalseValueRootIndex;
11091  }
11092  *value_ = *I::GetRoot(GetIsolate(), root_index);
11093 }
11094 
11095 template<typename T>
11097  static_assert(std::is_base_of<T, Primitive>::value, "type check");
11098  typedef internal::Internals I;
11099  *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
11100 }
11101 
11102 template<typename T>
11104  static_assert(std::is_base_of<T, Primitive>::value, "type check");
11105  typedef internal::Internals I;
11106  *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
11107 }
11108 
11109 template<typename T>
11111  static_assert(std::is_base_of<T, String>::value, "type check");
11112  typedef internal::Internals I;
11113  *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
11114 }
11115 
11116 template <typename T>
11118  // Isolate is always the pointer below the default value on the stack.
11119  return *reinterpret_cast<Isolate**>(&value_[-2]);
11120 }
11121 
11122 template <typename T>
11124  typedef internal::Internals I;
11125  if (*value_ == *I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex))
11126  return Local<Value>(*Undefined(GetIsolate()));
11127  return Local<Value>::New(GetIsolate(), reinterpret_cast<Value*>(value_));
11128 }
11129 
11130 template <typename T>
11131 template <typename S>
11132 void ReturnValue<T>::Set(S* whatever) {
11133  static_assert(sizeof(S) < 0, "incompilable to prevent inadvertent misuse");
11134 }
11135 
11136 template <typename T>
11138  // Default value is always the pointer below value_ on the stack.
11139  return value_[-1];
11140 }
11141 
11142 template <typename T>
11144  internal::Address* values,
11145  int length)
11146  : implicit_args_(implicit_args), values_(values), length_(length) {}
11147 
11148 template<typename T>
11150  // values_ points to the first argument (not the receiver).
11151  if (i < 0 || length_ <= i) return Local<Value>(*Undefined(GetIsolate()));
11152 #ifdef V8_REVERSE_JSARGS
11153  return Local<Value>(reinterpret_cast<Value*>(values_ + i));
11154 #else
11155  return Local<Value>(reinterpret_cast<Value*>(values_ - i));
11156 #endif
11157 }
11158 
11159 
11160 template<typename T>
11162  // values_ points to the first argument (not the receiver).
11163 #ifdef V8_REVERSE_JSARGS
11164  return Local<Object>(reinterpret_cast<Object*>(values_ - 1));
11165 #else
11166  return Local<Object>(reinterpret_cast<Object*>(values_ + 1));
11167 #endif
11168 }
11169 
11170 
11171 template<typename T>
11173  return Local<Object>(reinterpret_cast<Object*>(
11174  &implicit_args_[kHolderIndex]));
11175 }
11176 
11177 template <typename T>
11179  return Local<Value>(
11180  reinterpret_cast<Value*>(&implicit_args_[kNewTargetIndex]));
11181 }
11182 
11183 template <typename T>
11185  return Local<Value>(reinterpret_cast<Value*>(&implicit_args_[kDataIndex]));
11186 }
11187 
11188 
11189 template<typename T>
11191  return *reinterpret_cast<Isolate**>(&implicit_args_[kIsolateIndex]);
11192 }
11193 
11194 
11195 template<typename T>
11197  return ReturnValue<T>(&implicit_args_[kReturnValueIndex]);
11198 }
11199 
11200 
11201 template<typename T>
11203  return !NewTarget()->IsUndefined();
11204 }
11205 
11206 
11207 template<typename T>
11209  return length_;
11210 }
11211 
11213  Local<Integer> resource_line_offset,
11214  Local<Integer> resource_column_offset,
11215  Local<Boolean> resource_is_shared_cross_origin,
11216  Local<Integer> script_id,
11217  Local<Value> source_map_url,
11218  Local<Boolean> resource_is_opaque,
11219  Local<Boolean> is_wasm, Local<Boolean> is_module,
11220  Local<PrimitiveArray> host_defined_options)
11221  : resource_name_(resource_name),
11222  resource_line_offset_(resource_line_offset),
11223  resource_column_offset_(resource_column_offset),
11224  options_(!resource_is_shared_cross_origin.IsEmpty() &&
11225  resource_is_shared_cross_origin->IsTrue(),
11226  !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue(),
11227  !is_wasm.IsEmpty() && is_wasm->IsTrue(),
11228  !is_module.IsEmpty() && is_module->IsTrue()),
11229  script_id_(script_id),
11230  source_map_url_(source_map_url),
11231  host_defined_options_(host_defined_options) {}
11232 
11233 Local<Value> ScriptOrigin::ResourceName() const { return resource_name_; }
11234 
11236  return host_defined_options_;
11237 }
11238 
11240  return resource_line_offset_;
11241 }
11242 
11243 
11245  return resource_column_offset_;
11246 }
11247 
11248 
11249 Local<Integer> ScriptOrigin::ScriptID() const { return script_id_; }
11250 
11251 
11252 Local<Value> ScriptOrigin::SourceMapUrl() const { return source_map_url_; }
11253 
11255  CachedData* data)
11256  : source_string(string),
11257  resource_name(origin.ResourceName()),
11258  resource_line_offset(origin.ResourceLineOffset()),
11259  resource_column_offset(origin.ResourceColumnOffset()),
11260  resource_options(origin.Options()),
11261  source_map_url(origin.SourceMapUrl()),
11262  host_defined_options(origin.HostDefinedOptions()),
11263  cached_data(data) {}
11264 
11266  CachedData* data)
11267  : source_string(string), cached_data(data) {}
11268 
11269 
11271  delete cached_data;
11272 }
11273 
11274 
11276  const {
11277  return cached_data;
11278 }
11279 
11281  return resource_options;
11282 }
11283 
11284 Local<Boolean> Boolean::New(Isolate* isolate, bool value) {
11285  return value ? True(isolate) : False(isolate);
11286 }
11287 
11288 void Template::Set(Isolate* isolate, const char* name, Local<Data> value) {
11290  .ToLocalChecked(),
11291  value);
11292 }
11293 
11295 #ifdef V8_ENABLE_CHECKS
11296  CheckCast(data);
11297 #endif
11298  return reinterpret_cast<FunctionTemplate*>(data);
11299 }
11300 
11302 #ifdef V8_ENABLE_CHECKS
11303  CheckCast(data);
11304 #endif
11305  return reinterpret_cast<ObjectTemplate*>(data);
11306 }
11307 
11309 #ifdef V8_ENABLE_CHECKS
11310  CheckCast(data);
11311 #endif
11312  return reinterpret_cast<Signature*>(data);
11313 }
11314 
11316 #ifdef V8_ENABLE_CHECKS
11317  CheckCast(data);
11318 #endif
11319  return reinterpret_cast<AccessorSignature*>(data);
11320 }
11321 
11323 #ifndef V8_ENABLE_CHECKS
11324  typedef internal::Address A;
11325  typedef internal::Internals I;
11326  A obj = *reinterpret_cast<A*>(this);
11327  // Fast path: If the object is a plain JSObject, which is the common case, we
11328  // know where to find the internal fields and can return the value directly.
11329  auto instance_type = I::GetInstanceType(obj);
11330  if (instance_type == I::kJSObjectType ||
11331  instance_type == I::kJSApiObjectType ||
11332  instance_type == I::kJSSpecialApiObjectType) {
11333  int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index);
11334  A value = I::ReadRawField<A>(obj, offset);
11335 #ifdef V8_COMPRESS_POINTERS
11336  // We read the full pointer value and then decompress it in order to avoid
11337  // dealing with potential endiannes issues.
11338  value = I::DecompressTaggedAnyField(obj, static_cast<uint32_t>(value));
11339 #endif
11340  internal::Isolate* isolate =
11342  A* result = HandleScope::CreateHandle(isolate, value);
11343  return Local<Value>(reinterpret_cast<Value*>(result));
11344  }
11345 #endif
11346  return SlowGetInternalField(index);
11347 }
11348 
11349 
11351 #ifndef V8_ENABLE_CHECKS
11352  typedef internal::Address A;
11353  typedef internal::Internals I;
11354  A obj = *reinterpret_cast<A*>(this);
11355  // Fast path: If the object is a plain JSObject, which is the common case, we
11356  // know where to find the internal fields and can return the value directly.
11357  auto instance_type = I::GetInstanceType(obj);
11358  if (V8_LIKELY(instance_type == I::kJSObjectType ||
11359  instance_type == I::kJSApiObjectType ||
11360  instance_type == I::kJSSpecialApiObjectType)) {
11361  int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index);
11362  internal::Isolate* isolate = I::GetIsolateForHeapSandbox(obj);
11363  A value = I::ReadExternalPointerField(isolate, obj, offset);
11364  return reinterpret_cast<void*>(value);
11365  }
11366 #endif
11367  return SlowGetAlignedPointerFromInternalField(index);
11368 }
11369 
11371 #ifdef V8_ENABLE_CHECKS
11372  CheckCast(value);
11373 #endif
11374  return static_cast<String*>(value);
11375 }
11376 
11377 
11379  typedef internal::Address S;
11380  typedef internal::Internals I;
11381  I::CheckInitialized(isolate);
11382  S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex);
11383  return Local<String>(reinterpret_cast<String*>(slot));
11384 }
11385 
11386 
11388  typedef internal::Address A;
11389  typedef internal::Internals I;
11390  A obj = *reinterpret_cast<const A*>(this);
11391 
11392  ExternalStringResource* result;
11393  if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
11394  internal::Isolate* isolate = I::GetIsolateForHeapSandbox(obj);
11395  A value =
11396  I::ReadExternalPointerField(isolate, obj, I::kStringResourceOffset);
11397  result = reinterpret_cast<String::ExternalStringResource*>(value);
11398  } else {
11399  result = GetExternalStringResourceSlow();
11400  }
11401 #ifdef V8_ENABLE_CHECKS
11402  VerifyExternalStringResource(result);
11403 #endif
11404  return result;
11405 }
11406 
11407 
11409  String::Encoding* encoding_out) const {
11410  typedef internal::Address A;
11411  typedef internal::Internals I;
11412  A obj = *reinterpret_cast<const A*>(this);
11413  int type = I::GetInstanceType(obj) & I::kFullStringRepresentationMask;
11414  *encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask);
11415  ExternalStringResourceBase* resource;
11416  if (type == I::kExternalOneByteRepresentationTag ||
11417  type == I::kExternalTwoByteRepresentationTag) {
11418  internal::Isolate* isolate = I::GetIsolateForHeapSandbox(obj);
11419  A value =
11420  I::ReadExternalPointerField(isolate, obj, I::kStringResourceOffset);
11421  resource = reinterpret_cast<ExternalStringResourceBase*>(value);
11422  } else {
11423  resource = GetExternalStringResourceBaseSlow(encoding_out);
11424  }
11425 #ifdef V8_ENABLE_CHECKS
11426  VerifyExternalStringResourceBase(resource, *encoding_out);
11427 #endif
11428  return resource;
11429 }
11430 
11431 
11432 bool Value::IsUndefined() const {
11433 #ifdef V8_ENABLE_CHECKS
11434  return FullIsUndefined();
11435 #else
11436  return QuickIsUndefined();
11437 #endif
11438 }
11439 
11440 bool Value::QuickIsUndefined() const {
11441  typedef internal::Address A;
11442  typedef internal::Internals I;
11443  A obj = *reinterpret_cast<const A*>(this);
11444  if (!I::HasHeapObjectTag(obj)) return false;
11445  if (I::GetInstanceType(obj) != I::kOddballType) return false;
11446  return (I::GetOddballKind(obj) == I::kUndefinedOddballKind);
11447 }
11448 
11449 
11450 bool Value::IsNull() const {
11451 #ifdef V8_ENABLE_CHECKS
11452  return FullIsNull();
11453 #else
11454  return QuickIsNull();
11455 #endif
11456 }
11457 
11458 bool Value::QuickIsNull() const {
11459  typedef internal::Address A;
11460  typedef internal::Internals I;
11461  A obj = *reinterpret_cast<const A*>(this);
11462  if (!I::HasHeapObjectTag(obj)) return false;
11463  if (I::GetInstanceType(obj) != I::kOddballType) return false;
11464  return (I::GetOddballKind(obj) == I::kNullOddballKind);
11465 }
11466 
11468 #ifdef V8_ENABLE_CHECKS
11469  return FullIsNull() || FullIsUndefined();
11470 #else
11471  return QuickIsNullOrUndefined();
11472 #endif
11473 }
11474 
11475 bool Value::QuickIsNullOrUndefined() const {
11476  typedef internal::Address A;
11477  typedef internal::Internals I;
11478  A obj = *reinterpret_cast<const A*>(this);
11479  if (!I::HasHeapObjectTag(obj)) return false;
11480  if (I::GetInstanceType(obj) != I::kOddballType) return false;
11481  int kind = I::GetOddballKind(obj);
11482  return kind == I::kNullOddballKind || kind == I::kUndefinedOddballKind;
11483 }
11484 
11485 bool Value::IsString() const {
11486 #ifdef V8_ENABLE_CHECKS
11487  return FullIsString();
11488 #else
11489  return QuickIsString();
11490 #endif
11491 }
11492 
11493 bool Value::QuickIsString() const {
11494  typedef internal::Address A;
11495  typedef internal::Internals I;
11496  A obj = *reinterpret_cast<const A*>(this);
11497  if (!I::HasHeapObjectTag(obj)) return false;
11498  return (I::GetInstanceType(obj) < I::kFirstNonstringType);
11499 }
11500 
11501 
11502 template <class T> Value* Value::Cast(T* value) {
11503  return static_cast<Value*>(value);
11504 }
11505 
11506 
11508 #ifdef V8_ENABLE_CHECKS
11509  CheckCast(value);
11510 #endif
11511  return static_cast<Boolean*>(value);
11512 }
11513 
11514 
11516 #ifdef V8_ENABLE_CHECKS
11517  CheckCast(value);
11518 #endif
11519  return static_cast<Name*>(value);
11520 }
11521 
11522 
11524 #ifdef V8_ENABLE_CHECKS
11525  CheckCast(value);
11526 #endif
11527  return static_cast<Symbol*>(value);
11528 }
11529 
11530 
11532 #ifdef V8_ENABLE_CHECKS
11533  CheckCast(data);
11534 #endif
11535  return reinterpret_cast<Private*>(data);
11536 }
11537 
11538 
11540 #ifdef V8_ENABLE_CHECKS
11541  CheckCast(value);
11542 #endif
11543  return static_cast<Number*>(value);
11544 }
11545 
11546 
11548 #ifdef V8_ENABLE_CHECKS
11549  CheckCast(value);
11550 #endif
11551  return static_cast<Integer*>(value);
11552 }
11553 
11554 
11556 #ifdef V8_ENABLE_CHECKS
11557  CheckCast(value);
11558 #endif
11559  return static_cast<Int32*>(value);
11560 }
11561 
11562 
11564 #ifdef V8_ENABLE_CHECKS
11565  CheckCast(value);
11566 #endif
11567  return static_cast<Uint32*>(value);
11568 }
11569 
11571 #ifdef V8_ENABLE_CHECKS
11572  CheckCast(value);
11573 #endif
11574  return static_cast<BigInt*>(value);
11575 }
11576 
11578 #ifdef V8_ENABLE_CHECKS
11579  CheckCast(value);
11580 #endif
11581  return static_cast<Date*>(value);
11582 }
11583 
11584 
11586 #ifdef V8_ENABLE_CHECKS
11587  CheckCast(value);
11588 #endif
11589  return static_cast<StringObject*>(value);
11590 }
11591 
11592 
11594 #ifdef V8_ENABLE_CHECKS
11595  CheckCast(value);
11596 #endif
11597  return static_cast<SymbolObject*>(value);
11598 }
11599 
11600 
11602 #ifdef V8_ENABLE_CHECKS
11603  CheckCast(value);
11604 #endif
11605  return static_cast<NumberObject*>(value);
11606 }
11607 
11609 #ifdef V8_ENABLE_CHECKS
11610  CheckCast(value);
11611 #endif
11612  return static_cast<BigIntObject*>(value);
11613 }
11614 
11616 #ifdef V8_ENABLE_CHECKS
11617  CheckCast(value);
11618 #endif
11619  return static_cast<BooleanObject*>(value);
11620 }
11621 
11622 
11624 #ifdef V8_ENABLE_CHECKS
11625  CheckCast(value);
11626 #endif
11627  return static_cast<RegExp*>(value);
11628 }
11629 
11630 
11632 #ifdef V8_ENABLE_CHECKS
11633  CheckCast(value);
11634 #endif
11635  return static_cast<Object*>(value);
11636 }
11637 
11638 
11640 #ifdef V8_ENABLE_CHECKS
11641  CheckCast(value);
11642 #endif
11643  return static_cast<Array*>(value);
11644 }
11645 
11646 
11648 #ifdef V8_ENABLE_CHECKS
11649  CheckCast(value);
11650 #endif
11651  return static_cast<Map*>(value);
11652 }
11653 
11654 
11656 #ifdef V8_ENABLE_CHECKS
11657  CheckCast(value);
11658 #endif
11659  return static_cast<Set*>(value);
11660 }
11661 
11662 
11664 #ifdef V8_ENABLE_CHECKS
11665  CheckCast(value);
11666 #endif
11667  return static_cast<Promise*>(value);
11668 }
11669 
11670 
11672 #ifdef V8_ENABLE_CHECKS
11673  CheckCast(value);
11674 #endif
11675  return static_cast<Proxy*>(value);
11676 }
11677 
11679 #ifdef V8_ENABLE_CHECKS
11680  CheckCast(value);
11681 #endif
11682  return static_cast<WasmModuleObject*>(value);
11683 }
11684 
11686 #ifdef V8_ENABLE_CHECKS
11687  CheckCast(value);
11688 #endif
11689  return static_cast<Promise::Resolver*>(value);
11690 }
11691 
11692 
11694 #ifdef V8_ENABLE_CHECKS
11695  CheckCast(value);
11696 #endif
11697  return static_cast<ArrayBuffer*>(value);
11698 }
11699 
11700 
11702 #ifdef V8_ENABLE_CHECKS
11703  CheckCast(value);
11704 #endif
11705  return static_cast<ArrayBufferView*>(value);
11706 }
11707 
11708 
11710 #ifdef V8_ENABLE_CHECKS
11711  CheckCast(value);
11712 #endif
11713  return static_cast<TypedArray*>(value);
11714 }
11715 
11716 
11718 #ifdef V8_ENABLE_CHECKS
11719  CheckCast(value);
11720 #endif
11721  return static_cast<Uint8Array*>(value);
11722 }
11723 
11724 
11726 #ifdef V8_ENABLE_CHECKS
11727  CheckCast(value);
11728 #endif
11729  return static_cast<Int8Array*>(value);
11730 }
11731 
11732 
11734 #ifdef V8_ENABLE_CHECKS
11735  CheckCast(value);
11736 #endif
11737  return static_cast<Uint16Array*>(value);
11738 }
11739 
11740 
11742 #ifdef V8_ENABLE_CHECKS
11743  CheckCast(value);
11744 #endif
11745  return static_cast<Int16Array*>(value);
11746 }
11747 
11748 
11750 #ifdef V8_ENABLE_CHECKS
11751  CheckCast(value);
11752 #endif
11753  return static_cast<Uint32Array*>(value);
11754 }
11755 
11756 
11758 #ifdef V8_ENABLE_CHECKS
11759  CheckCast(value);
11760 #endif
11761  return static_cast<Int32Array*>(value);
11762 }
11763 
11764 
11766 #ifdef V8_ENABLE_CHECKS
11767  CheckCast(value);
11768 #endif
11769  return static_cast<Float32Array*>(value);
11770 }
11771 
11772 
11774 #ifdef V8_ENABLE_CHECKS
11775  CheckCast(value);
11776 #endif
11777  return static_cast<Float64Array*>(value);
11778 }
11779 
11781 #ifdef V8_ENABLE_CHECKS
11782  CheckCast(value);
11783 #endif
11784  return static_cast<BigInt64Array*>(value);
11785 }
11786 
11788 #ifdef V8_ENABLE_CHECKS
11789  CheckCast(value);
11790 #endif
11791  return static_cast<BigUint64Array*>(value);
11792 }
11793 
11795 #ifdef V8_ENABLE_CHECKS
11796  CheckCast(value);
11797 #endif
11798  return static_cast<Uint8ClampedArray*>(value);
11799 }
11800 
11801 
11803 #ifdef V8_ENABLE_CHECKS
11804  CheckCast(value);
11805 #endif
11806  return static_cast<DataView*>(value);
11807 }
11808 
11809 
11811 #ifdef V8_ENABLE_CHECKS
11812  CheckCast(value);
11813 #endif
11814  return static_cast<SharedArrayBuffer*>(value);
11815 }
11816 
11817 
11819 #ifdef V8_ENABLE_CHECKS
11820  CheckCast(value);
11821 #endif
11822  return static_cast<Function*>(value);
11823 }
11824 
11825 
11827 #ifdef V8_ENABLE_CHECKS
11828  CheckCast(value);
11829 #endif
11830  return static_cast<External*>(value);
11831 }
11832 
11833 
11834 template<typename T>
11836  return *reinterpret_cast<Isolate**>(&args_[kIsolateIndex]);
11837 }
11838 
11839 
11840 template<typename T>
11842  return Local<Value>(reinterpret_cast<Value*>(&args_[kDataIndex]));
11843 }
11844 
11845 
11846 template<typename T>
11848  return Local<Object>(reinterpret_cast<Object*>(&args_[kThisIndex]));
11849 }
11850 
11851 
11852 template<typename T>
11854  return Local<Object>(reinterpret_cast<Object*>(&args_[kHolderIndex]));
11855 }
11856 
11857 
11858 template<typename T>
11860  return ReturnValue<T>(&args_[kReturnValueIndex]);
11861 }
11862 
11863 template <typename T>
11865  typedef internal::Internals I;
11866  if (args_[kShouldThrowOnErrorIndex] !=
11867  I::IntToSmi(I::kInferShouldThrowMode)) {
11868  return args_[kShouldThrowOnErrorIndex] != I::IntToSmi(I::kDontThrow);
11869  }
11871  reinterpret_cast<v8::internal::Isolate*>(GetIsolate()));
11872 }
11873 
11875  typedef internal::Address S;
11876  typedef internal::Internals I;
11877  I::CheckInitialized(isolate);
11878  S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
11879  return Local<Primitive>(reinterpret_cast<Primitive*>(slot));
11880 }
11881 
11882 
11884  typedef internal::Address S;
11885  typedef internal::Internals I;
11886  I::CheckInitialized(isolate);
11887  S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
11888  return Local<Primitive>(reinterpret_cast<Primitive*>(slot));
11889 }
11890 
11891 
11893  typedef internal::Address S;
11894  typedef internal::Internals I;
11895  I::CheckInitialized(isolate);
11896  S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
11897  return Local<Boolean>(reinterpret_cast<Boolean*>(slot));
11898 }
11899 
11900 
11902  typedef internal::Address S;
11903  typedef internal::Internals I;
11904  I::CheckInitialized(isolate);
11905  S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
11906  return Local<Boolean>(reinterpret_cast<Boolean*>(slot));
11907 }
11908 
11909 
11910 void Isolate::SetData(uint32_t slot, void* data) {
11911  typedef internal::Internals I;
11912  I::SetEmbedderData(this, slot, data);
11913 }
11914 
11915 
11916 void* Isolate::GetData(uint32_t slot) {
11917  typedef internal::Internals I;
11918  return I::GetEmbedderData(this, slot);
11919 }
11920 
11921 
11923  typedef internal::Internals I;
11924  return I::kNumIsolateDataSlots;
11925 }
11926 
11927 template <class T>
11929  T* data = reinterpret_cast<T*>(GetDataFromSnapshotOnce(index));
11930  if (data) internal::PerformCastCheck(data);
11931  return Local<T>(data);
11932 }
11933 
11935  int64_t change_in_bytes) {
11936  typedef internal::Internals I;
11937  int64_t* external_memory = reinterpret_cast<int64_t*>(
11938  reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryOffset);
11939  int64_t* external_memory_limit = reinterpret_cast<int64_t*>(
11940  reinterpret_cast<uint8_t*>(this) + I::kExternalMemoryLimitOffset);
11941  int64_t* external_memory_low_since_mc =
11942  reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(this) +
11943  I::kExternalMemoryLowSinceMarkCompactOffset);
11944 
11945  // Embedders are weird: we see both over- and underflows here. Perform the
11946  // addition with unsigned types to avoid undefined behavior.
11947  const int64_t amount =
11948  static_cast<int64_t>(static_cast<uint64_t>(change_in_bytes) +
11949  static_cast<uint64_t>(*external_memory));
11950  *external_memory = amount;
11951 
11952  if (amount < *external_memory_low_since_mc) {
11953  *external_memory_low_since_mc = amount;
11954  *external_memory_limit = amount + I::kExternalAllocationSoftLimit;
11955  }
11956 
11957  if (change_in_bytes <= 0) return *external_memory;
11958 
11959  if (amount > *external_memory_limit) {
11960  ReportExternalAllocationLimitReached();
11961  }
11962  return *external_memory;
11963 }
11964 
11966 #ifndef V8_ENABLE_CHECKS
11967  typedef internal::Address A;
11968  typedef internal::Internals I;
11969  A ctx = *reinterpret_cast<const A*>(this);
11970  A embedder_data =
11971  I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
11972  int value_offset =
11973  I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index);
11974  A value = I::ReadRawField<A>(embedder_data, value_offset);
11975 #ifdef V8_COMPRESS_POINTERS
11976  // We read the full pointer value and then decompress it in order to avoid
11977  // dealing with potential endiannes issues.
11978  value =
11979  I::DecompressTaggedAnyField(embedder_data, static_cast<uint32_t>(value));
11980 #endif
11981  internal::Isolate* isolate = internal::IsolateFromNeverReadOnlySpaceObject(
11982  *reinterpret_cast<A*>(this));
11983  A* result = HandleScope::CreateHandle(isolate, value);
11984  return Local<Value>(reinterpret_cast<Value*>(result));
11985 #else
11986  return SlowGetEmbedderData(index);
11987 #endif
11988 }
11989 
11990 
11992 #ifndef V8_ENABLE_CHECKS
11993  typedef internal::Address A;
11994  typedef internal::Internals I;
11995  A ctx = *reinterpret_cast<const A*>(this);
11996  A embedder_data =
11997  I::ReadTaggedPointerField(ctx, I::kNativeContextEmbedderDataOffset);
11998  int value_offset =
11999  I::kEmbedderDataArrayHeaderSize + (I::kEmbedderDataSlotSize * index);
12000  internal::Isolate* isolate = I::GetIsolateForHeapSandbox(ctx);
12001  return reinterpret_cast<void*>(
12002  I::ReadExternalPointerField(isolate, embedder_data, value_offset));
12003 #else
12004  return SlowGetAlignedPointerFromEmbedderData(index);
12005 #endif
12006 }
12007 
12008 template <class T>
12010  T* data = reinterpret_cast<T*>(GetDataFromSnapshotOnce(index));
12011  if (data) internal::PerformCastCheck(data);
12012  return Local<T>(data);
12013 }
12014 
12015 template <class T>
12017  T* object_ptr = *object;
12018  internal::Address* p = reinterpret_cast<internal::Address*>(object_ptr);
12019  return AddData(context, *p);
12020 }
12021 
12022 template <class T>
12024  T* object_ptr = *object;
12025  internal::Address* p = reinterpret_cast<internal::Address*>(object_ptr);
12026  return AddData(*p);
12027 }
12028 
12041 } // namespace v8
12042 
12043 #endif // INCLUDE_V8_H_
v8::PersistentBase::operator=
void operator=(const PersistentBase &)=delete
v8::JitCodeEvent::name_t::len
size_t len
Definition: v8.h:7722
v8::IndexedPropertyHandlerConfiguration::deleter
IndexedPropertyDeleterCallback deleter
Definition: v8.h:6698
v8::True
V8_INLINE Local< Boolean > True(Isolate *isolate)
Definition: v8.h:11892
v8::ACCESS_DELETE
@ ACCESS_DELETE
Definition: v8.h:6299
v8::TypedArray::Cast
static V8_INLINE TypedArray * Cast(Value *obj)
Definition: v8.h:11709
v8::EmbedderHeapTracer::TraceEpilogue
virtual void TraceEpilogue(TraceSummary *trace_summary)
Definition: v8.h:7944
v8::Eternal::Eternal
V8_INLINE Eternal(Isolate *isolate, Local< S > handle)
Definition: v8.h:409
v8::Null
V8_INLINE Local< Primitive > Null(Isolate *isolate)
Definition: v8.h:11883
v8::Persistent::Utils
friend class Utils
Definition: v8.h:733
v8::ScriptCompiler::kConsumeCodeCache
@ kConsumeCodeCache
Definition: v8.h:1796
v8::PropertyCallbackInfo::args_
internal::Address * args_
Definition: v8.h:4426
v8::String::Encoding
Encoding
Definition: v8.h:2961
V8_DEPRECATE_SOON
#define V8_DEPRECATE_SOON(message)
Definition: v8config.h:404
v8::ScriptCompiler::Source::GetResourceOptions
const V8_INLINE ScriptOriginOptions & GetResourceOptions() const
Definition: v8.h:11280
v8::WeakCallbackInfo::GetInternalField
V8_INLINE void * GetInternalField(int index) const
Definition: v8.h:10732
v8::HostImportModuleDynamicallyCallback
MaybeLocal< Promise >(* HostImportModuleDynamicallyCallback)(Local< Context > context, Local< ScriptOrModule > referrer, Local< String > specifier)
Definition: v8.h:7218
v8::Maybe< void >::operator!=
V8_INLINE bool operator!=(const Maybe &other) const
Definition: v8.h:9989
v8::TracedGlobal::TracedGlobal
V8_INLINE TracedGlobal(const TracedGlobal< S > &other)
Definition: v8.h:989
v8::SharedArrayBuffer
Definition: v8.h:5573
v8::String::Utf8Value::operator*
const char * operator*() const
Definition: v8.h:3288
v8::HandleScope
Definition: v8.h:1171
v8::HeapObjectStatistics::object_size
size_t object_size()
Definition: v8.h:7647
V8_UNLIKELY
#define V8_UNLIKELY(condition)
Definition: v8config.h:422
v8::HeapStatistics::external_memory
size_t external_memory()
Definition: v8.h:7589
v8::MaybeLocal
Definition: v8.h:92
v8::PromiseRejectEvent
PromiseRejectEvent
Definition: v8.h:7270
v8::CrashKeyId::kIsolateAddress
@ kIsolateAddress
v8::Maybe::operator==
V8_INLINE bool operator==(const Maybe &other) const
Definition: v8.h:9946
v8::ArrayBuffer::Cast
static V8_INLINE ArrayBuffer * Cast(Value *obj)
Definition: v8.h:11693
v8::GCCallback
void(* GCCallback)(GCType type, GCCallbackFlags flags)
Definition: v8.h:7533
v8::FunctionCallbackInfo::This
V8_INLINE Local< Object > This() const
Definition: v8.h:11161
v8::kNoGCCallbackFlags
@ kNoGCCallbackFlags
Definition: v8.h:7524
v8::Global::Pass
Global Pass()
Definition: v8.h:796
v8::kGCCallbackFlagForced
@ kGCCallbackFlagForced
Definition: v8.h:7526
v8::String::ExternalOneByteStringResource
Definition: v8.h:3142
v8::PromiseHook
void(* PromiseHook)(PromiseHookType type, Local< Promise > promise, Local< Value > parent)
Definition: v8.h:7266
cppgc::Persistent
internal::BasicPersistent< T, internal::StrongPersistentPolicy > Persistent
Definition: persistent.h:290
v8::ScriptCompiler::Source
Definition: v8.h:1661
v8::Name
Definition: v8.h:2916
v8::JitCodeEvent::CODE_START_LINE_INFO_RECORDING
@ CODE_START_LINE_INFO_RECORDING
Definition: v8.h:7684
v8::RegExp::Flags
Flags
Definition: v8.h:5880
v8::PERFORMANCE_RESPONSE
@ PERFORMANCE_RESPONSE
Definition: v8.h:7771
v8::Maybe::FromMaybe
V8_INLINE T FromMaybe(const T &default_value) const
Definition: v8.h:9942
cppgc::internal::Abort
V8_EXPORT void Abort()
v8::String::Value::operator*
const uint16_t * operator*() const
Definition: v8.h:3311
v8::Int16Array::Cast
static V8_INLINE Int16Array * Cast(Value *obj)
Definition: v8.h:11741
v8::Number
Definition: v8.h:3444
v8::ResourceConstraints::set_code_range_size_in_bytes
void set_code_range_size_in_bytes(size_t limit)
Definition: v8.h:7048
v8::FunctionCallbackInfo::NewTarget
V8_INLINE Local< Value > NewTarget() const
Definition: v8.h:11178
v8::UnwindState::code_range
MemoryRange code_range
Definition: v8.h:2218
v8::ReturnValue::GetIsolate
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:11117
v8::Local::operator!=
V8_INLINE bool operator!=(const Persistent< S > &that) const
Definition: v8.h:261
v8::Function::NewInstance
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewInstance(Local< Context > context) const
Definition: v8.h:4452
v8::PersistentBase::AnnotateStrongRetainer
V8_INLINE void AnnotateStrongRetainer(const char *label)
Definition: v8.h:10824
v8::NumberObject
Definition: v8.h:5796
v8::DcheckErrorCallback
void(* DcheckErrorCallback)(const char *file, int line, const char *message)
Definition: v8.h:7133
v8::KeyConversionMode::kConvertToString
@ kConvertToString
v8::Uint16Array::Cast
static V8_INLINE Uint16Array * Cast(Value *obj)
Definition: v8.h:11733
v8::ACCESS_KEYS
@ ACCESS_KEYS
Definition: v8.h:6300
v8::ReturnValue::SetUndefined
V8_INLINE void SetUndefined()
Definition: v8.h:11103
v8::Isolate::CreateParams::array_buffer_allocator
ArrayBuffer::Allocator * array_buffer_allocator
Definition: v8.h:8190
v8::Local::As
V8_INLINE Local< S > As() const
Definition: v8.h:286
v8::Object::CreationContext
static V8_INLINE Local< Context > CreationContext(const PersistentBase< Object > &object)
Definition: v8.h:4025
v8::Context::BackupIncumbentScope::JSStackComparableAddress
uintptr_t JSStackComparableAddress() const
Definition: v8.h:10459
v8::NamedPropertyHandlerConfiguration::NamedPropertyHandlerConfiguration
NamedPropertyHandlerConfiguration(GenericNamedPropertyGetterCallback getter, GenericNamedPropertySetterCallback setter, GenericNamedPropertyDescriptorCallback descriptor, GenericNamedPropertyDeleterCallback deleter, GenericNamedPropertyEnumeratorCallback enumerator, GenericNamedPropertyDefinerCallback definer, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
Definition: v8.h:6606
v8::NamedPropertyHandlerConfiguration::setter
GenericNamedPropertySetterCallback setter
Definition: v8.h:6626
v8::MicrotasksScope
Definition: v8.h:7403
v8::ReturnValue::Set
V8_INLINE void Set(const Global< S > &handle)
v8::Data
Definition: v8.h:1291
v8::TracedGlobal::TracedGlobal
V8_INLINE TracedGlobal(TracedGlobal< S > &&other)
Definition: v8.h:972
v8::ModifyCodeGenerationFromStringsCallback
ModifyCodeGenerationFromStringsResult(* ModifyCodeGenerationFromStringsCallback)(Local< Context > context, Local< Value > source)
Definition: v8.h:7465
v8::Local::Clear
V8_INLINE void Clear()
Definition: v8.h:212
v8::MemoryPressureLevel::kModerate
@ kModerate
v8::Undefined
V8_INLINE Local< Primitive > Undefined(Isolate *isolate)
Definition: v8.h:11874
v8::ResourceConstraints::initial_old_generation_size_in_bytes
size_t initial_old_generation_size_in_bytes() const
Definition: v8.h:7076
v8::JitCodeEvent::CODE_ADDED
@ CODE_ADDED
Definition: v8.h:7680
v8::ScriptCompiler::Source::Source
V8_INLINE Source(Local< String > source_string, const ScriptOrigin &origin, CachedData *cached_data=nullptr)
Definition: v8.h:11254
v8::IntegrityLevel::kFrozen
@ kFrozen
v8::Isolate::GetNumberOfDataSlots
static V8_INLINE uint32_t GetNumberOfDataSlots()
Definition: v8.h:11922
v8::HeapStatistics::total_physical_size
size_t total_physical_size()
Definition: v8.h:7582
v8::Uint32Array::Cast
static V8_INLINE Uint32Array * Cast(Value *obj)
Definition: v8.h:11749
v8::UnboundScript
Definition: v8.h:1405
v8::AccessorGetterCallback
void(* AccessorGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3571
v8::Date::Cast
static V8_INLINE Date * Cast(Value *obj)
Definition: v8.h:11577
v8::WeakCallbackInfo::GetIsolate
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:439
v8::String::ExternalStringResourceBase
Definition: v8.h:3053
v8::ScriptOriginOptions::IsWasm
bool IsWasm() const
Definition: v8.h:1352
v8::Local::Local
V8_INLINE Local(Local< S > that)
Definition: v8.h:194
v8::NamedPropertyHandlerConfiguration
Definition: v8.h:6566
v8::Value::IsNullOrUndefined
V8_INLINE bool IsNullOrUndefined() const
Definition: v8.h:11467
v8::Isolate::CreateParams::code_event_handler
JitCodeEventHandler code_event_handler
Definition: v8.h:8153
v8::SerializeInternalFieldsCallback::SerializeInternalFieldsCallback
SerializeInternalFieldsCallback(CallbackFunction function=nullptr, void *data_arg=nullptr)
Definition: v8.h:8035
v8::GlobalValueMap
Definition: v8-util.h:424
v8::Int16Array
Definition: v8.h:5440
v8::TracedGlobal::TracedGlobal
V8_INLINE TracedGlobal(TracedGlobal &&other)
Definition: v8.h:963
v8::ScriptCompiler::kNoCacheBecauseExtensionModule
@ kNoCacheBecauseExtensionModule
Definition: v8.h:1814
v8::CounterLookupCallback
int *(* CounterLookupCallback)(const char *name)
Definition: v8.h:7174
v8::IndexedPropertyDescriptorCallback
void(* IndexedPropertyDescriptorCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:6289
v8::JitCodeEvent::wasm_source_info_t::filename
const char * filename
Definition: v8.h:7736
v8::DEFAULT
@ DEFAULT
Definition: v8.h:3599
v8::DeserializeEmbedderFieldsCallback
DeserializeInternalFieldsCallback DeserializeEmbedderFieldsCallback
Definition: v8.h:8059
v8::Eternal::Set
V8_INLINE void Set(Isolate *isolate, Local< S > handle)
v8::kPromiseRejectWithNoHandler
@ kPromiseRejectWithNoHandler
Definition: v8.h:7271
v8::WeakCallbackType::kInternalFields
@ kInternalFields
v8::False
V8_INLINE Local< Boolean > False(Isolate *isolate)
Definition: v8.h:11901
v8::PERFORMANCE_IDLE
@ PERFORMANCE_IDLE
Definition: v8.h:7778
v8::SideEffectType::kHasSideEffectToReceiver
@ kHasSideEffectToReceiver
v8::ATOMICS_WAIT
@ ATOMICS_WAIT
Definition: v8.h:2185
v8::kJitCodeEventDefault
@ kJitCodeEventDefault
Definition: v8.h:7788
v8::JitCodeEvent::EventType
EventType
Definition: v8.h:7679
v8::Local::Local
V8_INLINE Local()
Definition: v8.h:192
v8::JitCodeEvent::code_start
void * code_start
Definition: v8.h:7706
v8::Extension::~Extension
virtual ~Extension()
Definition: v8.h:6950
v8::PERFORMANCE_LOAD
@ PERFORMANCE_LOAD
Definition: v8.h:7781
v8::NamedPropertyHandlerConfiguration::enumerator
GenericNamedPropertyEnumeratorCallback enumerator
Definition: v8.h:6629
v8::EmbedderHeapTracer::TracedGlobalHandleVisitor::VisitTracedGlobalHandle
virtual void VisitTracedGlobalHandle(const TracedGlobal< Value > &handle)
Definition: v8.h:7862
v8::UnboundModuleScript
Definition: v8.h:1436
v8::LogEventCallback
void(* LogEventCallback)(const char *name, int event)
Definition: v8.h:7140
v8::PropertyHandlerFlags::kNone
@ kNone
v8::TracedReferenceBase::WrapperClassId
V8_INLINE uint16_t WrapperClassId() const
Definition: v8.h:11001
v8::TracedGlobal::TracedGlobal
TracedGlobal(Isolate *isolate, Local< S > that)
Definition: v8.h:954
v8::Local::Cast
static V8_INLINE Local< T > Cast(Local< S > that)
Definition: v8.h:271
v8::BeforeCallEnteredCallback
void(* BeforeCallEnteredCallback)(Isolate *)
Definition: v8.h:7195
v8::kGCTypeMarkSweepCompact
@ kGCTypeMarkSweepCompact
Definition: v8.h:7502
v8::Integer::New
static Local< Integer > New(Isolate *isolate, int32_t value)
v8::GC
@ GC
Definition: v8.h:2179
v8::PersistentBase::WrapperClassId
V8_INLINE uint16_t WrapperClassId() const
Definition: v8.h:10840
v8::AccessorNameSetterCallback
void(* AccessorNameSetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
Definition: v8.h:3583
v8::GCType
GCType
Definition: v8.h:7500
v8::PersistentValueMapBase
Definition: v8-util.h:160
v8::Persistent::operator=
V8_INLINE Persistent & operator=(const Persistent< S, M2 > &that)
Definition: v8.h:701
v8::WasmModuleObject
Definition: v8.h:4783
v8::CrashKeyId::kReadonlySpaceFirstPageAddress
@ kReadonlySpaceFirstPageAddress
v8::BooleanObject
Definition: v8.h:5826
V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
Definition: v8.h:4934
v8::TracedGlobal::TracedGlobal
V8_INLINE TracedGlobal(const TracedGlobal &other)
Definition: v8.h:980
v8::ApiImplementationCallback
void(* ApiImplementationCallback)(const FunctionCallbackInfo< Value > &)
Definition: v8.h:7476
v8::HeapSpaceStatistics::space_size
size_t space_size()
Definition: v8.h:7625
v8::SharedArrayBuffer::Contents::AllocationBase
void * AllocationBase() const
Definition: v8.h:5598
v8::HeapObjectStatistics::object_count
size_t object_count()
Definition: v8.h:7646
v8::HeapStatistics::number_of_detached_contexts
size_t number_of_detached_contexts()
Definition: v8.h:7592
v8::Global::MoveOnlyTypeForCPP03
void MoveOnlyTypeForCPP03
Definition: v8.h:801
v8::Template::Set
void Set(Local< Name > name, Local< Data > value, PropertyAttribute attributes=None)
v8::Module::Status
Status
Definition: v8.h:1468
v8::JitCodeEvent::CODE_REMOVED
@ CODE_REMOVED
Definition: v8.h:7682
v8::JitCodeEvent::wasm_source_info_t
Definition: v8.h:7734
v8::Global::operator=
V8_INLINE Global & operator=(Global< S > &&rhs)
v8::ValueDeserializer::Delegate
Definition: v8.h:2385
v8::ArrayBufferCreationMode::kExternalized
@ kExternalized
v8::Location::Location
Location(int line_number, int column_number)
Definition: v8.h:1448
v8::HeapSpaceStatistics::physical_space_size
size_t physical_space_size()
Definition: v8.h:7628
v8::SymbolObject::Cast
static V8_INLINE SymbolObject * Cast(Value *obj)
Definition: v8.h:11593
v8::Value::IsUndefined
V8_INLINE bool IsUndefined() const
Definition: v8.h:11432
v8::IndexedPropertyEnumeratorCallback
void(* IndexedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Definition: v8.h:6276
v8::JitCodeEvent::user_data
void * user_data
Definition: v8.h:7715
v8::ExtensionConfiguration::ExtensionConfiguration
ExtensionConfiguration(int name_count, const char *names[])
Definition: v8.h:10182
v8::SymbolObject
Definition: v8.h:5858
v8::Uint32::Cast
static V8_INLINE Uint32 * Cast(v8::Value *obj)
Definition: v8.h:11563
v8::ResourceConstraints::max_young_generation_size_in_bytes
size_t max_young_generation_size_in_bytes() const
Definition: v8.h:7069
v8::PropertyHandlerFlags::kAllCanRead
@ kAllCanRead
v8::MemoryPressureLevel
MemoryPressureLevel
Definition: v8.h:7837
v8::SerializeInternalFieldsCallback
Definition: v8.h:8032
v8::WeakCallbackInfo::GetParameter
V8_INLINE T * GetParameter() const
Definition: v8.h:440
v8::ONLY_ENUMERABLE
@ ONLY_ENUMERABLE
Definition: v8.h:3611
v8::Global::Global
V8_INLINE Global(Isolate *isolate, Local< S > that)
Definition: v8.h:764
v8::SharedArrayBuffer::Contents::DeleterData
void * DeleterData() const
Definition: v8.h:5607
v8::kGCTypeIncrementalMarking
@ kGCTypeIncrementalMarking
Definition: v8.h:7503
v8::JitCodeEvent::wasm_source_info_t::filename_size
size_t filename_size
Definition: v8.h:7738
v8::MicrotaskQueue
Definition: v8.h:7326
v8::MicrotasksCompletedCallback
void(* MicrotasksCompletedCallback)(Isolate *)
Definition: v8.h:7297
v8::PersistentBase::Empty
V8_INLINE void Empty()
Definition: v8.h:501
v8::Persistent::Persistent
V8_INLINE Persistent(Isolate *isolate, const Persistent< S, M2 > &that)
Definition: v8.h:679
v8::Uint8ClampedArray
Definition: v8.h:5389
v8::StartupData
Definition: v8.h:9494
v8::MaybeLocal::FromMaybe
V8_INLINE Local< S > FromMaybe(Local< S > default_value) const
Definition: v8.h:393
v8::ScriptOriginOptions::IsOpaque
bool IsOpaque() const
Definition: v8.h:1351
v8::ACCESS_GET
@ ACCESS_GET
Definition: v8.h:6296
v8::FunctionTemplate
Definition: v8.h:6420
v8::CreateHistogramCallback
void *(* CreateHistogramCallback)(const char *name, int min, int max, size_t buckets)
Definition: v8.h:7176
v8::ArrayBufferView::Cast
static V8_INLINE ArrayBufferView * Cast(Value *obj)
Definition: v8.h:11701
v8::PropertyDescriptor
Definition: v8.h:4645
v8::SnapshotCreator
Definition: v8.h:9791
v8::Uint8Array::Cast
static V8_INLINE Uint8Array * Cast(Value *obj)
Definition: v8.h:11717
v8::ResourceConstraints::set_initial_old_generation_size_in_bytes
void set_initial_old_generation_size_in_bytes(size_t initial_size)
Definition: v8.h:7079
V8_INLINE
#define V8_INLINE
Definition: v8config.h:359
v8::PropertyHandlerFlags::kOnlyInterceptStrings
@ kOnlyInterceptStrings
v8::TracedGlobal::SetFinalizationCallback
V8_INLINE void SetFinalizationCallback(void *parameter, WeakCallbackInfo< void >::Callback callback)
Definition: v8.h:11010
v8::PersistentBase::operator==
V8_INLINE bool operator==(const PersistentBase< S > &that) const
Definition: v8.h:508
v8::ValueSerializer::Delegate
Definition: v8.h:2265
v8::NamedPropertyHandlerConfiguration::definer
GenericNamedPropertyDefinerCallback definer
Definition: v8.h:6630
v8::internal::ShouldThrowOnError
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate *isolate)
v8::AddCrashKeyCallback
void(* AddCrashKeyCallback)(CrashKeyId id, const std::string &value)
Definition: v8.h:7192
v8::Context::BackupIncumbentScope
Definition: v8.h:10445
v8::kGCTypeProcessWeakCallbacks
@ kGCTypeProcessWeakCallbacks
Definition: v8.h:7504
v8::AccessorSetterCallback
void(* AccessorSetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
Definition: v8.h:3579
v8::NonCopyablePersistentTraits::kResetInDestructor
static const bool kResetInDestructor
Definition: v8.h:623
v8::ArrayBuffer::Contents::ByteLength
size_t ByteLength() const
Definition: v8.h:5119
v8::Maybe::To
V8_WARN_UNUSED_RESULT V8_INLINE bool To(T *out) const
Definition: v8.h:9924
v8::CopyablePersistentTraits
Definition: v8.h:638
v8::JitCodeEventHandler
void(* JitCodeEventHandler)(const JitCodeEvent *event)
Definition: v8.h:7799
v8::ScriptOrigin::HostDefinedOptions
V8_INLINE Local< PrimitiveArray > HostDefinedOptions() const
Definition: v8.h:11235
v8::EmbedderHeapTracer::TraceFlags
TraceFlags
Definition: v8.h:7850
v8::AddHistogramSampleCallback
void(* AddHistogramSampleCallback)(void *histogram, int sample)
Definition: v8.h:7181
v8::PropertyDescriptor::get_private
PrivateData * get_private() const
Definition: v8.h:4681
v8::KeyConversionMode
KeyConversionMode
Definition: v8.h:3652
v8::NamedPropertyHandlerConfiguration::NamedPropertyHandlerConfiguration
NamedPropertyHandlerConfiguration(GenericNamedPropertyGetterCallback getter=nullptr, GenericNamedPropertySetterCallback setter=nullptr, GenericNamedPropertyQueryCallback query=nullptr, GenericNamedPropertyDeleterCallback deleter=nullptr, GenericNamedPropertyEnumeratorCallback enumerator=nullptr, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
Definition: v8.h:6587
v8::PromiseHookType
PromiseHookType
Definition: v8.h:7264
v8::Maybe
Definition: v8.h:60
v8::MemoryRange
Definition: v8.h:2208
v8::RegisterState::sp
void * sp
Definition: v8.h:2194
v8::Persistent::operator=
V8_INLINE Persistent & operator=(const Persistent &that)
Definition: v8.h:696
v8::NamedPropertyHandlerConfiguration::query
GenericNamedPropertyQueryCallback query
Definition: v8.h:6627
v8::Object::Cast
static V8_INLINE Object * Cast(Value *obj)
Definition: v8.h:11631
v8::ReturnValue::ReturnValue
friend class ReturnValue
Definition: v8.h:4245
v8::kGCTypeAll
@ kGCTypeAll
Definition: v8.h:7505
v8::BigUint64Array
Definition: v8.h:5540
v8::kGCCallbackFlagConstructRetainedObjectInfos
@ kGCCallbackFlagConstructRetainedObjectInfos
Definition: v8.h:7525
v8::internal::kSmiMaxValue
const int kSmiMaxValue
Definition: v8-internal.h:134
v8::ArrayBuffer::Contents::Deleter
DeleterCallback Deleter() const
Definition: v8.h:5120
v8::WeakCallbackInfo
Definition: v8.h:426
v8::internal::SmiValuesAre31Bits
constexpr bool SmiValuesAre31Bits()
Definition: v8-internal.h:135
v8::kGCTypeScavenge
@ kGCTypeScavenge
Definition: v8.h:7501
v8::DontEnum
@ DontEnum
Definition: v8.h:3561
v8::MeasureMemoryDelegate
Definition: v8.h:8082
v8::Integer::Cast
static V8_INLINE Integer * Cast(v8::Value *obj)
Definition: v8.h:11547
v8::String::Value::length
int length() const
Definition: v8.h:3312
v8::FunctionCallback
void(* FunctionCallback)(const FunctionCallbackInfo< Value > &info)
Definition: v8.h:4430
v8::Persistent::Persistent
V8_INLINE Persistent(const Persistent &that)
Definition: v8.h:689
v8::EXTERNAL
@ EXTERNAL
Definition: v8.h:2184
v8::TracedGlobal
Definition: v8.h:101
v8::HeapStatistics::malloced_memory
size_t malloced_memory()
Definition: v8.h:7588
v8::ONLY_CONFIGURABLE
@ ONLY_CONFIGURABLE
Definition: v8.h:3612
v8::TracedReferenceBase::operator==
V8_INLINE bool operator==(const Local< S > &that) const
Definition: v8.h:868
v8::ObjectTemplate::Cast
static V8_INLINE ObjectTemplate * Cast(Data *data)
Definition: v8.h:11301
v8::PersistentBase::SetWeak
V8_INLINE void SetWeak()
Definition: v8.h:10812
v8::WeakCallbackObject
Definition: v8.h:112
v8::PropertyHandlerFlags
PropertyHandlerFlags
Definition: v8.h:6537
v8::ScriptOrigin::ResourceColumnOffset
V8_INLINE Local< Integer > ResourceColumnOffset() const
Definition: v8.h:11244
v8::WasmThreadsEnabledCallback
bool(* WasmThreadsEnabledCallback)(Local< Context > context)
Definition: v8.h:7482
v8::Object
Definition: v8.h:3662
v8::SerializeInternalFieldsCallback::data
void * data
Definition: v8.h:8039
v8::TracedReferenceBase::Get
Local< T > Get(Isolate *isolate) const
Definition: v8.h:856
v8::AccessControl
AccessControl
Definition: v8.h:3598
v8::StackTrace
Definition: v8.h:2059
v8::MemoryPressureLevel::kCritical
@ kCritical
v8::SideEffectType::kHasNoSideEffect
@ kHasNoSideEffect
v8::ScriptCompiler::kNoCacheBecauseCachingDisabled
@ kNoCacheBecauseCachingDisabled
Definition: v8.h:1805
v8::Extension::set_auto_enable
void set_auto_enable(bool value)
Definition: v8.h:6963
v8::kGCCallbackFlagSynchronousPhantomCallbackProcessing
@ kGCCallbackFlagSynchronousPhantomCallbackProcessing
Definition: v8.h:7527
v8::TryCatch::JSStackComparableAddress
static void * JSStackComparableAddress(TryCatch *handler)
Definition: v8.h:10140
v8::KeyConversionMode::kNoNumbers
@ kNoNumbers
v8::JitCodeEvent::line_info_t
Definition: v8.h:7725
v8::Isolate::CreateParams::counter_lookup_callback
CounterLookupCallback counter_lookup_callback
Definition: v8.h:8170
v8::Global::Global
V8_INLINE Global(Isolate *isolate, const PersistentBase< S > &that)
Definition: v8.h:775
v8::Isolate::CreateParams::allow_atomics_wait
bool allow_atomics_wait
Definition: v8.h:8205
v8::NamedPropertyHandlerConfiguration::flags
PropertyHandlerFlags flags
Definition: v8.h:6633
v8::Persistent::Persistent
V8_INLINE Persistent(const Persistent< S, M2 > &that)
Definition: v8.h:693
v8::ArrayBufferCreationMode
ArrayBufferCreationMode
Definition: v8.h:4938
v8::NonCopyablePersistentTraits
Definition: v8.h:94
v8::ModifyCodeGenerationFromStringsResult::modified_source
MaybeLocal< String > modified_source
Definition: v8.h:7457
v8::IndexedPropertyHandlerConfiguration::data
Local< Value > data
Definition: v8.h:6702
v8::ExtensionCallback
bool(* ExtensionCallback)(const FunctionCallbackInfo< Value > &)
Definition: v8.h:7469
v8::FunctionCallbackInfo::GetIsolate
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:11190
v8::DeserializeInternalFieldsCallback
Definition: v8.h:8049
v8::PropertyCallbackInfo::Data
V8_INLINE Local< Value > Data() const
Definition: v8.h:11841
v8::IndexedPropertyHandlerConfiguration::IndexedPropertyHandlerConfiguration
IndexedPropertyHandlerConfiguration(IndexedPropertyGetterCallback getter=nullptr, IndexedPropertySetterCallback setter=nullptr, IndexedPropertyQueryCallback query=nullptr, IndexedPropertyDeleterCallback deleter=nullptr, IndexedPropertyEnumeratorCallback enumerator=nullptr, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
Definition: v8.h:6657
v8::IndexedPropertyHandlerConfiguration::descriptor
IndexedPropertyDescriptorCallback descriptor
Definition: v8.h:6701
v8::MicrotasksPolicy::kScoped
@ kScoped
v8::SharedArrayBuffer::Contents
Definition: v8.h:5584
v8::ALL_CAN_READ
@ ALL_CAN_READ
Definition: v8.h:3600
v8::ExtensionConfiguration::end
const char ** end() const
Definition: v8.h:10186
v8::ReturnValue::SetEmptyString
V8_INLINE void SetEmptyString()
Definition: v8.h:11110
v8::V8::Initialize
static V8_INLINE bool Initialize()
Definition: v8.h:9577
v8::GCCallbackFlags
GCCallbackFlags
Definition: v8.h:7523
v8::ONLY_WRITABLE
@ ONLY_WRITABLE
Definition: v8.h:3610
v8::PERFORMANCE_ANIMATION
@ PERFORMANCE_ANIMATION
Definition: v8.h:7775
v8::FunctionCallbackInfo::IsConstructCall
V8_INLINE bool IsConstructCall() const
Definition: v8.h:11202
v8::ALL_PROPERTIES
@ ALL_PROPERTIES
Definition: v8.h:3609
v8::ResourceConstraints::initial_young_generation_size_in_bytes
size_t initial_young_generation_size_in_bytes() const
Definition: v8.h:7083
v8::MicrotasksPolicy::kAuto
@ kAuto
v8::JSON
Definition: v8.h:2234
v8::Maybe::ToChecked
V8_INLINE T ToChecked() const
Definition: v8.h:9910
v8::SharedArrayBuffer::Contents::DeleterCallback
void(*)(void *buffer, size_t length, void *info) DeleterCallback
Definition: v8.h:5587
v8::Eternal
Definition: v8.h:93
v8::MicrotasksPolicy
MicrotasksPolicy
Definition: v8.h:7309
v8::SKIP_STRINGS
@ SKIP_STRINGS
Definition: v8.h:3613
v8::ArrayBuffer
Definition: v8.h:5021
v8::HeapStatistics::total_available_size
size_t total_available_size()
Definition: v8.h:7583
v8::ObjectTemplate::SetIndexedPropertyHandler
void SetIndexedPropertyHandler(IndexedPropertyGetterCallback getter, IndexedPropertySetterCallback setter=nullptr, IndexedPropertyQueryCallback query=nullptr, IndexedPropertyDeleterCallback deleter=nullptr, IndexedPropertyEnumeratorCallback enumerator=nullptr, Local< Value > data=Local< Value >())
Definition: v8.h:6799
v8::ArrayBuffer::Contents::Data
void * Data() const
Definition: v8.h:5118
v8::TracedReference::As
V8_INLINE TracedReference< S > & As() const
Definition: v8.h:1151
v8::Local::Traced
friend class Traced
Definition: v8.h:329
v8::Set::Cast
static V8_INLINE Set * Cast(Value *obj)
Definition: v8.h:11655
V8_DECL_INTRINSIC
#define V8_DECL_INTRINSIC(name, iname)
Definition: v8.h:5969
v8::MicrotaskCallback
void(* MicrotaskCallback)(void *data)
Definition: v8.h:7299
v8::JitCodeEvent::name_t
Definition: v8.h:7717
v8::DontDelete
@ DontDelete
Definition: v8.h:3563
v8::EscapableHandleScope
Definition: v8.h:1223
v8::PersistentBase::Isolate
friend class Isolate
Definition: v8.h:593
v8::Maybe::FromJust
V8_INLINE T FromJust() const
Definition: v8.h:9933
v8::ScriptOrigin::Options
V8_INLINE ScriptOriginOptions Options() const
Definition: v8.h:1390
v8::SharedMemoryStatistics::read_only_space_used_size
size_t read_only_space_used_size()
Definition: v8.h:7557
v8::Isolate::Scope::~Scope
~Scope()
Definition: v8.h:8232
v8::HeapObjectStatistics::object_sub_type
const char * object_sub_type()
Definition: v8.h:7645
v8::ACCESS_SET
@ ACCESS_SET
Definition: v8.h:6297
v8::Int8Array
Definition: v8.h:5406
v8::ScriptCompiler::kNoCacheBecauseResourceWithNoCacheHandler
@ kNoCacheBecauseResourceWithNoCacheHandler
Definition: v8.h:1817
v8::Global
Definition: v8.h:99
v8::WeakCallbackType::kParameter
@ kParameter
v8::internal::PerformCastCheck
V8_INLINE void PerformCastCheck(T *data)
Definition: v8-internal.h:422
v8::SKIP_SYMBOLS
@ SKIP_SYMBOLS
Definition: v8.h:3614
v8::TracedReferenceBase::operator==
V8_INLINE bool operator==(const TracedReferenceBase< S > &that) const
Definition: v8.h:859
v8::Isolate::CreateParams::CreateParams
CreateParams()
Definition: v8.h:8135
v8::NamedPropertyHandlerConfiguration::descriptor
GenericNamedPropertyDescriptorCallback descriptor
Definition: v8.h:6631
v8::ScriptCompiler::CachedData::BufferPolicy
BufferPolicy
Definition: v8.h:1628
v8::EmbedderHeapTracer::TraceSummary
Definition: v8.h:7870
v8::ScriptCompiler
Definition: v8.h:1618
v8::NumberObject::Cast
static V8_INLINE NumberObject * Cast(Value *obj)
Definition: v8.h:11601
v8::GenericNamedPropertyEnumeratorCallback
void(* GenericNamedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Definition: v8.h:6192
v8::NamedPropertyHandlerConfiguration::NamedPropertyHandlerConfiguration
NamedPropertyHandlerConfiguration(GenericNamedPropertyGetterCallback getter, GenericNamedPropertySetterCallback setter, GenericNamedPropertyQueryCallback query, GenericNamedPropertyDeleterCallback deleter, GenericNamedPropertyEnumeratorCallback enumerator, GenericNamedPropertyDefinerCallback definer, GenericNamedPropertyDescriptorCallback descriptor, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
Definition: v8.h:6567
v8::Isolate::CreateParams::external_references
const intptr_t * external_references
Definition: v8.h:8199
v8::KeyCollectionMode
KeyCollectionMode
Definition: v8.h:3640
v8::Local::Null
friend Local< Primitive > Null(Isolate *isolate)
Definition: v8.h:11883
v8::internal::Internals
Definition: v8-internal.h:157
v8::Module::kUninstantiated
@ kUninstantiated
Definition: v8.h:1469
v8::EmbedderHeapTracer::isolate
v8::Isolate * isolate() const
Definition: v8.h:8016
v8::IntegrityLevel
IntegrityLevel
Definition: v8.h:3657
v8::JSEntryStubs::js_run_microtasks_entry_stub
JSEntryStub js_run_microtasks_entry_stub
Definition: v8.h:2228
v8::ScriptCompiler::CachedData
Definition: v8.h:1627
v8::kPromiseHandlerAddedAfterReject
@ kPromiseHandlerAddedAfterReject
Definition: v8.h:7272
v8::ReturnAddressLocationResolver
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
Definition: v8.h:9527
v8::Int32::Cast
static V8_INLINE Int32 * Cast(v8::Value *obj)
Definition: v8.h:11555
v8::NearHeapLimitCallback
size_t(* NearHeapLimitCallback)(void *data, size_t current_heap_limit, size_t initial_heap_limit)
Definition: v8.h:7544
v8::SideEffectType::kHasSideEffect
@ kHasSideEffect
v8::Uint32Array
Definition: v8.h:5457
v8::JS
@ JS
Definition: v8.h:2178
v8::Persistent::~Persistent
V8_INLINE ~Persistent()
Definition: v8.h:710
v8::ArrayBuffer::Contents::DeleterCallback
void(*)(void *buffer, size_t length, void *info) DeleterCallback
Definition: v8.h:5101
v8::WeakCallbackType
WeakCallbackType
Definition: v8.h:464
v8::Value::IsNull
V8_INLINE bool IsNull() const
Definition: v8.h:11450
v8::HeapStatistics::does_zap_garbage
size_t does_zap_garbage()
Definition: v8.h:7598
v8::JSEntryStubs::js_entry_stub
JSEntryStub js_entry_stub
Definition: v8.h:2226
v8::Exception
Definition: v8.h:7146
v8::Function::kLineOffsetNotFound
static const int kLineOffsetNotFound
Definition: v8.h:4517
v8::MeasureMemoryMode
MeasureMemoryMode
Definition: v8.h:8066
v8::HeapSpaceStatistics::space_available_size
size_t space_available_size()
Definition: v8.h:7627
v8::WeakCallbackInfo::Callback
void(* Callback)(const WeakCallbackInfo< T > &data)
Definition: v8.h:428
v8::Object::GetAlignedPointerFromInternalField
V8_INLINE void * GetAlignedPointerFromInternalField(int index)
Definition: v8.h:11350
v8::ValueSerializer
Definition: v8.h:2263
v8::Locker
Definition: v8.h:10574
v8::Persistent::Persistent
V8_INLINE Persistent(Isolate *isolate, Local< S > that)
Definition: v8.h:669
v8::DataView::Cast
static V8_INLINE DataView * Cast(Value *obj)
Definition: v8.h:11802
v8::Uint8Array
Definition: v8.h:5372
v8::IndexedPropertyHandlerConfiguration::setter
IndexedPropertySetterCallback setter
Definition: v8.h:6696
v8::PropertyCallbackInfo
Definition: v8.h:116
v8::Uint32
Definition: v8.h:3487
v8::ScriptCompiler::kNoCacheBecauseScriptTooSmall
@ kNoCacheBecauseScriptTooSmall
Definition: v8.h:1811
v8::ScriptOriginOptions::IsSharedCrossOrigin
bool IsSharedCrossOrigin() const
Definition: v8.h:1348
v8::Maybe::operator!=
V8_INLINE bool operator!=(const Maybe &other) const
Definition: v8.h:9951
v8::ExtensionConfiguration
Definition: v8.h:10179
v8-version.h
v8::kPromiseRejectAfterResolved
@ kPromiseRejectAfterResolved
Definition: v8.h:7273
v8::ALL_CAN_WRITE
@ ALL_CAN_WRITE
Definition: v8.h:3601
v8::Isolate::SafeForTerminationScope
Definition: v8.h:8313
v8::JitCodeEvent::wasm_source_info
wasm_source_info_t * wasm_source_info
Definition: v8.h:7746
v8::Local::New
static V8_INLINE Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8.h:10684
v8::GenericNamedPropertySetterCallback
void(* GenericNamedPropertySetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:6134
v8::FunctionCallbackInfo
Definition: v8.h:115
v8::ScriptOriginOptions::IsModule
bool IsModule() const
Definition: v8.h:1353
v8::ConstructorBehavior::kAllow
@ kAllow
v8::Object::GetInternalField
V8_INLINE Local< Value > GetInternalField(int index)
Definition: v8.h:11322
v8::Local::False
friend Local< Boolean > False(Isolate *isolate)
Definition: v8.h:11901
v8::FunctionCallbackInfo::Data
V8_INLINE Local< Value > Data() const
Definition: v8.h:11184
v8::Function
Definition: v8.h:4437
cppgc::InitializePlatform
V8_EXPORT void InitializePlatform(PageAllocator *page_allocator)
v8::Context::Scope
Definition: v8.h:10429
v8::SampleInfo::external_callback_entry
void * external_callback_entry
Definition: v8.h:2203
v8::JSEntryStub::code
MemoryRange code
Definition: v8.h:2214
v8::PersistentBase::operator==
V8_INLINE bool operator==(const Local< S > &that) const
Definition: v8.h:517
v8::Isolate::GetData
V8_INLINE void * GetData(uint32_t slot)
Definition: v8.h:11916
v8::IDLE
@ IDLE
Definition: v8.h:2186
v8::kPromiseResolveAfterResolved
@ kPromiseResolveAfterResolved
Definition: v8.h:7274
v8::UnwindState::js_construct_entry_stub
JSEntryStub js_construct_entry_stub
Definition: v8.h:2221
v8::PromiseRejectMessage::GetPromise
V8_INLINE Local< Promise > GetPromise() const
Definition: v8.h:7283
v8::ScriptCompiler::NoCacheReason
NoCacheReason
Definition: v8.h:1803
v8::ScriptCompiler::kNoCacheBecauseNoResource
@ kNoCacheBecauseNoResource
Definition: v8.h:1806
v8config.h
v8::ScriptCompiler::CachedData::data
const uint8_t * data
Definition: v8.h:1648
v8::MaybeLocal::ToLocalChecked
V8_INLINE Local< T > ToLocalChecked()
Definition: v8.h:10725
v8::SharedArrayBuffer::Contents::AllocationMode
Allocator::AllocationMode AllocationMode() const
Definition: v8.h:5600
v8::Nothing
Maybe< T > Nothing()
Definition: v8.h:9969
v8::HostInitializeImportMetaObjectCallback
void(* HostInitializeImportMetaObjectCallback)(Local< Context > context, Local< Module > module, Local< Object > meta)
Definition: v8.h:7233
v8::GenericNamedPropertyQueryCallback
void(* GenericNamedPropertyQueryCallback)(Local< Name > property, const PropertyCallbackInfo< Integer > &info)
Definition: v8.h:6159
v8::Context::GetDataFromSnapshotOnce
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
v8::PersistentBase::Get
V8_INLINE Local< T > Get(Isolate *isolate) const
Definition: v8.h:503
v8::MessageCallback
void(* MessageCallback)(Local< Message > message, Local< Value > data)
Definition: v8.h:7136
v8::IndexedPropertyGetterCallback
void(* IndexedPropertyGetterCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:6244
v8::FunctionCallbackInfo::FunctionCallbackInfo
V8_INLINE FunctionCallbackInfo(internal::Address *implicit_args, internal::Address *values, int length)
Definition: v8.h:11143
v8::Value::Cast
static V8_INLINE Value * Cast(T *value)
v8::RAILMode
RAILMode
Definition: v8.h:7767
v8::EmbedderHeapTracer::TracePrologue
virtual void TracePrologue(TraceFlags flags)
Definition: v8.h:7917
v8::RegisterState::lr
void * lr
Definition: v8.h:2196
v8::Primitive
Definition: v8.h:2895
v8::PersistentBase::IsEmpty
V8_INLINE bool IsEmpty() const
Definition: v8.h:500
v8::Isolate::AdjustAmountOfExternalAllocatedMemory
V8_INLINE int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes)
Definition: v8.h:11934
V8_PROMISE_INTERNAL_FIELD_COUNT
#define V8_PROMISE_INTERNAL_FIELD_COUNT
Definition: v8.h:4526
v8::IndexedPropertyHandlerConfiguration::enumerator
IndexedPropertyEnumeratorCallback enumerator
Definition: v8.h:6699
v8::PrimitiveArray
Definition: v8.h:1325
v8::Boolean::New
static V8_INLINE Local< Boolean > New(Isolate *isolate, bool value)
Definition: v8.h:11284
v8::EmbedderHeapTracer::TracedGlobalHandleVisitor::VisitTracedReference
virtual void VisitTracedReference(const TracedReference< Value > &handle)
Definition: v8.h:7863
v8::ScriptCompiler::CachedData::length
int length
Definition: v8.h:1649
v8::Promise::Resolver
Definition: v8.h:4540
V8_EXPORT
#define V8_EXPORT
Definition: v8config.h:467
v8::Persistent
Definition: v8.h:97
v8::JSEntryStubs
Definition: v8.h:2225
v8::TracedReference::TracedReference
V8_INLINE TracedReference(const TracedReference &other)
Definition: v8.h:1106
v8::RegisterState::fp
void * fp
Definition: v8.h:2195
v8::ScriptOriginOptions::ScriptOriginOptions
V8_INLINE ScriptOriginOptions(int flags)
Definition: v8.h:1344
v8::MicrotasksCompletedCallbackWithData
void(* MicrotasksCompletedCallbackWithData)(Isolate *, void *)
Definition: v8.h:7298
v8::Signature::Cast
static V8_INLINE Signature * Cast(Data *data)
Definition: v8.h:11308
v8::ScriptOriginOptions::ScriptOriginOptions
V8_INLINE ScriptOriginOptions(bool is_shared_cross_origin=false, bool is_opaque=false, bool is_wasm=false, bool is_module=false)
Definition: v8.h:1338
v8::String::Utf8Value::length
int length() const
Definition: v8.h:3289
v8::String::ExternalStringResourceBase::Dispose
virtual void Dispose()
Definition: v8.h:3077
v8::Maybe::IsJust
V8_INLINE bool IsJust() const
Definition: v8.h:9905
v8::ArrayBuffer::Contents
Definition: v8.h:5099
v8::JitCodeEvent::line_info_t::offset
size_t offset
Definition: v8.h:7727
v8::Script
Definition: v8.h:1592
v8::Message
Definition: v8.h:1964
v8::SharedMemoryStatistics::read_only_space_size
size_t read_only_space_size()
Definition: v8.h:7556
v8::ScriptCompiler::kNoCacheBecauseInlineScript
@ kNoCacheBecauseInlineScript
Definition: v8.h:1807
v8::PropertyHandlerFlags::kNonMasking
@ kNonMasking
v8::ArrayBuffer::Contents::AllocationLength
size_t AllocationLength() const
Definition: v8.h:5113
v8::Promise::Resolver::Cast
static V8_INLINE Resolver * Cast(Value *obj)
Definition: v8.h:11685
v8::ScriptCompiler::kNoCacheBecauseInDocumentWrite
@ kNoCacheBecauseInDocumentWrite
Definition: v8.h:1816
v8::JitCodeEvent::line_info_t::position_type
PositionType position_type
Definition: v8.h:7731
v8::internal::IsolateFromNeverReadOnlySpaceObject
V8_EXPORT internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
v8::Promise::Cast
static V8_INLINE Promise * Cast(Value *obj)
Definition: v8.h:11663
v8::None
@ None
Definition: v8.h:3557
v8::ModifyCodeGenerationFromStringsResult
Definition: v8.h:7451
v8::TracedGlobal::operator=
V8_INLINE TracedGlobal & operator=(TracedGlobal &&rhs)
Definition: v8.h:10919
v8::PersistentBase::ClearWeak
V8_INLINE void ClearWeak()
Definition: v8.h:565
v8::ResourceConstraints::set_max_old_generation_size_in_bytes
void set_max_old_generation_size_in_bytes(size_t limit)
Definition: v8.h:7060
v8::ExtensionConfiguration::begin
const char ** begin() const
Definition: v8.h:10185
v8::Isolate::CreateParams::create_histogram_callback
CreateHistogramCallback create_histogram_callback
Definition: v8.h:8178
v8::Object::InternalFieldCount
static V8_INLINE int InternalFieldCount(const PersistentBase< Object > &object)
Definition: v8.h:3891
v8::IndexedPropertyHandlerConfiguration::getter
IndexedPropertyGetterCallback getter
Definition: v8.h:6695
v8::SnapshotCreator::FunctionCodeHandling
FunctionCodeHandling
Definition: v8.h:9793
v8::SharedArrayBuffer::Contents::AllocationLength
size_t AllocationLength() const
Definition: v8.h:5599
v8::String::GetExternalStringResourceBase
V8_INLINE ExternalStringResourceBase * GetExternalStringResourceBase(Encoding *encoding_out) const
Definition: v8.h:11408
v8::ScriptCompiler::kNoCacheBecausePacScript
@ kNoCacheBecausePacScript
Definition: v8.h:1815
v8::StringObject
Definition: v8.h:5842
v8::MemorySpan
Definition: v8.h:4726
v8::Context::EmbedderDataFields
EmbedderDataFields
Definition: v8.h:10325
v8::BackingStore
Definition: v8.h:4953
v8::External::Cast
static V8_INLINE External * Cast(Value *obj)
Definition: v8.h:11826
v8::SampleInfo::vm_state
StateTag vm_state
Definition: v8.h:2202
cppgc::EmbedderStackState
EmbedderStackState
Definition: common.h:14
v8::SampleInfo
Definition: v8.h:2200
v8::Extension::dependencies
const char ** dependencies() const
Definition: v8.h:6962
v8::Isolate::UseCounterFeature
UseCounterFeature
Definition: v8.h:8341
v8::FunctionCallbackInfo::values_
internal::Address * values_
Definition: v8.h:4313
v8::ReadOnly
@ ReadOnly
Definition: v8.h:3559
v8::String::Value
Definition: v8.h:3306
v8::TracedReferenceBase::operator!=
V8_INLINE bool operator!=(const Local< S > &that) const
Definition: v8.h:882
v8::String::ExternalStringResourceBase::Lock
virtual void Lock() const
Definition: v8.h:3090
v8::OwnedBuffer::OwnedBuffer
OwnedBuffer(std::unique_ptr< const uint8_t[]> buffer, size_t size)
Definition: v8.h:4749
v8::Number::New
static Local< Number > New(Isolate *isolate, double value)
v8::NewStringType::kInternalized
@ kInternalized
v8::ExternalResourceVisitor
Definition: v8.h:7812
v8::JSEntryStub
Definition: v8.h:2213
v8::IndexedPropertyHandlerConfiguration
Definition: v8.h:6637
v8::Uint8ClampedArray::Cast
static V8_INLINE Uint8ClampedArray * Cast(Value *obj)
Definition: v8.h:11794
v8::Module::kEvaluating
@ kEvaluating
Definition: v8.h:1472
v8::Context
Definition: v8.h:10197
v8::NewStringType
NewStringType
Definition: v8.h:2939
v8::ReturnValue::SetNull
V8_INLINE void SetNull()
Definition: v8.h:11096
v8::Isolate
Definition: v8.h:8129
v8::HeapObjectStatistics
Definition: v8.h:7641
v8::Local::operator==
V8_INLINE bool operator==(const Local< S > &that) const
Definition: v8.h:229
v8::kJitCodeEventEnumExisting
@ kJitCodeEventEnumExisting
Definition: v8.h:7790
v8::PromiseRejectMessage::GetValue
V8_INLINE Local< Value > GetValue() const
Definition: v8.h:7285
v8::Global::~Global
V8_INLINE ~Global()
Definition: v8.h:785
v8::UnwindState::js_entry_stub
JSEntryStub js_entry_stub
Definition: v8.h:2220
v8::TracedReferenceBase::SetWrapperClassId
V8_INLINE void SetWrapperClassId(uint16_t class_id)
Definition: v8.h:10992
v8::PromiseHookType::kInit
@ kInit
v8::WasmStreamingCallback
void(* WasmStreamingCallback)(const FunctionCallbackInfo< Value > &)
Definition: v8.h:7479
v8::Isolate::kFullGarbageCollection
@ kFullGarbageCollection
Definition: v8.h:8332
v8::Eternal::Get
V8_INLINE Local< T > Get(Isolate *isolate) const
Definition: v8.h:10717
v8::TryCatch
Definition: v8.h:10011
v8::PropertyCallbackInfo::GetIsolate
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:11835
v8::Just
Maybe< T > Just(const T &t)
Definition: v8.h:9974
v8::OTHER
@ OTHER
Definition: v8.h:2183
v8::PromiseRejectMessage::GetEvent
V8_INLINE PromiseRejectEvent GetEvent() const
Definition: v8.h:7284
v8::ScriptCompiler::StreamedSource
Definition: v8.h:1755
v8::Name::Cast
static V8_INLINE Name * Cast(Value *obj)
Definition: v8.h:11515
v8::String::Utf8Value
Definition: v8.h:3283
v8::String::ExternalStringResource
Definition: v8.h:3109
v8::Persistent::Persistent
V8_INLINE Persistent()
Definition: v8.h:662
v8::WasmStreaming::Client
Definition: v8.h:4819
V8_LIKELY
#define V8_LIKELY(condition)
Definition: v8config.h:423
v8::ScriptCompiler::kNoCacheBecauseModule
@ kNoCacheBecauseModule
Definition: v8.h:1808
v8::FunctionCallbackInfo::Length
V8_INLINE int Length() const
Definition: v8.h:11208
v8::UnwindState::js_run_microtasks_entry_stub
JSEntryStub js_run_microtasks_entry_stub
Definition: v8.h:2222
v8::kGCCallbackScheduleIdleGarbageCollection
@ kGCCallbackScheduleIdleGarbageCollection
Definition: v8.h:7530
v8::Float32Array::Cast
static V8_INLINE Float32Array * Cast(Value *obj)
Definition: v8.h:11765
v8::PersistentBase::operator!=
V8_INLINE bool operator!=(const PersistentBase< S > &that) const
Definition: v8.h:526
v8::JitCodeEvent::script
Local< UnboundScript > script
Definition: v8.h:7710
v8::WeakCallbackInfo::WeakCallbackInfo
WeakCallbackInfo(Isolate *isolate, T *parameter, void *embedder_fields[kEmbedderFieldsInWeakCallback], Callback *callback)
Definition: v8.h:430
v8::Boolean::Cast
static V8_INLINE Boolean * Cast(v8::Value *obj)
Definition: v8.h:11507
v8::BYTECODE_COMPILER
@ BYTECODE_COMPILER
Definition: v8.h:2181
v8::String::NewFromUtf8
static V8_WARN_UNUSED_RESULT MaybeLocal< String > NewFromUtf8(Isolate *isolate, const char *data, NewStringType type=NewStringType::kNormal, int length=-1)
v8::WasmStreaming
Definition: v8.h:4812
v8::SharedMemoryStatistics::read_only_space_physical_size
size_t read_only_space_physical_size()
Definition: v8.h:7558
v8
Definition: libplatform.h:15
v8::JitCodeEvent::name_t::str
const char * str
Definition: v8.h:7720
v8::PersistentBase::PersistentBase
friend class PersistentBase
Definition: v8.h:599
v8::ResourceConstraints::stack_limit
uint32_t * stack_limit() const
Definition: v8.h:7040
v8::Local::Local
friend class Local
Definition: v8.h:306
v8::Module::kEvaluated
@ kEvaluated
Definition: v8.h:1473
v8::IndexedPropertySetterCallback
void(* IndexedPropertySetterCallback)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:6251
v8::Isolate::GarbageCollectionType
GarbageCollectionType
Definition: v8.h:8331
v8::ScriptOriginOptions
Definition: v8.h:1336
v8::FunctionCallbackInfo::implicit_args_
internal::Address * implicit_args_
Definition: v8.h:4312
v8::PROHIBITS_OVERWRITING
@ PROHIBITS_OVERWRITING
Definition: v8.h:3602
v8::Location::GetLineNumber
int GetLineNumber()
Definition: v8.h:1445
v8::Unwinder
Definition: v8.h:10611
v8::RegisterExtension
void V8_EXPORT RegisterExtension(std::unique_ptr< Extension >)
v8::ScriptOrigin
Definition: v8.h:1370
v8::kGCCallbackFlagCollectAllExternalMemory
@ kGCCallbackFlagCollectAllExternalMemory
Definition: v8.h:7529
v8::Context::GetEmbedderData
V8_INLINE Local< Value > GetEmbedderData(int index)
Definition: v8.h:11965
v8::FunctionCallbackInfo::GetReturnValue
V8_INLINE ReturnValue< T > GetReturnValue() const
Definition: v8.h:11196
cppgc::internal::operator==
bool operator==(BasicMember< T1, WeaknessTag1, WriteBarrierPolicy1, CheckingPolicy1 > member1, BasicMember< T2, WeaknessTag2, WriteBarrierPolicy2, CheckingPolicy2 > member2)
Definition: member.h:149
v8::internal::HeapSandboxIsEnabled
constexpr bool HeapSandboxIsEnabled()
Definition: v8-internal.h:113
v8::AllowWasmCodeGenerationCallback
bool(* AllowWasmCodeGenerationCallback)(Local< Context > context, Local< String > source)
Definition: v8.h:7471
v8::CopyablePersistentTraits::Copy
static V8_INLINE void Copy(const Persistent< S, M > &source, CopyablePersistent *dest)
Definition: v8.h:642
v8::ResourceConstraints::code_range_size_in_bytes
size_t code_range_size_in_bytes() const
Definition: v8.h:7047
v8::RegExp::Cast
static V8_INLINE RegExp * Cast(Value *obj)
Definition: v8.h:11623
v8::TracedGlobal::TracedGlobal
TracedGlobal()
Definition: v8.h:945
v8::NonCopyablePersistentTraits::NonCopyablePersistent
Persistent< T, NonCopyablePersistentTraits< T > > NonCopyablePersistent
Definition: v8.h:622
v8::HandleScope::CreateHandle
static internal::Address * CreateHandle(internal::Isolate *isolate, internal::Address value)
v8::PersistentBase::operator!=
V8_INLINE bool operator!=(const Local< S > &that) const
Definition: v8.h:531
v8::Eternal::Eternal
V8_INLINE Eternal()
Definition: v8.h:407
v8::FunctionCallbackInfo::Holder
V8_INLINE Local< Object > Holder() const
Definition: v8.h:11172
v8::PropertyFilter
PropertyFilter
Definition: v8.h:3608
v8::JitCodeEvent::CODE_ADD_LINE_POS_INFO
@ CODE_ADD_LINE_POS_INFO
Definition: v8.h:7683
v8::PromiseRejectCallback
void(* PromiseRejectCallback)(PromiseRejectMessage message)
Definition: v8.h:7293
v8::Local
Definition: v8.h:90
v8::TracedGlobal::Reset
V8_INLINE void Reset(Isolate *isolate, const Local< S > &other)
v8::Value::IsString
V8_INLINE bool IsString() const
Definition: v8.h:11485
v8::String::Utf8Value::operator*
char * operator*()
Definition: v8.h:3287
v8::internal::BackingStoreBase
Definition: v8-internal.h:428
v8::ScriptCompiler::ExternalSourceStream
Definition: v8.h:1704
v8::Maybe< void >
Definition: v8.h:9980
v8::BackingStore::DeleterCallback
void(*)(void *data, size_t length, void *deleter_data) DeleterCallback
Definition: v8.h:4990
v8::PersistentBase::Reset
V8_INLINE void Reset()
Definition: v8.h:10773
v8::MeasureMemoryMode::kSummary
@ kSummary
v8::ScriptCompiler::CompileOptions
CompileOptions
Definition: v8.h:1794
v8::AllowCodeGenerationFromStringsCallback
bool(* AllowCodeGenerationFromStringsCallback)(Local< Context > context, Local< String > source)
Definition: v8.h:7448
V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
Definition: v8.h:5289
v8::HeapStatistics::total_heap_size
size_t total_heap_size()
Definition: v8.h:7580
v8::MaybeLocal::IsEmpty
V8_INLINE bool IsEmpty() const
Definition: v8.h:370
v8::IntegrityLevel::kSealed
@ kSealed
v8::Isolate::Enter
void Enter()
v8::OwnedBuffer::buffer
std::unique_ptr< const uint8_t[]> buffer
Definition: v8.h:4747
v8::Extension::auto_enable
bool auto_enable()
Definition: v8.h:6964
v8::Array
Definition: v8.h:4118
v8::kGCCallbackFlagCollectAllAvailableGarbage
@ kGCCallbackFlagCollectAllAvailableGarbage
Definition: v8.h:7528
v8::Locker::Locker
V8_INLINE Locker(Isolate *isolate)
Definition: v8.h:10579
v8::ArrayBuffer::Contents::DeleterData
void * DeleterData() const
Definition: v8.h:5121
v8::BigIntObject::Cast
static V8_INLINE BigIntObject * Cast(Value *obj)
Definition: v8.h:11608
v8::JitCodeEvent::new_code_start
void * new_code_start
Definition: v8.h:7756
v8::Isolate::DisallowJavascriptExecutionScope
Definition: v8.h:8246
v8::Isolate::CreateParams::add_histogram_sample_callback
AddHistogramSampleCallback add_histogram_sample_callback
Definition: v8.h:8179
v8::ScriptCompiler::CachedData::rejected
bool rejected
Definition: v8.h:1650
v8::Persistent::As
V8_INLINE Persistent< S > & As() const
Definition: v8.h:727
v8::WasmModuleObjectBuilderStreaming
Definition: v8.h:4888
v8::KeyCollectionMode::kOwnOnly
@ kOwnOnly
v8::HandleScope::GetIsolate
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:1182
v8::IndexedPropertyHandlerConfiguration::IndexedPropertyHandlerConfiguration
IndexedPropertyHandlerConfiguration(IndexedPropertyGetterCallback getter, IndexedPropertySetterCallback setter, IndexedPropertyDescriptorCallback descriptor, IndexedPropertyDeleterCallback deleter, IndexedPropertyEnumeratorCallback enumerator, IndexedPropertyDefinerCallback definer, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
Definition: v8.h:6676
v8::BigIntObject
Definition: v8.h:5811
v8::RegisterState::pc
void * pc
Definition: v8.h:2193
v8::WasmSimdEnabledCallback
bool(* WasmSimdEnabledCallback)(Local< Context > context)
Definition: v8.h:7489
v8::ConstructorBehavior::kThrow
@ kThrow
v8::SharedArrayBuffer::Contents::Contents
Contents()
Definition: v8.h:5589
v8::ScriptCompiler::CachedData::buffer_policy
BufferPolicy buffer_policy
Definition: v8.h:1651
v8::NamedPropertyHandlerConfiguration::deleter
GenericNamedPropertyDeleterCallback deleter
Definition: v8.h:6628
v8::Date
Definition: v8.h:5775
v8::String::ExternalStringResourceBase::Unlock
virtual void Unlock() const
Definition: v8.h:3095
v8::Template
Definition: v8.h:5981
v8::Array::Cast
static V8_INLINE Array * Cast(Value *obj)
Definition: v8.h:11639
v8::StartupData::raw_size
int raw_size
Definition: v8.h:9504
v8::CrashKeyId
CrashKeyId
Definition: v8.h:7184
v8::StartupData::data
const char * data
Definition: v8.h:9503
v8::Persistent::Cast
static V8_INLINE Persistent< T > & Cast(const Persistent< S > &that)
Definition: v8.h:716
v8::Promise
Definition: v8.h:4532
V8_DEPRECATED
#define V8_DEPRECATED(message)
Definition: v8config.h:396
v8::ScriptCompiler::Source::GetCachedData
const V8_INLINE CachedData * GetCachedData() const
Definition: v8.h:11275
v8::HeapCodeStatistics::bytecode_and_metadata_size
size_t bytecode_and_metadata_size()
Definition: v8.h:7662
v8::GenericNamedPropertyDeleterCallback
void(* GenericNamedPropertyDeleterCallback)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info)
Definition: v8.h:6183
v8::CopyablePersistentTraits::kResetInDestructor
static const bool kResetInDestructor
Definition: v8.h:640
v8::HeapStatistics::number_of_native_contexts
size_t number_of_native_contexts()
Definition: v8.h:7591
v8::Symbol
Definition: v8.h:3349
v8::IndexFilter
IndexFilter
Definition: v8.h:3646
v8::Isolate::GetDataFromSnapshotOnce
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
v8::Platform
Definition: v8-platform.h:386
v8::Int32Array::Cast
static V8_INLINE Int32Array * Cast(Value *obj)
Definition: v8.h:11757
v8::ResourceConstraints::set_stack_limit
void set_stack_limit(uint32_t *value)
Definition: v8.h:7041
v8::CrashKeyId::kDumpType
@ kDumpType
v8::StackFrame
Definition: v8.h:2106
v8::JitCodeEvent::PositionType
PositionType
Definition: v8.h:7692
v8::GenericNamedPropertyDefinerCallback
void(* GenericNamedPropertyDefinerCallback)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:6215
v8::Isolate::SetData
V8_INLINE void SetData(uint32_t slot, void *data)
Definition: v8.h:11910
v8::WeakCallbackInfo::SetSecondPassCallback
void SetSecondPassCallback(Callback callback) const
Definition: v8.h:449
v8::Isolate::SuppressMicrotaskExecutionScope
Definition: v8.h:8289
v8::MeasureMemoryExecution::kDefault
@ kDefault
v8::Isolate::AllowJavascriptExecutionScope
Definition: v8.h:8268
v8::BooleanObject::Cast
static V8_INLINE BooleanObject * Cast(Value *obj)
Definition: v8.h:11615
v8::SharedMemoryStatistics
Definition: v8.h:7553
v8::HeapSpaceStatistics
Definition: v8.h:7621
v8::Float64Array
Definition: v8.h:5508
v8::OOMErrorCallback
void(* OOMErrorCallback)(const char *location, bool is_heap_oom)
Definition: v8.h:7131
v8::JitCodeEvent::CodeType
CodeType
Definition: v8.h:7700
v8::PromiseRejectMessage
Definition: v8.h:7277
v8::TracedGlobalTrait
Definition: v8.h:821
v8::Isolate::CreateParams::snapshot_blob
StartupData * snapshot_blob
Definition: v8.h:8163
v8::String::Value::operator*
uint16_t * operator*()
Definition: v8.h:3310
v8::MeasureMemoryExecution::kEager
@ kEager
v8::PropertyCallbackInfo::ShouldThrowOnError
V8_INLINE bool ShouldThrowOnError() const
Definition: v8.h:11864
v8::String::Empty
static V8_INLINE Local< String > Empty(Isolate *isolate)
Definition: v8.h:11378
v8::Symbol::Cast
static V8_INLINE Symbol * Cast(Value *obj)
Definition: v8.h:11523
v8::ScriptCompiler::kNoCacheBecauseStreamingSource
@ kNoCacheBecauseStreamingSource
Definition: v8.h:1809
common.h
v8::PARSER
@ PARSER
Definition: v8.h:2180
v8::PromiseHookType::kBefore
@ kBefore
v8::Isolate::DisallowJavascriptExecutionScope::OnFailure
OnFailure
Definition: v8.h:8248
v8::Context::Scope::Scope
V8_INLINE Scope(Local< Context > context)
Definition: v8.h:10431
v8::TracedReference::TracedReference
V8_INLINE TracedReference(TracedReference &&other)
Definition: v8.h:1087
v8::ScriptOrigin::ScriptID
V8_INLINE Local< Integer > ScriptID() const
Definition: v8.h:11249
v8::StateTag
StateTag
Definition: v8.h:2177
v8::MeasureMemoryExecution
MeasureMemoryExecution
Definition: v8.h:8074
v8::PropertyCallbackInfo::Holder
V8_INLINE Local< Object > Holder() const
Definition: v8.h:11853
v8::Module::kInstantiating
@ kInstantiating
Definition: v8.h:1470
v8::ArrayBuffer::Contents::AllocationBase
void * AllocationBase() const
Definition: v8.h:5112
v8::TracedReferenceBase::Reset
V8_INLINE void Reset()
Definition: v8.h:10886
v8::PromiseHookType::kAfter
@ kAfter
v8::AccessorSignature
Definition: v8.h:6924
v8::PersistentBase::Utils
friend class Utils
Definition: v8.h:594
v8::AccessType
AccessType
Definition: v8.h:6295
v8::Local::Undefined
friend Local< Primitive > Undefined(Isolate *isolate)
Definition: v8.h:11874
v8::FailedAccessCheckCallback
void(* FailedAccessCheckCallback)(Local< Object > target, AccessType type, Local< Value > data)
Definition: v8.h:7438
v8::String::ExternalStringResourceBase::IsCacheable
virtual bool IsCacheable() const
Definition: v8.h:3062
v8::BackingStoreDeleterCallback
void(*)(void *data, size_t length, void *deleter_data) BackingStoreDeleterCallback
Definition: v8.h:5014
v8::HeapSpaceStatistics::space_name
const char * space_name()
Definition: v8.h:7624
v8::PropertyCallbackInfo::This
V8_INLINE Local< Object > This() const
Definition: v8.h:11847
v8::BigInt
Definition: v8.h:3500
v8::HeapCodeStatistics::code_and_metadata_size
size_t code_and_metadata_size()
Definition: v8.h:7661
v8::DataView
Definition: v8.h:5556
v8::ExternalResourceVisitor::VisitExternalString
virtual void VisitExternalString(Local< String > string)
Definition: v8.h:7815
v8::ScriptCompiler::StreamedSource::Encoding
Encoding
Definition: v8.h:1757
v8::Maybe::Check
V8_INLINE void Check() const
Definition: v8.h:9916
v8::EscapableHandleScope::Escape
V8_INLINE Local< T > Escape(Local< T > value)
Definition: v8.h:1233
v8::Integer::NewFromUnsigned
static Local< Integer > NewFromUnsigned(Isolate *isolate, uint32_t value)
v8::MaybeLocal::ToLocal
V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local< S > *out) const
Definition: v8.h:377
v8::Extension
Definition: v8.h:6944
v8::PromiseRejectMessage::PromiseRejectMessage
PromiseRejectMessage(Local< Promise > promise, PromiseRejectEvent event, Local< Value > value)
Definition: v8.h:7279
v8::Object::GetAlignedPointerFromInternalField
static V8_INLINE void * GetAlignedPointerFromInternalField(const TracedReferenceBase< Object > &object, int index)
Definition: v8.h:3922
v8::IndexedPropertyDefinerCallback
void(* IndexedPropertyDefinerCallback)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:6282
v8::TypedArray
Definition: v8.h:5346
v8::EscapableHandleScope::EscapeMaybe
V8_INLINE MaybeLocal< T > EscapeMaybe(MaybeLocal< T > value)
Definition: v8.h:1240
v8::SealHandleScope
Definition: v8.h:1264
v8::EntropySource
bool(* EntropySource)(unsigned char *buffer, size_t length)
Definition: v8.h:9512
v8::ScriptCompiler::CachedData::CachedData
CachedData()
Definition: v8.h:1633
v8::TracedGlobal::~TracedGlobal
~TracedGlobal()
Definition: v8.h:940
v8::TracedReferenceBase
Definition: v8.h:105
v8::MemorySpan::size
constexpr size_t size() const
Definition: v8.h:4736
v8::Integer
Definition: v8.h:3458
v8-internal.h
v8::CompiledWasmModule
Definition: v8.h:4756
v8::Local::Utils
friend class Utils
Definition: v8.h:302
v8::Location::GetColumnNumber
int GetColumnNumber()
Definition: v8.h:1446
v8::Isolate::CreateParams::array_buffer_allocator_shared
std::shared_ptr< ArrayBuffer::Allocator > array_buffer_allocator_shared
Definition: v8.h:8191
v8::internal::kApiSystemPointerSize
const int kApiSystemPointerSize
Definition: v8-internal.h:32
v8::NamedPropertyHandlerConfiguration::getter
GenericNamedPropertyGetterCallback getter
Definition: v8.h:6625
v8::JSEntryStubs::js_construct_entry_stub
JSEntryStub js_construct_entry_stub
Definition: v8.h:2227
v8::GenericNamedPropertyGetterCallback
void(* GenericNamedPropertyGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:6110
v8::Function::Cast
static V8_INLINE Function * Cast(Value *obj)
Definition: v8.h:11818
v8::Isolate::TimeZoneDetection
TimeZoneDetection
Definition: v8.h:9449
v8::ResourceConstraints
Definition: v8.h:7002
v8::Isolate::CreateParams::embedder_wrapper_object_index
int embedder_wrapper_object_index
Definition: v8.h:8218
v8::PersistentBase::IsWeak
V8_INLINE bool IsWeak() const
Definition: v8.h:10764
v8::ArrayBuffer::Allocator
Definition: v8.h:5038
v8::ScriptCompiler::kNoCacheBecauseV8Extension
@ kNoCacheBecauseV8Extension
Definition: v8.h:1813
v8::AccessorNameGetterCallback
void(* AccessorNameGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3574
v8::SerializeEmbedderFieldsCallback
SerializeInternalFieldsCallback SerializeEmbedderFieldsCallback
Definition: v8.h:8043
v8::BigInt::Cast
static V8_INLINE BigInt * Cast(v8::Value *obj)
Definition: v8.h:11570
v8::FunctionCallbackInfo::length_
int length_
Definition: v8.h:4314
v8::KeyCollectionMode::kIncludePrototypes
@ kIncludePrototypes
v8::Number::Cast
static V8_INLINE Number * Cast(v8::Value *obj)
Definition: v8.h:11539
v8::Local::IsEmpty
V8_INLINE bool IsEmpty() const
Definition: v8.h:207
v8::ExtensionConfiguration::ExtensionConfiguration
ExtensionConfiguration()
Definition: v8.h:10181
v8::FunctionCallbackInfo::operator[]
V8_INLINE Local< Value > operator[](int i) const
Definition: v8.h:11149
v8::Isolate::Scope::Scope
Scope(Isolate *isolate)
Definition: v8.h:8228
v8::StackTrace::StackTraceOptions
StackTraceOptions
Definition: v8.h:2067
v8::Object::GetAlignedPointerFromInternalField
static V8_INLINE void * GetAlignedPointerFromInternalField(const PersistentBase< Object > &object, int index)
Definition: v8.h:3916
v8::CrashKeyId::kCodeSpaceFirstPageAddress
@ kCodeSpaceFirstPageAddress
v8::IndexedPropertyHandlerConfiguration::IndexedPropertyHandlerConfiguration
IndexedPropertyHandlerConfiguration(IndexedPropertyGetterCallback getter, IndexedPropertySetterCallback setter, IndexedPropertyQueryCallback query, IndexedPropertyDeleterCallback deleter, IndexedPropertyEnumeratorCallback enumerator, IndexedPropertyDefinerCallback definer, IndexedPropertyDescriptorCallback descriptor, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
Definition: v8.h:6638
v8::GenericNamedPropertyDescriptorCallback
void(* GenericNamedPropertyDescriptorCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:6238
v8::Private
Definition: v8.h:3408
v8::TracedReference::operator=
V8_INLINE TracedReference & operator=(TracedReference &&rhs)
Definition: v8.h:10969
v8::ScriptOrigin::ResourceName
V8_INLINE Local< Value > ResourceName() const
Definition: v8.h:11233
v8::COMPILER
@ COMPILER
Definition: v8.h:2182
v8::Module::kInstantiated
@ kInstantiated
Definition: v8.h:1471
v8::Uint16Array
Definition: v8.h:5423
v8::HeapStatistics
Definition: v8.h:7577
v8::Int32Array
Definition: v8.h:5474
v8::Isolate::CreateParams::only_terminate_in_safe_scope
bool only_terminate_in_safe_scope
Definition: v8.h:8210
v8::BigInt64Array
Definition: v8.h:5524
v8::PersistentBase
Definition: v8.h:95
v8::Boolean
Definition: v8.h:2902
v8::Isolate::MessageErrorLevel
MessageErrorLevel
Definition: v8.h:8457
v8::Extension::GetNativeFunctionTemplate
virtual Local< FunctionTemplate > GetNativeFunctionTemplate(Isolate *isolate, Local< String > name)
Definition: v8.h:6951
v8::HeapStatistics::total_global_handles_size
size_t total_global_handles_size()
Definition: v8.h:7584
v8::ResourceConstraints::set_max_young_generation_size_in_bytes
void set_max_young_generation_size_in_bytes(size_t limit)
Definition: v8.h:7072
v8::ACCESS_HAS
@ ACCESS_HAS
Definition: v8.h:6298
v8::MicrotasksPolicy::kExplicit
@ kExplicit
v8::Proxy
Definition: v8.h:4694
v8::PropertyCallbackInfo::GetReturnValue
V8_INLINE ReturnValue< T > GetReturnValue() const
Definition: v8.h:11859
v8::ScriptCompiler::Source::~Source
V8_INLINE ~Source()
Definition: v8.h:11270
v8::WeakCallbackType::kFinalizer
@ kFinalizer
v8::Float32Array
Definition: v8.h:5491
v8::Context::GetAlignedPointerFromEmbedderData
V8_INLINE void * GetAlignedPointerFromEmbedderData(int index)
Definition: v8.h:11991
v8::TracedReference::TracedReference
V8_INLINE TracedReference(const TracedReference< S > &other)
Definition: v8.h:1116
v8::Maybe::IsNothing
V8_INLINE bool IsNothing() const
Definition: v8.h:9904
v8::SerializeInternalFieldsCallback::callback
CallbackFunction callback
Definition: v8.h:8038
v8::Signature
Definition: v8.h:6905
v8::HeapStatistics::used_heap_size
size_t used_heap_size()
Definition: v8.h:7586
v8::JitCodeEvent::CODE_MOVED
@ CODE_MOVED
Definition: v8.h:7681
v8::Location
Definition: v8.h:1443
v8::CallCompletedCallback
void(* CallCompletedCallback)(Isolate *)
Definition: v8.h:7196
v8::InterruptCallback
void(* InterruptCallback)(Isolate *isolate, void *data)
Definition: v8.h:7535
v8::ScriptCompiler::kNoCacheBecauseInspector
@ kNoCacheBecauseInspector
Definition: v8.h:1810
v8::TracedReference::TracedReference
V8_INLINE TracedReference(TracedReference< S > &&other)
Definition: v8.h:1097
v8::MicrotasksScope::Type
Type
Definition: v8.h:7405
cppgc::ShutdownPlatform
V8_EXPORT void ShutdownPlatform()
v8::IndexedPropertyHandlerConfiguration::flags
PropertyHandlerFlags flags
Definition: v8.h:6703
v8::JitCodeEventOptions
JitCodeEventOptions
Definition: v8.h:7787
v8::Proxy::Cast
static V8_INLINE Proxy * Cast(Value *obj)
Definition: v8.h:11671
v8::MemorySpan::data
constexpr T * data() const
Definition: v8.h:4734
v8::ObjectTemplate
Definition: v8.h:6713
v8::HeapSpaceStatistics::space_used_size
size_t space_used_size()
Definition: v8.h:7626
v8::Promise::PromiseState
PromiseState
Definition: v8.h:4538
v8::TracedReference::Reset
V8_INLINE void Reset(Isolate *isolate, const Local< S > &other)
v8::internal::PointerCompressionIsEnabled
constexpr bool PointerCompressionIsEnabled()
Definition: v8-internal.h:109
v8::WasmLoadSourceMapCallback
Local< String >(* WasmLoadSourceMapCallback)(Isolate *isolate, const char *name)
Definition: v8.h:7485
v8::TracedReferenceBase::As
V8_INLINE TracedReferenceBase< S > & As() const
Definition: v8.h:898
v8::SharedArrayBuffer::Cast
static V8_INLINE SharedArrayBuffer * Cast(Value *obj)
Definition: v8.h:11810
v8::Isolate::AtomicsWaitEvent
AtomicsWaitEvent
Definition: v8.h:8827
v8::Extension::source
const String::ExternalOneByteStringResource * source() const
Definition: v8.h:6958
v8::SharedArrayBuffer::Contents::Deleter
DeleterCallback Deleter() const
Definition: v8.h:5606
v8::JitCodeEvent::wasm_source_info_t::line_number_table
const line_info_t * line_number_table
Definition: v8.h:7741
v8::PromiseHookType::kResolve
@ kResolve
v8::PersistentBase::SetWrapperClassId
V8_INLINE void SetWrapperClassId(uint16_t class_id)
Definition: v8.h:10830
v8::HeapStatistics::peak_malloced_memory
size_t peak_malloced_memory()
Definition: v8.h:7590
V8_INTRINSICS_LIST
#define V8_INTRINSICS_LIST(F)
Definition: v8.h:5959
v8::DeserializeInternalFieldsCallback::DeserializeInternalFieldsCallback
DeserializeInternalFieldsCallback(CallbackFunction function=nullptr, void *data_arg=nullptr)
Definition: v8.h:8052
v8::IndexedPropertyHandlerConfiguration::definer
IndexedPropertyDefinerCallback definer
Definition: v8.h:6700
v8::PrepareStackTraceCallback
MaybeLocal< Value >(* PrepareStackTraceCallback)(Local< Context > context, Local< Value > error, Local< Array > sites)
Definition: v8.h:7244
v8::Unlocker::Unlocker
V8_INLINE Unlocker(Isolate *isolate)
Definition: v8.h:10564
v8::Float64Array::Cast
static V8_INLINE Float64Array * Cast(Value *obj)
Definition: v8.h:11773
v8::Int32
Definition: v8.h:3473
v8::Isolate::AtomicsWaitWakeHandle
Definition: v8.h:8846
v8::MemorySpan::MemorySpan
constexpr MemorySpan(T *data, size_t size)
Definition: v8.h:4731
v8::Module
Definition: v8.h:1459
v8::TracedGlobal::As
V8_INLINE TracedGlobal< S > & As() const
Definition: v8.h:1030
v8::Local::operator==
V8_INLINE bool operator==(const PersistentBase< S > &that) const
Definition: v8.h:237
v8::ScriptOrigin::ScriptOrigin
V8_INLINE ScriptOrigin(Local< Value > resource_name, Local< Integer > resource_line_offset=Local< Integer >(), Local< Integer > resource_column_offset=Local< Integer >(), Local< Boolean > resource_is_shared_cross_origin=Local< Boolean >(), Local< Integer > script_id=Local< Integer >(), Local< Value > source_map_url=Local< Value >(), Local< Boolean > resource_is_opaque=Local< Boolean >(), Local< Boolean > is_wasm=Local< Boolean >(), Local< Boolean > is_module=Local< Boolean >(), Local< PrimitiveArray > host_defined_options=Local< PrimitiveArray >())
Definition: v8.h:11212
v8::ValueDeserializer
Definition: v8.h:2383
v8::Private::Cast
static V8_INLINE Private * Cast(Data *data)
Definition: v8.h:11531
v8::TracedReferenceBase::IsEmpty
bool IsEmpty() const
Definition: v8.h:845
v8::ScriptCompiler::CachedData::BufferNotOwned
@ BufferNotOwned
Definition: v8.h:1629
v8::TracedReferenceBase::operator!=
V8_INLINE bool operator!=(const TracedReferenceBase< S > &that) const
Definition: v8.h:877
v8::External
Definition: v8.h:5950
v8::RegisterState::RegisterState
RegisterState()
Definition: v8.h:2192
v8::ArrayBufferView
Definition: v8.h:5297
V8_WARN_UNUSED_RESULT
#define V8_WARN_UNUSED_RESULT
Definition: v8config.h:433
v8::Extension::dependency_count
int dependency_count() const
Definition: v8.h:6961
v8::Unlocker
Definition: v8.h:10559
v8::NewStringType::kNormal
@ kNormal
v8::Extension::source_length
size_t source_length() const
Definition: v8.h:6957
v8::Eternal::IsEmpty
V8_INLINE bool IsEmpty() const
Definition: v8.h:414
v8::JustVoid
Maybe< void > JustVoid()
Definition: v8.h:10006
v8::Local::operator*
V8_INLINE T * operator*() const
Definition: v8.h:216
v8::Context::Scope::~Scope
V8_INLINE ~Scope()
Definition: v8.h:10434
v8::JitCodeEvent::isolate
Isolate * isolate
Definition: v8.h:7759
v8::PersistentValueMap
Definition: v8-util.h:348
v8::ArrayBuffer::Contents::Contents
Contents()
Definition: v8.h:5103
v8::ArrayBuffer::Contents::AllocationMode
Allocator::AllocationMode AllocationMode() const
Definition: v8.h:5114
v8::StringObject::Cast
static V8_INLINE StringObject * Cast(Value *obj)
Definition: v8.h:11585
v8::HeapStatistics::heap_size_limit
size_t heap_size_limit()
Definition: v8.h:7587
v8::AccessorSignature::Cast
static V8_INLINE AccessorSignature * Cast(Data *data)
Definition: v8.h:11315
v8::JitCodeEvent::wasm_source_info_t::line_number_table_size
size_t line_number_table_size
Definition: v8.h:7743
v8::Isolate::CreateParams::constraints
ResourceConstraints constraints
Definition: v8.h:8158
v8::EmbedderHeapTracer::TracedGlobalHandleVisitor
Definition: v8.h:7859
v8::JitCodeEvent::code_type
CodeType code_type
Definition: v8.h:7704
v8::Int8Array::Cast
static V8_INLINE Int8Array * Cast(Value *obj)
Definition: v8.h:11725
v8::ReturnValue
Definition: v8.h:122
v8::CopyablePersistentTraits::CopyablePersistent
Persistent< T, CopyablePersistentTraits< T > > CopyablePersistent
Definition: v8.h:639
v8::PersistentValueVector
Definition: v8-util.h:571
v8::IndexedPropertyQueryCallback
void(* IndexedPropertyQueryCallback)(uint32_t index, const PropertyCallbackInfo< Integer > &info)
Definition: v8.h:6259
v8::ScriptOrigin::ResourceLineOffset
V8_INLINE Local< Integer > ResourceLineOffset() const
Definition: v8.h:11239
v8::String::WriteOptions
WriteOptions
Definition: v8.h:3017
v8::Global::Global
V8_INLINE Global()
Definition: v8.h:756
v8::IndexFilter::kSkipIndices
@ kSkipIndices
v8::PropertyAttribute
PropertyAttribute
Definition: v8.h:3555
v8::Isolate::DisallowJavascriptExecutionScope::THROW_ON_FAILURE
@ THROW_ON_FAILURE
Definition: v8.h:8248
v8::Object::InternalFieldCount
static V8_INLINE int InternalFieldCount(const TracedReferenceBase< Object > &object)
Definition: v8.h:3897
v8::HeapStatistics::used_global_handles_size
size_t used_global_handles_size()
Definition: v8.h:7585
v8::Local::operator!=
V8_INLINE bool operator!=(const Local< S > &that) const
Definition: v8.h:257
v8::BigInt64Array::Cast
static V8_INLINE BigInt64Array * Cast(Value *obj)
Definition: v8.h:11780
v8::TracedReference
Definition: v8.h:103
v8::Isolate::Scope
Definition: v8.h:8226
v8::Persistent::Persistent
friend class Persistent
Definition: v8.h:735
v8::EmbedderHeapTracer
Definition: v8.h:7846
v8::Extension::name
const char * name() const
Definition: v8.h:6956
v8::ScriptOrigin::SourceMapUrl
V8_INLINE Local< Value > SourceMapUrl() const
Definition: v8.h:11252
v8::SideEffectType
SideEffectType
Definition: v8.h:3627
v8::internal::CustomArguments
Definition: v8.h:129
v8::ReturnValue::Get
V8_INLINE Local< Value > Get() const
Definition: v8.h:11123
v8::internal::Address
uintptr_t Address
Definition: v8-internal.h:24
v8::ScriptCompiler::ScriptStreamingTask
Definition: v8.h:1781
v8::HeapCodeStatistics::external_script_source_size
size_t external_script_source_size()
Definition: v8.h:7663
v8::Set
Definition: v8.h:4180
v8::Local::operator->
V8_INLINE T * operator->() const
Definition: v8.h:214
v8::ConstructorBehavior
ConstructorBehavior
Definition: v8.h:4432
v8::IndexedPropertyHandlerConfiguration::query
IndexedPropertyQueryCallback query
Definition: v8.h:6697
v8::WasmModuleObject::Cast
static V8_INLINE WasmModuleObject * Cast(Value *obj)
Definition: v8.h:11678
v8::Local::True
friend Local< Boolean > True(Isolate *isolate)
Definition: v8.h:11892
v8::BigUint64Array::Cast
static V8_INLINE BigUint64Array * Cast(Value *obj)
Definition: v8.h:11787
v8::JitCodeEvent::code_len
size_t code_len
Definition: v8.h:7708
v8::PersistentHandleVisitor::VisitPersistentHandle
virtual void VisitPersistentHandle(Persistent< Value > *value, uint16_t class_id)
Definition: v8.h:7825
v8::HeapObjectStatistics::object_type
const char * object_type()
Definition: v8.h:7644
v8::DeserializeInternalFieldsCallback::data
void * data
Definition: v8.h:8057
v8::FunctionTemplate::Cast
static V8_INLINE FunctionTemplate * Cast(Data *data)
Definition: v8.h:11294
v8::PersistentBase::ClearWeak
V8_INLINE P * ClearWeak()
v8::FatalErrorCallback
void(* FatalErrorCallback)(const char *location, const char *message)
Definition: v8.h:7129
v8::RegExp
Definition: v8.h:5874
v8::PersistentHandleVisitor
Definition: v8.h:7822
v8::CFunction
Definition: v8-fast-api-calls.h:362
v8::String::Cast
static V8_INLINE String * Cast(v8::Value *obj)
Definition: v8.h:11370
v8::MaybeLocal::MaybeLocal
V8_INLINE MaybeLocal()
Definition: v8.h:363
v8::Map::Cast
static V8_INLINE Map * Cast(Value *obj)
Definition: v8.h:11647
v8::JitCodeEvent::line_info_t::pos
size_t pos
Definition: v8.h:7729
v8::Maybe< void >::IsJust
V8_INLINE bool IsJust() const
Definition: v8.h:9983
v8::Isolate::CreateParams::embedder_wrapper_type_index
int embedder_wrapper_type_index
Definition: v8.h:8217
v8::V8
Definition: v8.h:9534
v8::Value
Definition: v8.h:2483
v8::TracedReference::TracedReference
TracedReference(Isolate *isolate, Local< S > that)
Definition: v8.h:1077
v8::NamedPropertyHandlerConfiguration::data
Local< Value > data
Definition: v8.h:6632
v8::ScriptOrModule
Definition: v8.h:1302
v8::Isolate::CreateParams
Definition: v8.h:8134
v8::CompiledWasmModule::source_url
const std::string & source_url() const
Definition: v8.h:4769
v8::Maybe< void >::IsNothing
V8_INLINE bool IsNothing() const
Definition: v8.h:9982
v8::MaybeLocal::MaybeLocal
V8_INLINE MaybeLocal(Local< S > that)
Definition: v8.h:365
v8::SampleInfo::top_context
void * top_context
Definition: v8.h:2205
v8::NonCopyablePersistentTraits::Copy
static V8_INLINE void Copy(const Persistent< S, M > &source, NonCopyablePersistent *dest)
Definition: v8.h:625
v8::HeapStatistics::total_heap_size_executable
size_t total_heap_size_executable()
Definition: v8.h:7581
v8::UnwindState
Definition: v8.h:2217
v8::internal::Arguments
Definition: v8.h:127
v8::HeapCodeStatistics
Definition: v8.h:7658
v8::JitCodeEvent::type
EventType type
Definition: v8.h:7703
v8::RegisterState
Definition: v8.h:2191
v8::ResourceConstraints::set_initial_young_generation_size_in_bytes
void set_initial_young_generation_size_in_bytes(size_t initial_size)
Definition: v8.h:7086
v8::PropertyCallbackInfo::PropertyCallbackInfo
V8_INLINE PropertyCallbackInfo(internal::Address *args)
Definition: v8.h:4425
v8::SharedArrayBuffer::Contents::ByteLength
size_t ByteLength() const
Definition: v8.h:5605
v8::JitCodeEvent
Definition: v8.h:7678
v8::SharedArrayBuffer::Contents::Data
void * Data() const
Definition: v8.h:5604
v8::IndexedPropertyDeleterCallback
void(* IndexedPropertyDeleterCallback)(uint32_t index, const PropertyCallbackInfo< Boolean > &info)
Definition: v8.h:6266
v8::Map
Definition: v8.h:4144
v8::KeyConversionMode::kKeepNumbers
@ kKeepNumbers
v8::ArrayBuffer::Allocator::AllocationMode
AllocationMode
Definition: v8.h:5079
v8::String::GetExternalStringResource
V8_INLINE ExternalStringResource * GetExternalStringResource() const
Definition: v8.h:11387
v8::ScriptOriginOptions::Flags
int Flags() const
Definition: v8.h:1355
v8::AccessCheckCallback
bool(* AccessCheckCallback)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data)
Definition: v8.h:6308
v8::SampleInfo::frames_count
size_t frames_count
Definition: v8.h:2201
v8::HeapProfiler
Definition: v8-profiler.h:772
v8::ScriptCompiler::kNoCacheBecauseCacheTooCold
@ kNoCacheBecauseCacheTooCold
Definition: v8.h:1812
v8::String::NewFromUtf8Literal
static V8_WARN_UNUSED_RESULT Local< String > NewFromUtf8Literal(Isolate *isolate, const char(&literal)[N], NewStringType type=NewStringType::kNormal)
Definition: v8.h:3190
v8::CrashKeyId::kMapSpaceFirstPageAddress
@ kMapSpaceFirstPageAddress
v8::Intrinsic
Intrinsic
Definition: v8.h:5968
v8::IndexFilter::kIncludeIndices
@ kIncludeIndices
v8::MeasureMemoryMode::kDetailed
@ kDetailed
v8::ReturnValue::ReturnValue
V8_INLINE ReturnValue(const ReturnValue< S > &that)
Definition: v8.h:4212
v8::Maybe< void >::operator==
V8_INLINE bool operator==(const Maybe &other) const
Definition: v8.h:9985
v8::TracedReference::TracedReference
TracedReference()
Definition: v8.h:1068
v8::OwnedBuffer
Definition: v8.h:4746
v8::SnapshotCreator::AddData
V8_INLINE size_t AddData(Local< Context > context, Local< T > object)
v8::ResourceConstraints::max_old_generation_size_in_bytes
size_t max_old_generation_size_in_bytes() const
Definition: v8.h:7057
v8::String
Definition: v8.h:2956
v8::UnwindState::embedded_code_range
MemoryRange embedded_code_range
Definition: v8.h:2219