25 #include "v8-version.h" 38 #ifdef BUILDING_V8_SHARED 39 # define V8_EXPORT __declspec(dllexport) 41 # define V8_EXPORT __declspec(dllimport) 44 #endif // BUILDING_V8_SHARED 49 #if V8_HAS_ATTRIBUTE_VISIBILITY 50 # ifdef BUILDING_V8_SHARED 51 # define V8_EXPORT __attribute__ ((visibility("default"))) 66 class AccessorSignature;
78 class FunctionTemplate;
80 class ImplementationUtilities;
90 class ObjectOperationDescriptor;
97 class RawOperationDescriptor;
120 template <
class T,
class M = NonCopyablePersistentTraits<T> >
125 template <
class K,
class V,
class T>
127 template <
class K,
class V,
class T>
138 class CallHandlerHelper;
144 class DeferredHandles;
148 class LocalEmbedderHeapTracer;
150 struct ScriptStreamingData;
152 class PropertyCallbackArguments;
153 class FunctionCallbackArguments;
157 class CompilationResultResolver;
158 class StreamingDecoder;
164 const int kApiPointerSize =
sizeof(
void*);
165 const int kApiDoubleSize =
sizeof(double);
166 const int kApiIntSize =
sizeof(int);
167 const int kApiInt64Size =
sizeof(int64_t);
170 const int kHeapObjectTag = 1;
171 const int kWeakHeapObjectTag = 3;
172 const int kHeapObjectTagSize = 2;
173 const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1;
176 const int kSmiTag = 0;
177 const int kSmiTagSize = 1;
178 const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1;
180 template <
size_t tagged_ptr_size>
183 template <
int kSmiShiftSize>
184 V8_INLINE internal::Object* IntToSmi(
int value) {
185 int smi_shift_bits = kSmiTagSize + kSmiShiftSize;
186 intptr_t tagged_value =
187 (
static_cast<intptr_t
>(value) << smi_shift_bits) | kSmiTag;
188 return reinterpret_cast<internal::Object*
>(tagged_value);
194 enum { kSmiShiftSize = 0, kSmiValueSize = 31 };
195 static int SmiShiftSize() {
return kSmiShiftSize; }
196 static int SmiValueSize() {
return kSmiValueSize; }
197 V8_INLINE
static int SmiToInt(
const internal::Object* value) {
198 int shift_bits = kSmiTagSize + kSmiShiftSize;
200 return static_cast<int>(
reinterpret_cast<intptr_t
>(value)) >> shift_bits;
202 V8_INLINE
static internal::Object* IntToSmi(
int value) {
203 return internal::IntToSmi<kSmiShiftSize>(value);
205 V8_INLINE
static bool IsValidSmi(intptr_t value) {
217 return static_cast<uintptr_t
>(value) + 0x40000000U < 0x80000000U;
224 enum { kSmiShiftSize = 31, kSmiValueSize = 32 };
225 static int SmiShiftSize() {
return kSmiShiftSize; }
226 static int SmiValueSize() {
return kSmiValueSize; }
227 V8_INLINE
static int SmiToInt(
const internal::Object* value) {
228 int shift_bits = kSmiTagSize + kSmiShiftSize;
230 return static_cast<int>(
reinterpret_cast<intptr_t
>(value) >> shift_bits);
232 V8_INLINE
static internal::Object* IntToSmi(
int value) {
233 return internal::IntToSmi<kSmiShiftSize>(value);
235 V8_INLINE
static bool IsValidSmi(intptr_t value) {
237 return (value == static_cast<int32_t>(value));
241 #if V8_COMPRESS_POINTERS 243 kApiPointerSize == kApiInt64Size,
244 "Pointer compression can be enabled only for 64-bit architectures");
250 const int kSmiShiftSize = PlatformSmiTagging::kSmiShiftSize;
251 const int kSmiValueSize = PlatformSmiTagging::kSmiValueSize;
252 const int kSmiMinValue = (
static_cast<unsigned int>(-1)) << (kSmiValueSize - 1);
253 const int kSmiMaxValue = -(kSmiMinValue + 1);
254 constexpr
bool SmiValuesAre31Bits() {
return kSmiValueSize == 31; }
255 constexpr
bool SmiValuesAre32Bits() {
return kSmiValueSize == 32; }
260 class ConsoleCallArguments;
265 #define TYPE_CHECK(T, S) \ 267 *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \ 304 V8_INLINE Local() : val_(0) {}
307 : val_(reinterpret_cast<T*>(*that)) {
319 V8_INLINE
bool IsEmpty()
const {
return val_ == 0; }
324 V8_INLINE
void Clear() { val_ = 0; }
326 V8_INLINE T* operator->()
const {
return val_; }
328 V8_INLINE T* operator*()
const {
return val_; }
338 internal::Object** a =
reinterpret_cast<internal::Object**
>(this->val_);
339 internal::Object** b =
reinterpret_cast<internal::Object**
>(that.val_);
340 if (a == 0)
return b == 0;
341 if (b == 0)
return false;
347 internal::Object** a =
reinterpret_cast<internal::Object**
>(this->val_);
348 internal::Object** b =
reinterpret_cast<internal::Object**
>(that.val_);
349 if (a == 0)
return b == 0;
350 if (b == 0)
return false;
376 #ifdef V8_ENABLE_CHECKS 379 if (that.IsEmpty())
return Local<T>();
405 template<
class F>
friend class Eternal;
407 template<
class F,
class M>
friend class Persistent;
408 template<
class F>
friend class Local;
425 template <
class F1,
class F2,
class F3>
431 explicit V8_INLINE
Local(T* that) : val_(that) {}
432 V8_INLINE
static Local<T>
New(Isolate* isolate, T* that);
437 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS) 440 using Handle = Local<T>;
457 V8_INLINE MaybeLocal() : val_(nullptr) {}
459 V8_INLINE MaybeLocal(Local<S> that)
460 : val_(reinterpret_cast<T*>(*that)) {
464 V8_INLINE
bool IsEmpty()
const {
return val_ ==
nullptr; }
472 out->val_ = IsEmpty() ? nullptr : this->val_;
488 return IsEmpty() ? default_value :
Local<S>(val_);
499 template <
class T>
class Eternal {
501 V8_INLINE Eternal() : val_(nullptr) {}
503 V8_INLINE Eternal(Isolate* isolate, Local<S> handle) : val_(nullptr) {
504 Set(isolate, handle);
507 V8_INLINE Local<T> Get(Isolate* isolate)
const;
508 V8_INLINE
bool IsEmpty()
const {
return val_ ==
nullptr; }
509 template<
class S> V8_INLINE
void Set(Isolate* isolate, Local<S> handle);
516 static const int kInternalFieldsInWeakCallback = 2;
517 static const int kEmbedderFieldsInWeakCallback = 2;
519 template <
typename T>
525 void* embedder_fields[kEmbedderFieldsInWeakCallback],
527 : isolate_(isolate), parameter_(parameter), callback_(callback) {
528 for (
int i = 0; i < kEmbedderFieldsInWeakCallback; ++i) {
529 embedder_fields_[i] = embedder_fields[i];
533 V8_INLINE
Isolate* GetIsolate()
const {
return isolate_; }
534 V8_INLINE T* GetParameter()
const {
return parameter_; }
535 V8_INLINE
void* GetInternalField(
int index)
const;
543 void SetSecondPassCallback(Callback callback)
const { *callback_ = callback; }
549 void* embedder_fields_[kEmbedderFieldsInWeakCallback];
558 enum class WeakCallbackType { kParameter, kInternalFields, kFinalizer };
573 template <
class T>
class PersistentBase {
579 V8_INLINE
void Reset();
585 V8_INLINE
void Reset(Isolate* isolate,
const Local<S>& other);
592 V8_INLINE
void Reset(Isolate* isolate,
const PersistentBase<S>& other);
594 V8_INLINE
bool IsEmpty()
const {
return val_ == NULL; }
595 V8_INLINE
void Empty() { val_ = 0; }
597 V8_INLINE Local<T> Get(Isolate* isolate)
const {
602 V8_INLINE
bool operator==(
const PersistentBase<S>& that)
const {
603 internal::Object** a =
reinterpret_cast<internal::Object**
>(this->val_);
604 internal::Object** b =
reinterpret_cast<internal::Object**
>(that.val_);
605 if (a == NULL)
return b == NULL;
606 if (b == NULL)
return false;
611 V8_INLINE
bool operator==(
const Local<S>& that)
const {
612 internal::Object** a =
reinterpret_cast<internal::Object**
>(this->val_);
613 internal::Object** b =
reinterpret_cast<internal::Object**
>(that.val_);
614 if (a == NULL)
return b == NULL;
615 if (b == NULL)
return false;
620 V8_INLINE
bool operator!=(
const PersistentBase<S>& that)
const {
621 return !operator==(that);
625 V8_INLINE
bool operator!=(
const Local<S>& that)
const {
626 return !operator==(that);
636 template <
typename P>
637 V8_INLINE
void SetWeak(P* parameter,
638 typename WeakCallbackInfo<P>::Callback callback,
639 WeakCallbackType type);
651 V8_INLINE P* ClearWeak();
654 V8_INLINE
void ClearWeak() { ClearWeak<void>(); }
678 "Objects are always considered independent. " 679 "Use MarkActive to avoid collecting otherwise dead weak handles.",
680 V8_INLINE
void MarkIndependent());
692 V8_INLINE
bool IsIndependent()
const);
698 V8_INLINE
bool IsWeak()
const;
712 PersistentBase(
const PersistentBase& other) =
delete;
713 void operator=(
const PersistentBase&) =
delete;
716 friend class Isolate;
718 template<
class F>
friend class Local;
719 template<
class F1,
class F2>
friend class Persistent;
722 template<
class F>
friend class PersistentBase;
723 template<
class F>
friend class ReturnValue;
724 template <
class F1,
class F2,
class F3>
725 friend class PersistentValueMapBase;
726 template<
class F1,
class F2>
friend class PersistentValueVector;
729 explicit V8_INLINE PersistentBase(T* val) : val_(val) {}
730 V8_INLINE
static T* New(Isolate* isolate, T* that);
743 class NonCopyablePersistentTraits {
745 typedef Persistent<T, NonCopyablePersistentTraits<T> > NonCopyablePersistent;
746 static const bool kResetInDestructor =
false;
747 template<
class S,
class M>
748 V8_INLINE
static void Copy(
const Persistent<S, M>& source,
749 NonCopyablePersistent* dest) {
750 Uncompilable<Object>();
753 template<
class O> V8_INLINE
static void Uncompilable() {
754 TYPE_CHECK(O, Primitive);
766 static const bool kResetInDestructor =
true;
767 template<
class S,
class M>
804 template <
class S,
class M2>
818 template <
class S,
class M2>
826 template <
class S,
class M2>
827 V8_INLINE
Persistent& operator=(
const Persistent<S, M2>& that) {
837 if (M::kResetInDestructor) this->
Reset();
843 #ifdef V8_ENABLE_CHECKS 846 if (!that.IsEmpty()) T::Cast(*that);
853 V8_INLINE Persistent<S>& As()
const {
854 return Persistent<S>::Cast(*
this);
858 friend class Isolate;
860 template<
class F>
friend class Local;
861 template<
class F1,
class F2>
friend class Persistent;
862 template<
class F>
friend class ReturnValue;
864 explicit V8_INLINE
Persistent(T* that) : PersistentBase<T>(that) {}
865 V8_INLINE T* operator*()
const {
return this->val_; }
866 template<
class S,
class M2>
867 V8_INLINE
void Copy(
const Persistent<S, M2>& that);
877 class Global :
public PersistentBase<T> {
907 other.val_ =
nullptr;
918 this->val_ = rhs.val_;
931 typedef void MoveOnlyTypeForCPP03;
939 V8_INLINE T* operator*()
const {
return this->val_; }
945 using UniquePersistent = Global<T>;
971 static int NumberOfHandles(
Isolate* isolate);
973 V8_INLINE
Isolate* GetIsolate()
const {
974 return reinterpret_cast<Isolate*
>(isolate_);
983 void Initialize(
Isolate* isolate);
985 static internal::Object** CreateHandle(internal::Isolate* isolate,
986 internal::Object* value);
991 void*
operator new(
size_t size);
992 void*
operator new[](
size_t size);
993 void operator delete(
void*, size_t);
994 void operator delete[](
void*, size_t);
997 static internal::Object** CreateHandle(internal::HeapObject* heap_object,
998 internal::Object* value);
1000 internal::Isolate* isolate_;
1001 internal::Object** prev_next_;
1002 internal::Object** prev_limit_;
1005 template<
class F>
friend class Local;
1029 internal::Object** slot =
1030 Escape(reinterpret_cast<internal::Object**>(*value));
1031 return Local<T>(
reinterpret_cast<T*
>(slot));
1036 return Escape(value.FromMaybe(
Local<T>()));
1039 EscapableHandleScope(
const EscapableHandleScope&) =
delete;
1040 void operator=(
const EscapableHandleScope&) =
delete;
1045 void*
operator new(
size_t size);
1046 void*
operator new[](
size_t size);
1047 void operator delete(
void*, size_t);
1048 void operator delete[](
void*, size_t);
1050 internal::Object** Escape(internal::Object** escape_value);
1051 internal::Object** escape_slot_;
1070 void*
operator new(
size_t size);
1071 void*
operator new[](
size_t size);
1072 void operator delete(
void*, size_t);
1073 void operator delete[](
void*, size_t);
1075 internal::Isolate*
const isolate_;
1076 internal::Object** prev_limit_;
1077 int prev_sealed_level_;
1135 bool is_opaque =
false,
bool is_wasm =
false,
1136 bool is_module =
false)
1137 : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
1138 (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) |
1139 (is_module ? kIsModule : 0)) {}
1142 (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {}
1144 bool IsSharedCrossOrigin()
const {
1145 return (flags_ & kIsSharedCrossOrigin) != 0;
1147 bool IsOpaque()
const {
return (flags_ & kIsOpaque) != 0; }
1148 bool IsWasm()
const {
return (flags_ & kIsWasm) != 0; }
1149 bool IsModule()
const {
return (flags_ & kIsModule) != 0; }
1151 int Flags()
const {
return flags_; }
1155 kIsSharedCrossOrigin = 1,
1224 int GetLineNumber(
int code_pos);
1226 static const int kNoScriptId = 0;
1241 int GetLineNumber() {
return line_number_; }
1242 int GetColumnNumber() {
return column_number_; }
1244 Location(
int line_number,
int column_number)
1245 : line_number_(line_number), column_number_(column_number) {}
1276 Status GetStatus()
const;
1286 int GetModuleRequestsLength()
const;
1298 Location GetModuleRequestLocation(
int i)
const;
1303 int GetIdentityHash()
const;
1317 ResolveCallback callback);
1354 static V8_DEPRECATED(
"Use maybe version",
1370 V8_DEPRECATED(
"Use maybe version",
Local<Value> Run());
1402 buffer_policy(BufferNotOwned) {}
1409 BufferPolicy buffer_policy = BufferNotOwned);
1413 const uint8_t* data;
1416 BufferPolicy buffer_policy;
1438 V8_INLINE
const CachedData* GetCachedData()
const;
1494 virtual size_t GetMoreData(
const uint8_t** src) = 0;
1506 virtual bool SetBookmark();
1511 virtual void ResetToBookmark();
1523 enum Encoding { ONE_BYTE, TWO_BYTE, UTF8 };
1533 internal::ScriptStreamingData* impl()
const {
return impl_; }
1540 internal::ScriptStreamingData* impl_;
1550 virtual void Run() = 0;
1553 enum CompileOptions {
1554 kNoCompileOptions = 0,
1555 kProduceParserCache,
1556 kConsumeParserCache,
1558 kProduceFullCodeCache,
1567 kNoCacheNoReason = 0,
1568 kNoCacheBecauseCachingDisabled,
1569 kNoCacheBecauseNoResource,
1570 kNoCacheBecauseInlineScript,
1571 kNoCacheBecauseModule,
1572 kNoCacheBecauseStreamingSource,
1573 kNoCacheBecauseInspector,
1574 kNoCacheBecauseScriptTooSmall,
1575 kNoCacheBecauseCacheTooCold,
1576 kNoCacheBecauseV8Extension,
1577 kNoCacheBecauseExtensionModule,
1578 kNoCacheBecausePacScript,
1579 kNoCacheBecauseInDocumentWrite,
1580 kNoCacheBecauseResourceWithNoCacheHandler,
1581 kNoCacheBecauseDeferredProduceCodeCache
1598 Isolate* isolate, Source* source,
1599 CompileOptions options = kNoCompileOptions,
1600 NoCacheReason no_cache_reason = kNoCacheNoReason);
1615 CompileOptions options = kNoCompileOptions,
1616 NoCacheReason no_cache_reason = kNoCacheNoReason);
1629 static ScriptStreamingTask* StartStreamingScript(
1630 Isolate* isolate, StreamedSource* source,
1631 CompileOptions options = kNoCompileOptions);
1662 static uint32_t CachedDataVersionTag();
1672 Isolate* isolate, Source* source,
1673 CompileOptions options = kNoCompileOptions,
1674 NoCacheReason no_cache_reason = kNoCacheNoReason);
1686 static V8_DEPRECATED(
"Use maybe version",
1688 Isolate* isolate, Source* source,
1691 size_t context_extension_count,
1697 CompileOptions options = kNoCompileOptions,
1698 NoCacheReason no_cache_reason = kNoCacheNoReason);
1712 static CachedData* CreateCodeCache(
1715 V8_DEPRECATED(
"Source string is no longer required",
1716 static CachedData* CreateCodeCache(
1725 static CachedData* CreateCodeCacheForFunction(
Local<Function> function);
1727 V8_DEPRECATED(
"Source string is no longer required",
1728 static CachedData* CreateCodeCacheForFunction(
1733 Isolate* isolate, Source* source, CompileOptions options,
1734 NoCacheReason no_cache_reason);
1745 V8_DEPRECATED(
"Use maybe version",
Local<String> GetSourceLine()
const);
1771 V8_DEPRECATED(
"Use maybe version",
int GetLineNumber()
const);
1778 int GetStartPosition()
const;
1784 int GetEndPosition()
const;
1789 int ErrorLevel()
const;
1795 int GetStartColumn()
const;
1802 int GetEndColumn()
const;
1809 bool IsSharedCrossOrigin()
const;
1810 bool IsOpaque()
const;
1813 static void PrintCurrentStackTrace(
Isolate* isolate, FILE* out);
1815 static const int kNoLineNumberInfo = 0;
1816 static const int kNoColumnInfo = 0;
1817 static const int kNoScriptIdInfo = 0;
1836 kColumnOffset = 1 << 1 | kLineNumber,
1837 kScriptName = 1 << 2,
1838 kFunctionName = 1 << 3,
1840 kIsConstructor = 1 << 5,
1841 kScriptNameOrSourceURL = 1 << 6,
1843 kExposeFramesAcrossSecurityOrigins = 1 << 8,
1844 kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName,
1845 kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
1856 int GetFrameCount()
const;
1866 Isolate* isolate,
int frame_limit, StackTraceOptions options = kDetailed);
1881 int GetLineNumber()
const;
1890 int GetColumn()
const;
1898 int GetScriptId()
const;
1923 bool IsEval()
const;
1929 bool IsConstructor()
const;
1934 bool IsWasm()
const;
1961 size_t frames_count;
1963 void* external_callback_entry;
1979 static V8_DEPRECATE_SOON(
"Use the maybe version taking context",
2016 virtual void ThrowDataCloneError(
Local<String> message) = 0;
2051 virtual void* ReallocateBufferMemory(
void* old_buffer,
size_t size,
2052 size_t* actual_size);
2059 virtual void FreeBufferMemory(
void* buffer);
2081 V8_DEPRECATE_SOON(
"Use Release()", std::vector<uint8_t> ReleaseBuffer());
2089 V8_WARN_UNUSED_RESULT std::pair<uint8_t*, size_t> Release();
2096 void TransferArrayBuffer(uint32_t transfer_id,
2102 V8_DEPRECATE_SOON(
"Use Delegate::GetSharedArrayBufferId",
2103 void TransferSharedArrayBuffer(
2104 uint32_t transfer_id,
2114 void SetTreatArrayBufferViewsAsHostObjects(
bool mode);
2121 void WriteUint32(uint32_t value);
2122 void WriteUint64(uint64_t value);
2123 void WriteDouble(
double value);
2124 void WriteRawBytes(
const void* source,
size_t length);
2131 PrivateData* private_;
2160 Isolate* isolate, uint32_t transfer_id);
2167 Isolate* isolate, uint32_t clone_id);
2190 void TransferArrayBuffer(uint32_t transfer_id,
2198 void TransferSharedArrayBuffer(uint32_t
id,
2208 void SetSupportsLegacyWireFormat(
bool supports_legacy_wire_format);
2213 void SetExpectInlineWasm(
bool allow_inline_wasm);
2220 uint32_t GetWireFormatVersion()
const;
2227 V8_WARN_UNUSED_RESULT
bool ReadUint32(uint32_t* value);
2228 V8_WARN_UNUSED_RESULT
bool ReadUint64(uint64_t* value);
2229 V8_WARN_UNUSED_RESULT
bool ReadDouble(
double* value);
2230 V8_WARN_UNUSED_RESULT
bool ReadRawBytes(
size_t length,
const void** data);
2237 PrivateData* private_;
2253 V8_INLINE
bool IsUndefined()
const;
2259 V8_INLINE
bool IsNull()
const;
2266 V8_INLINE
bool IsNullOrUndefined()
const;
2271 bool IsTrue()
const;
2276 bool IsFalse()
const;
2281 bool IsName()
const;
2287 V8_INLINE
bool IsString()
const;
2292 bool IsSymbol()
const;
2297 bool IsFunction()
const;
2303 bool IsArray()
const;
2308 bool IsObject()
const;
2313 bool IsBigInt()
const;
2318 bool IsBoolean()
const;
2323 bool IsNumber()
const;
2328 bool IsExternal()
const;
2333 bool IsInt32()
const;
2338 bool IsUint32()
const;
2343 bool IsDate()
const;
2348 bool IsArgumentsObject()
const;
2353 bool IsBigIntObject()
const;
2358 bool IsBooleanObject()
const;
2363 bool IsNumberObject()
const;
2368 bool IsStringObject()
const;
2373 bool IsSymbolObject()
const;
2378 bool IsNativeError()
const;
2383 bool IsRegExp()
const;
2388 bool IsAsyncFunction()
const;
2393 bool IsGeneratorFunction()
const;
2398 bool IsGeneratorObject()
const;
2403 bool IsPromise()
const;
2418 bool IsMapIterator()
const;
2423 bool IsSetIterator()
const;
2428 bool IsWeakMap()
const;
2433 bool IsWeakSet()
const;
2438 bool IsArrayBuffer()
const;
2443 bool IsArrayBufferView()
const;
2448 bool IsTypedArray()
const;
2453 bool IsUint8Array()
const;
2458 bool IsUint8ClampedArray()
const;
2463 bool IsInt8Array()
const;
2468 bool IsUint16Array()
const;
2473 bool IsInt16Array()
const;
2478 bool IsUint32Array()
const;
2483 bool IsInt32Array()
const;
2488 bool IsFloat32Array()
const;
2493 bool IsFloat64Array()
const;
2498 bool IsBigInt64Array()
const;
2503 bool IsBigUint64Array()
const;
2508 bool IsDataView()
const;
2514 bool IsSharedArrayBuffer()
const;
2519 bool IsProxy()
const;
2521 bool IsWebAssemblyCompiledModule()
const;
2526 bool IsModuleNamespaceObject()
const;
2546 V8_DEPRECATE_SOON(
"Use maybe version",
2548 V8_DEPRECATE_SOON(
"Use maybe version",
2550 V8_DEPRECATE_SOON(
"Use maybe version",
2552 V8_DEPRECATE_SOON(
"Use maybe version",
2554 V8_DEPRECATE_SOON(
"Use maybe version",
2556 V8_DEPRECATE_SOON(
"Use maybe version",
2559 inline V8_DEPRECATE_SOON(
"Use maybe version",
2561 inline V8_DEPRECATE_SOON(
"Use maybe version",
Local<String> ToString()
const);
2562 inline V8_DEPRECATE_SOON(
"Use maybe version",
Local<Object> ToObject()
const);
2563 inline V8_DEPRECATE_SOON(
"Use maybe version",
2581 V8_DEPRECATE_SOON(
"Use maybe version",
bool BooleanValue()
const);
2582 V8_DEPRECATE_SOON(
"Use maybe version",
double NumberValue()
const);
2583 V8_DEPRECATE_SOON(
"Use maybe version", int64_t IntegerValue()
const);
2584 V8_DEPRECATE_SOON(
"Use maybe version", uint32_t Uint32Value()
const);
2585 V8_DEPRECATE_SOON(
"Use maybe version", int32_t Int32Value()
const);
2588 V8_DEPRECATE_SOON(
"Use maybe version",
bool Equals(
Local<Value> that)
const);
2594 template <
class T> V8_INLINE
static Value* Cast(T* value);
2601 V8_INLINE
bool QuickIsUndefined()
const;
2602 V8_INLINE
bool QuickIsNull()
const;
2603 V8_INLINE
bool QuickIsNullOrUndefined()
const;
2604 V8_INLINE
bool QuickIsString()
const;
2605 bool FullIsUndefined()
const;
2606 bool FullIsNull()
const;
2607 bool FullIsString()
const;
2644 int GetIdentityHash();
2646 V8_INLINE
static Name* Cast(
Value* obj);
2649 static void CheckCast(
Value* obj);
2677 static constexpr
int kMaxLength = internal::kApiPointerSize == 4
2679 : internal::kSmiMaxValue / 2 - 24;
2682 UNKNOWN_ENCODING = 0x1,
2683 TWO_BYTE_ENCODING = 0x0,
2684 ONE_BYTE_ENCODING = 0x8
2695 int Utf8Length()
const;
2703 bool IsOneByte()
const;
2710 bool ContainsOnlyOneByte()
const;
2739 HINT_MANY_WRITES_EXPECTED = 1,
2740 NO_NULL_TERMINATION = 2,
2741 PRESERVE_ONE_BYTE_NULL = 4,
2745 REPLACE_INVALID_UTF8 = 8
2749 int Write(uint16_t* buffer,
2752 int options = NO_OPTIONS)
const;
2754 int WriteOneByte(uint8_t* buffer,
2757 int options = NO_OPTIONS)
const;
2759 int WriteUtf8(
char* buffer,
2761 int* nchars_ref = NULL,
2762 int options = NO_OPTIONS)
const;
2772 bool IsExternal()
const;
2777 bool IsExternalOneByte()
const;
2783 virtual bool IsCompressible()
const {
return false; }
2801 friend class internal::Heap;
2823 virtual const uint16_t* data()
const = 0;
2828 virtual size_t length()
const = 0;
2853 virtual const char* data()
const = 0;
2855 virtual size_t length()
const = 0;
2865 V8_INLINE ExternalStringResourceBase* GetExternalStringResourceBase(
2866 Encoding* encoding_out)
const;
2872 V8_INLINE ExternalStringResource* GetExternalStringResource()
const;
2878 const ExternalOneByteStringResource* GetExternalOneByteStringResource()
const;
2880 V8_INLINE
static String* Cast(
v8::Value* obj);
2889 static V8_DEPRECATE_SOON(
2890 "Use maybe version",
2891 Local<String> NewFromUtf8(Isolate* isolate,
const char* data,
2897 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromUtf8(
2903 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromOneByte(
2908 static V8_DEPRECATE_SOON(
2909 "Use maybe version",
2910 Local<String> NewFromTwoByte(Isolate* isolate,
const uint16_t* data,
2916 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewFromTwoByte(
2924 static Local<String> Concat(Local<String> left, Local<String> right);
2934 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalTwoByte(
2935 Isolate* isolate, ExternalStringResource* resource);
2946 bool MakeExternal(ExternalStringResource* resource);
2956 static V8_DEPRECATE_SOON(
2957 "Use maybe version",
2958 Local<String> NewExternal(Isolate* isolate,
2959 ExternalOneByteStringResource* resource));
2960 static V8_WARN_UNUSED_RESULT MaybeLocal<String> NewExternalOneByte(
2961 Isolate* isolate, ExternalOneByteStringResource* resource);
2972 bool MakeExternal(ExternalOneByteStringResource* resource);
2977 bool CanMakeExternal();
2988 V8_DEPRECATED(
"Use Isolate version",
2992 char* operator*() {
return str_; }
2993 const char* operator*()
const {
return str_; }
2994 int length()
const {
return length_; }
2998 void operator=(
const Utf8Value&) =
delete;
3016 uint16_t* operator*() {
return str_; }
3017 const uint16_t* operator*()
const {
return str_; }
3018 int length()
const {
return length_; }
3022 void operator=(
const Value&) =
delete;
3031 Encoding encoding)
const;
3084 static void CheckCast(
Value* obj);
3122 static void CheckCast(
Data* that);
3131 double Value()
const;
3147 int64_t
Value()
const;
3160 int32_t
Value()
const;
3174 uint32_t
Value()
const;
3197 int word_count,
const uint64_t* words);
3205 uint64_t Uint64Value(
bool* lossless =
nullptr)
const;
3212 int64_t Int64Value(
bool* lossless =
nullptr)
const;
3218 int WordCount()
const;
3228 void ToWordsArray(
int* sign_bit,
int* word_count, uint64_t* words)
const;
3259 typedef void (*AccessorNameGetterCallback)(
3264 typedef void (*AccessorSetterCallback)(
3268 typedef void (*AccessorNameSetterCallback)(
3286 ALL_CAN_WRITE = 1 << 1,
3287 PROHIBITS_OVERWRITING = 1 << 2
3296 ONLY_ENUMERABLE = 2,
3297 ONLY_CONFIGURABLE = 4,
3342 V8_DEPRECATE_SOON(
"Use maybe version",
3347 V8_DEPRECATE_SOON(
"Use maybe version",
3372 V8_WARN_UNUSED_RESULT
Maybe<bool> DefineOwnProperty(
3396 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Value> Get(uint32_t index));
3414 V8_DEPRECATE_SOON(
"Use maybe version",
bool Has(
Local<Value> key));
3433 V8_DEPRECATE_SOON(
"Use maybe version",
bool Delete(
Local<Value> key));
3447 AccessorNameGetterCallback getter, AccessorNameSetterCallback setter = 0,
3450 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
3461 V8_WARN_UNUSED_RESULT
Maybe<bool> SetNativeDataProperty(
3463 AccessorNameGetterCallback getter,
3464 AccessorNameSetterCallback setter =
nullptr,
3466 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
3476 V8_WARN_UNUSED_RESULT
Maybe<bool> SetLazyDataProperty(
3480 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
3500 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Array> GetPropertyNames());
3513 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Array> GetOwnPropertyNames());
3567 int InternalFieldCount();
3572 return object.val_->InternalFieldCount();
3586 V8_INLINE
void* GetAlignedPointerFromInternalField(
int index);
3591 return object.val_->GetAlignedPointerFromInternalField(index);
3599 void SetAlignedPointerInInternalField(
int index,
void* value);
3600 void SetAlignedPointerInInternalFields(
int argc,
int indices[],
3612 V8_DEPRECATE_SOON(
"Use maybe version",
3629 V8_DEPRECATE_SOON(
"Use maybe version",
3630 bool HasRealIndexedProperty(uint32_t index));
3631 V8_WARN_UNUSED_RESULT
Maybe<bool> HasRealIndexedProperty(
3633 V8_DEPRECATE_SOON(
"Use maybe version",
3635 V8_WARN_UNUSED_RESULT
Maybe<bool> HasRealNamedCallbackProperty(
3651 GetRealNamedPropertyAttributesInPrototypeChain(
Local<Context> context,
3671 bool HasNamedLookupInterceptor();
3674 bool HasIndexedLookupInterceptor();
3683 int GetIdentityHash();
3700 return object.val_->CreationContext();
3713 bool IsConstructor();
3754 static void CheckCast(
Value* obj);
3756 void* SlowGetAlignedPointerFromInternalField(
int index);
3765 uint32_t Length()
const;
3776 static void CheckCast(
Value* obj);
3785 size_t Size()
const;
3808 V8_INLINE
static Map* Cast(
Value* obj);
3812 static void CheckCast(
Value* obj);
3821 size_t Size()
const;
3840 V8_INLINE
static Set* Cast(
Value* obj);
3844 static void CheckCast(
Value* obj);
3848 template<
typename T>
3852 : value_(that.value_) {
3856 template <
typename S>
3857 V8_INLINE V8_DEPRECATE_SOON(
"Use Global<> instead",
3858 void Set(
const Persistent<S>& handle));
3859 template <
typename S>
3860 V8_INLINE
void Set(
const Global<S>& handle);
3861 template <
typename S>
3862 V8_INLINE
void Set(
const Local<S> handle);
3864 V8_INLINE
void Set(
bool value);
3865 V8_INLINE
void Set(
double i);
3866 V8_INLINE
void Set(int32_t i);
3867 V8_INLINE
void Set(uint32_t i);
3869 V8_INLINE
void SetNull();
3870 V8_INLINE
void SetUndefined();
3871 V8_INLINE
void SetEmptyString();
3873 V8_INLINE Isolate* GetIsolate()
const;
3876 template <
typename S>
3877 V8_INLINE
void Set(S* whatever);
3882 V8_INLINE Local<Value> Get()
const;
3885 template<
class F>
friend class ReturnValue;
3886 template<
class F>
friend class FunctionCallbackInfo;
3887 template<
class F>
friend class PropertyCallbackInfo;
3888 template <
class F,
class G,
class H>
3889 friend class PersistentValueMapBase;
3890 V8_INLINE
void SetInternal(internal::Object* value) { *value_ = value; }
3891 V8_INLINE internal::Object* GetDefaultValue();
3892 V8_INLINE
explicit ReturnValue(internal::Object** slot);
3893 internal::Object** value_;
3903 template<
typename T>
3904 class FunctionCallbackInfo {
3907 V8_INLINE
int Length()
const;
3909 V8_INLINE Local<Value>
operator[](
int i)
const;
3911 V8_INLINE Local<Object>
This()
const;
3922 V8_INLINE Local<Object>
Holder()
const;
3924 V8_INLINE Local<Value>
NewTarget()
const;
3928 V8_INLINE Local<Value>
Data()
const;
3934 static const int kArgsLength = 6;
3937 friend class internal::FunctionCallbackArguments;
3938 friend class internal::CustomArguments<FunctionCallbackInfo>;
3939 friend class debug::ConsoleCallArguments;
3940 static const int kHolderIndex = 0;
3941 static const int kIsolateIndex = 1;
3942 static const int kReturnValueDefaultValueIndex = 2;
3943 static const int kReturnValueIndex = 3;
3944 static const int kDataIndex = 4;
3945 static const int kNewTargetIndex = 5;
3947 V8_INLINE FunctionCallbackInfo(internal::Object** implicit_args,
3948 internal::Object** values,
int length);
3949 internal::Object** implicit_args_;
3950 internal::Object** values_;
3959 template<
typename T>
3960 class PropertyCallbackInfo {
3972 V8_INLINE Local<Value>
Data()
const;
4015 V8_INLINE Local<Object>
This()
const;
4026 V8_INLINE Local<Object>
Holder()
const;
4048 static const int kArgsLength = 7;
4051 friend class MacroAssembler;
4052 friend class internal::PropertyCallbackArguments;
4053 friend class internal::CustomArguments<PropertyCallbackInfo>;
4054 static const int kShouldThrowOnErrorIndex = 0;
4055 static const int kHolderIndex = 1;
4056 static const int kIsolateIndex = 2;
4057 static const int kReturnValueDefaultValueIndex = 3;
4058 static const int kReturnValueIndex = 4;
4059 static const int kDataIndex = 5;
4060 static const int kThisIndex = 6;
4062 V8_INLINE PropertyCallbackInfo(internal::Object** args) : args_(args) {}
4063 internal::Object** args_;
4067 typedef void (*FunctionCallback)(
const FunctionCallbackInfo<Value>& info);
4069 enum class ConstructorBehavior { kThrow, kAllow };
4083 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
4084 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
4085 static V8_DEPRECATE_SOON(
4086 "Use maybe version",
4095 return NewInstance(context, 0,
nullptr);
4105 SideEffectType side_effect_type = SideEffectType::kHasSideEffect)
const;
4107 V8_DEPRECATE_SOON(
"Use maybe version",
4141 int GetScriptLineNumber()
const;
4146 int GetScriptColumnNumber()
const;
4151 int ScriptId()
const;
4161 static const int kLineOffsetNotFound;
4165 static void CheckCast(
Value* obj);
4168 #ifndef V8_PROMISE_INTERNAL_FIELD_COUNT 4170 #define V8_PROMISE_INTERNAL_FIELD_COUNT 0 4189 static V8_DEPRECATED(
"Use maybe version",
4203 V8_DEPRECATED(
"Use maybe version",
void Resolve(
Local<Value> value));
4207 V8_DEPRECATED(
"Use maybe version",
void Reject(
Local<Value> value));
4215 static void CheckCast(
Value* obj);
4249 static const int kEmbedderFieldCount = V8_PROMISE_INTERNAL_FIELD_COUNT;
4253 static void CheckCast(
Value* obj);
4301 bool has_value()
const;
4304 bool has_get()
const;
4306 bool has_set()
const;
4308 void set_enumerable(
bool enumerable);
4309 bool enumerable()
const;
4310 bool has_enumerable()
const;
4312 void set_configurable(
bool configurable);
4313 bool configurable()
const;
4314 bool has_configurable()
const;
4316 bool writable()
const;
4317 bool has_writable()
const;
4320 PrivateData* get_private()
const {
return private_; }
4326 PrivateData* private_;
4351 static void CheckCast(
Value* obj);
4358 typedef std::pair<std::unique_ptr<const uint8_t[]>,
size_t> SerializedModule;
4363 "Use BufferReference.",
4364 typedef std::pair<const uint8_t * COMMA size_t> CallerOwnedBuffer);
4371 const uint8_t* start;
4374 : start(start), size(size) {}
4377 "Use BufferReference directly.",
4379 V8_DEPRECATE_SOON(
"Use BufferReference directly.",
4380 inline operator CallerOwnedBuffer());
4396 typedef std::pair<std::unique_ptr<const uint8_t[]>,
size_t> OwnedBuffer;
4399 : compiled_code(std::move(code)), wire_bytes(std::move(bytes)) {}
4401 OwnedBuffer compiled_code = {
nullptr, 0};
4402 OwnedBuffer wire_bytes = {
nullptr, 0};
4423 V8_DEPRECATE_SOON(
"Use GetWasmWireBytesRef version.",
4430 SerializedModule Serialize();
4446 const uint8_t* start,
4449 const TransferrableModule::OwnedBuffer& buff) {
4450 return {buff.first.get(), buff.second};
4453 WasmCompiledModule();
4454 static void CheckCast(Value* obj);
4458 WasmCompiledModule::BufferReference::BufferReference(
4459 WasmCompiledModule::CallerOwnedBuffer buf)
4460 : BufferReference(buf.first, buf.second) {}
4461 WasmCompiledModule::BufferReference::
4462 operator WasmCompiledModule::CallerOwnedBuffer() {
4463 return {start, size};
4474 class WasmStreamingImpl;
4484 void OnBytesReceived(
const uint8_t* bytes,
size_t size);
4505 static std::shared_ptr<WasmStreaming> Unpack(
Isolate* isolate,
4509 std::unique_ptr<WasmStreamingImpl> impl_;
4520 void OnBytesReceived(
const uint8_t*,
size_t size);
4555 std::shared_ptr<internal::wasm::StreamingDecoder> streaming_decoder_;
4558 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 4560 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 4564 enum class ArrayBufferCreationMode {
kInternalized, kExternalized };
4595 virtual void* Allocate(
size_t length) = 0;
4601 virtual void* AllocateUninitialized(
size_t length) = 0;
4607 virtual void Free(
void* data,
size_t length) = 0;
4622 static Allocator* NewDefaultAllocator();
4638 allocation_base_(
nullptr),
4639 allocation_length_(0),
4640 allocation_mode_(Allocator::AllocationMode::kNormal) {}
4642 void* AllocationBase()
const {
return allocation_base_; }
4643 size_t AllocationLength()
const {
return allocation_length_; }
4645 return allocation_mode_;
4648 void*
Data()
const {
return data_; }
4649 size_t ByteLength()
const {
return byte_length_; }
4653 size_t byte_length_;
4654 void* allocation_base_;
4655 size_t allocation_length_;
4665 size_t ByteLength()
const;
4685 Isolate* isolate,
void* data,
size_t byte_length,
4686 ArrayBufferCreationMode mode = ArrayBufferCreationMode::kExternalized);
4697 bool IsNeuterable()
const;
4732 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
4733 static const int kEmbedderFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
4737 static void CheckCast(
Value* obj);
4741 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 4743 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2 4760 size_t ByteOffset();
4764 size_t ByteLength();
4775 size_t CopyContents(
void* dest,
size_t byte_length);
4781 bool HasBuffer()
const;
4785 static const int kInternalFieldCount =
4786 V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT;
4787 static const int kEmbedderFieldCount =
4788 V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT;
4792 static void CheckCast(
Value* obj);
4805 static constexpr
size_t kMaxLength = internal::kSmiMaxValue;
4817 static void CheckCast(
Value* obj);
4827 size_t byte_offset,
size_t length);
4829 size_t byte_offset,
size_t length);
4834 static void CheckCast(
Value* obj);
4844 size_t byte_offset,
size_t length);
4852 static void CheckCast(
Value* obj);
4861 size_t byte_offset,
size_t length);
4863 size_t byte_offset,
size_t length);
4868 static void CheckCast(
Value* obj);
4878 size_t byte_offset,
size_t length);
4880 size_t byte_offset,
size_t length);
4885 static void CheckCast(
Value* obj);
4895 size_t byte_offset,
size_t length);
4897 size_t byte_offset,
size_t length);
4902 static void CheckCast(
Value* obj);
4912 size_t byte_offset,
size_t length);
4914 size_t byte_offset,
size_t length);
4919 static void CheckCast(
Value* obj);
4929 size_t byte_offset,
size_t length);
4931 size_t byte_offset,
size_t length);
4936 static void CheckCast(
Value* obj);
4946 size_t byte_offset,
size_t length);
4948 size_t byte_offset,
size_t length);
4953 static void CheckCast(
Value* obj);
4963 size_t byte_offset,
size_t length);
4965 size_t byte_offset,
size_t length);
4970 static void CheckCast(
Value* obj);
4979 size_t byte_offset,
size_t length);
4981 size_t byte_offset,
size_t length);
4986 static void CheckCast(
Value* obj);
4995 size_t byte_offset,
size_t length);
4997 size_t byte_offset,
size_t length);
5002 static void CheckCast(
Value* obj);
5011 size_t byte_offset,
size_t length);
5013 size_t byte_offset,
size_t length);
5018 static void CheckCast(
Value* obj);
5044 allocation_base_(
nullptr),
5045 allocation_length_(0),
5046 allocation_mode_(ArrayBuffer::Allocator::AllocationMode::kNormal) {}
5048 void* AllocationBase()
const {
return allocation_base_; }
5049 size_t AllocationLength()
const {
return allocation_length_; }
5051 return allocation_mode_;
5054 void*
Data()
const {
return data_; }
5055 size_t ByteLength()
const {
return byte_length_; }
5059 size_t byte_length_;
5060 void* allocation_base_;
5061 size_t allocation_length_;
5071 size_t ByteLength()
const;
5088 Isolate* isolate,
void* data,
size_t byte_length,
5089 ArrayBufferCreationMode mode = ArrayBufferCreationMode::kExternalized);
5127 static const int kInternalFieldCount = V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT;
5131 static void CheckCast(
Value* obj);
5140 static V8_DEPRECATE_SOON(
"Use maybe version.",
5149 double ValueOf()
const;
5151 V8_INLINE
static Date* Cast(
Value* obj);
5165 static void DateTimeConfigurationChangeNotification(
Isolate* isolate);
5168 static void CheckCast(
Value* obj);
5179 double ValueOf()
const;
5184 static void CheckCast(
Value* obj);
5199 static void CheckCast(
Value* obj);
5209 bool ValueOf()
const;
5214 static void CheckCast(
Value* obj);
5230 static void CheckCast(
Value* obj);
5246 static void CheckCast(
Value* obj);
5262 kIgnoreCase = 1 << 1,
5263 kMultiline = 1 << 2,
5279 static V8_DEPRECATED(
"Use maybe version",
5294 Flags GetFlags()
const;
5299 static void CheckCast(
Value* obj);
5311 void*
Value()
const;
5316 #define V8_INTRINSICS_LIST(F) \ 5317 F(ArrayProto_entries, array_entries_iterator) \ 5318 F(ArrayProto_forEach, array_for_each_iterator) \ 5319 F(ArrayProto_keys, array_keys_iterator) \ 5320 F(ArrayProto_values, array_values_iterator) \ 5321 F(ErrorPrototype, initial_error_prototype) \ 5322 F(IteratorPrototype, initial_iterator_prototype) 5325 #define V8_DECL_INTRINSIC(name, iname) k##name, 5326 V8_INTRINSICS_LIST(V8_DECL_INTRINSIC)
5327 #undef V8_DECL_INTRINSIC 5350 void SetAccessorProperty(
5386 AccessorSetterCallback setter = 0,
5391 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
5393 Local<Name> name, AccessorNameGetterCallback getter,
5394 AccessorNameSetterCallback setter = 0,
5399 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
5406 Local<Name> name, AccessorNameGetterCallback getter,
5408 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
5414 void SetIntrinsicDataProperty(
Local<Name> name, Intrinsic intrinsic,
5818 Isolate* isolate, FunctionCallback callback = 0,
5821 ConstructorBehavior behavior = ConstructorBehavior::kAllow,
5822 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
5832 Isolate* isolate, FunctionCallback callback,
5835 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
5838 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Function> GetFunction());
5856 void SetCallHandler(
5858 SideEffectType side_effect_type = SideEffectType::kHasSideEffect);
5861 void SetLength(
int length);
5899 void SetAcceptAnyReceiver(
bool value);
5913 void SetHiddenPrototype(
bool value);
5919 void ReadOnlyPrototype();
5925 void RemovePrototype();
5938 static void CheckCast(
Data* that);
5973 kHasNoSideEffect = 1 << 3,
5990 enumerator(enumerator),
6009 enumerator(enumerator),
6011 descriptor(descriptor),
6041 enumerator(enumerator),
6060 enumerator(enumerator),
6062 descriptor(descriptor),
6096 V8_DEPRECATE_SOON(
"Use maybe version",
Local<Object> NewInstance());
6133 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
6135 Local<Name> name, AccessorNameGetterCallback getter,
6139 SideEffectType getter_side_effect_type = SideEffectType::kHasSideEffect);
6164 "Use SetHandler(const NamedPropertyHandlerConfiguration) " 6165 "with the kOnlyInterceptStrings flag set.",
6166 void SetNamedPropertyHandler(
6212 deleter, enumerator, data));
6233 void SetCallAsFunctionHandler(FunctionCallback callback,
6244 void MarkAsUndetectable();
6263 void SetAccessCheckCallbackAndHandler(
6279 void SetInternalFieldCount(
int value);
6284 bool IsImmutableProto();
6290 void SetImmutableProto();
6298 static void CheckCast(
Data* that);
6321 static void CheckCast(
Data* that);
6340 static void CheckCast(
Data* that);
6345 V8_DEPRECATE_SOON(
"Implementation detail",
6352 : data_(data), length_(length) {}
6353 const char*
data()
const {
return data_; }
6369 const char* source = 0,
6371 const char** deps = 0,
6372 int source_length = -1);
6373 virtual ~
Extension() {
delete source_; }
6379 const char* name()
const {
return name_; }
6380 size_t source_length()
const {
return source_length_; }
6384 int dependency_count() {
return dep_count_; }
6385 const char** dependencies() {
return deps_; }
6386 void set_auto_enable(
bool value) { auto_enable_ = value; }
6387 bool auto_enable() {
return auto_enable_; }
6391 void operator=(
const Extension&) =
delete;
6395 size_t source_length_;
6403 void V8_EXPORT RegisterExtension(
Extension* extension);
6440 void ConfigureDefaults(uint64_t physical_memory,
6441 uint64_t virtual_memory_limit);
6444 V8_DEPRECATE_SOON(
"Use max_semi_space_size_in_kb()",
6445 size_t max_semi_space_size()) {
6446 return max_semi_space_size_in_kb_ / 1024;
6450 V8_DEPRECATE_SOON(
"Use set_max_semi_space_size_in_kb(size_t limit_in_kb)",
6451 void set_max_semi_space_size(
size_t limit_in_mb)) {
6452 max_semi_space_size_in_kb_ = limit_in_mb * 1024;
6456 size_t max_semi_space_size_in_kb()
const {
6457 return max_semi_space_size_in_kb_;
6461 void set_max_semi_space_size_in_kb(
size_t limit_in_kb) {
6462 max_semi_space_size_in_kb_ = limit_in_kb;
6465 size_t max_old_space_size()
const {
return max_old_space_size_; }
6466 void set_max_old_space_size(
size_t limit_in_mb) {
6467 max_old_space_size_ = limit_in_mb;
6469 V8_DEPRECATE_SOON(
"max_executable_size_ is subsumed by max_old_space_size_",
6470 size_t max_executable_size()
const) {
6471 return max_executable_size_;
6473 V8_DEPRECATE_SOON(
"max_executable_size_ is subsumed by max_old_space_size_",
6474 void set_max_executable_size(
size_t limit_in_mb)) {
6475 max_executable_size_ = limit_in_mb;
6477 uint32_t* stack_limit()
const {
return stack_limit_; }
6479 void set_stack_limit(uint32_t* value) { stack_limit_ = value; }
6480 size_t code_range_size()
const {
return code_range_size_; }
6481 void set_code_range_size(
size_t limit_in_mb) {
6482 code_range_size_ = limit_in_mb;
6484 size_t max_zone_pool_size()
const {
return max_zone_pool_size_; }
6485 void set_max_zone_pool_size(
size_t bytes) { max_zone_pool_size_ = bytes; }
6489 size_t max_semi_space_size_in_kb_;
6492 size_t max_old_space_size_;
6493 size_t max_executable_size_;
6494 uint32_t* stack_limit_;
6495 size_t code_range_size_;
6496 size_t max_zone_pool_size_;
6503 typedef void (*FatalErrorCallback)(
const char* location,
const char* message);
6505 typedef void (*OOMErrorCallback)(
const char* location,
bool is_heap_oom);
6507 typedef void (*DcheckErrorCallback)(
const char* file,
int line,
6508 const char* message);
6514 typedef void (*LogEventCallback)(
const char* name,
int event);
6545 typedef int* (*CounterLookupCallback)(
const char* name);
6547 typedef void* (*CreateHistogramCallback)(
const char* name,
6552 typedef void (*AddHistogramSampleCallback)(
void* histogram,
int sample);
6555 typedef void (*BeforeCallEnteredCallback)(
Isolate*);
6556 typedef void (*CallCompletedCallback)(
Isolate*);
6557 typedef void (*DeprecatedCallCompletedCallback)();
6615 typedef void (*PromiseHook)(
PromiseHookType type, Local<Promise> promise,
6616 Local<Value> parent);
6619 enum PromiseRejectEvent {
6620 kPromiseRejectWithNoHandler = 0,
6621 kPromiseHandlerAddedAfterReject = 1,
6622 kPromiseRejectAfterResolved = 2,
6623 kPromiseResolveAfterResolved = 3,
6630 : promise_(promise),
6633 stack_trace_(stack_trace) {}
6636 V8_INLINE PromiseRejectEvent GetEvent()
const {
return event_; }
6637 V8_INLINE
Local<Value> GetValue()
const {
return value_; }
6641 PromiseRejectEvent event_;
6649 typedef void (*MicrotasksCompletedCallback)(
Isolate*);
6650 typedef void (*MicrotaskCallback)(
void* data);
6674 enum Type { kRunMicrotasks, kDoNotRunMicrotasks };
6682 static void PerformCheckpoint(
Isolate* isolate);
6687 static int GetCurrentDepth(
Isolate* isolate);
6692 static bool IsRunningMicrotasks(
Isolate* isolate);
6699 internal::Isolate*
const isolate_;
6705 typedef void (*FailedAccessCheckCallback)(
Local<Object> target,
6721 typedef bool (*AllowWasmCodeGenerationCallback)(
Local<Context> context,
6741 kGCTypeScavenge = 1 << 0,
6742 kGCTypeMarkSweepCompact = 1 << 1,
6743 kGCTypeIncrementalMarking = 1 << 2,
6744 kGCTypeProcessWeakCallbacks = 1 << 3,
6745 kGCTypeAll = kGCTypeScavenge | kGCTypeMarkSweepCompact |
6746 kGCTypeIncrementalMarking | kGCTypeProcessWeakCallbacks
6764 kNoGCCallbackFlags = 0,
6765 kGCCallbackFlagConstructRetainedObjectInfos = 1 << 1,
6766 kGCCallbackFlagForced = 1 << 2,
6767 kGCCallbackFlagSynchronousPhantomCallbackProcessing = 1 << 3,
6768 kGCCallbackFlagCollectAllAvailableGarbage = 1 << 4,
6769 kGCCallbackFlagCollectAllExternalMemory = 1 << 5,
6770 kGCCallbackScheduleIdleGarbageCollection = 1 << 6,
6775 typedef void (*InterruptCallback)(Isolate* isolate,
void* data);
6785 size_t initial_heap_limit);
6796 size_t total_heap_size() {
return total_heap_size_; }
6797 size_t total_heap_size_executable() {
return total_heap_size_executable_; }
6798 size_t total_physical_size() {
return total_physical_size_; }
6799 size_t total_available_size() {
return total_available_size_; }
6800 size_t used_heap_size() {
return used_heap_size_; }
6801 size_t heap_size_limit() {
return heap_size_limit_; }
6802 size_t malloced_memory() {
return malloced_memory_; }
6803 size_t peak_malloced_memory() {
return peak_malloced_memory_; }
6804 size_t number_of_native_contexts() {
return number_of_native_contexts_; }
6805 size_t number_of_detached_contexts() {
return number_of_detached_contexts_; }
6814 size_t total_heap_size_;
6815 size_t total_heap_size_executable_;
6816 size_t total_physical_size_;
6817 size_t total_available_size_;
6818 size_t used_heap_size_;
6819 size_t heap_size_limit_;
6820 size_t malloced_memory_;
6821 size_t peak_malloced_memory_;
6822 bool does_zap_garbage_;
6823 size_t number_of_native_contexts_;
6824 size_t number_of_detached_contexts_;
6834 const char* space_name() {
return space_name_; }
6835 size_t space_size() {
return space_size_; }
6836 size_t space_used_size() {
return space_used_size_; }
6837 size_t space_available_size() {
return space_available_size_; }
6838 size_t physical_space_size() {
return physical_space_size_; }
6841 const char* space_name_;
6843 size_t space_used_size_;
6844 size_t space_available_size_;
6845 size_t physical_space_size_;
6854 const char* object_type() {
return object_type_; }
6855 const char* object_sub_type() {
return object_sub_type_; }
6856 size_t object_count() {
return object_count_; }
6857 size_t object_size() {
return object_size_; }
6860 const char* object_type_;
6861 const char* object_sub_type_;
6862 size_t object_count_;
6863 size_t object_size_;
6871 size_t code_and_metadata_size() {
return code_and_metadata_size_; }
6872 size_t bytecode_and_metadata_size() {
return bytecode_and_metadata_size_; }
6873 size_t external_script_source_size() {
return external_script_source_size_; }
6876 size_t code_and_metadata_size_;
6877 size_t bytecode_and_metadata_size_;
6878 size_t external_script_source_size_;
6898 uintptr_t return_addr_location);
6910 CODE_ADD_LINE_POS_INFO,
6911 CODE_START_LINE_INFO_RECORDING,
6912 CODE_END_LINE_INFO_RECORDING
6919 enum PositionType { POSITION, STATEMENT_POSITION };
6927 enum CodeType { BYTE_CODE, JIT_CODE };
6958 PositionType position_type;
6969 void* new_code_start;
6982 PERFORMANCE_RESPONSE,
6986 PERFORMANCE_ANIMATION,
6999 kJitCodeEventDefault = 0,
7001 kJitCodeEventEnumExisting = 1
7030 uint16_t class_id) {}
7056 enum ForceCompletionAction { FORCE_COMPLETION, DO_NOT_FORCE_COMPLETION };
7060 : force_completion(force_completion_) {}
7062 ForceCompletionAction force_completion;
7071 virtual void RegisterV8References(
7072 const std::vector<std::pair<void*, void*> >& embedder_fields) = 0;
7077 virtual void TracePrologue() = 0;
7089 virtual bool AdvanceTracing(
double deadline_in_ms,
7096 virtual bool IsTracingDone() {
return NumberOfWrappersToTrace() == 0; }
7103 virtual void TraceEpilogue() = 0;
7109 virtual void EnterFinalPause() = 0;
7117 virtual void AbortTracing() = 0;
7128 void FinalizeTracing();
7139 V8_DEPRECATE_SOON(
"Use IsTracingDone",
7140 virtual size_t NumberOfWrappersToTrace() {
return 0; });
7143 virtual ~EmbedderHeapTracer() =
default;
7147 friend class internal::LocalEmbedderHeapTracer;
7158 void* data_arg =
nullptr)
7159 : callback(
function), data(data_arg) {}
7160 CallbackFunction callback;
7172 typedef void (*CallbackFunction)(
Local<Object> holder,
int index,
7175 void* data_arg =
nullptr)
7176 : callback(
function), data(data_arg) {}
7198 : entry_hook(
nullptr),
7199 code_event_handler(
nullptr),
7200 snapshot_blob(
nullptr),
7201 counter_lookup_callback(
nullptr),
7202 create_histogram_callback(
nullptr),
7203 add_histogram_sample_callback(
nullptr),
7204 array_buffer_allocator(
nullptr),
7205 external_references(
nullptr),
7206 allow_atomics_wait(
true),
7207 only_terminate_in_safe_scope(
false) {}
7249 AddHistogramSampleCallback add_histogram_sample_callback;
7288 ~
Scope() { isolate_->Exit(); }
7304 enum OnFailure { CRASH_ON_FAILURE, THROW_ON_FAILURE };
7336 void* internal_throws_;
7337 void* internal_assert_;
7356 internal::Isolate*
const isolate_;
7373 internal::Isolate* isolate_;
7382 kFullGarbageCollection,
7383 kMinorGarbageCollection
7395 kMarkDequeOverflow = 3,
7396 kStoreBufferOverflow = 4,
7397 kSlotsBufferOverflow = 5,
7403 kRegExpPrototypeStickyGetter = 11,
7404 kRegExpPrototypeToString = 12,
7405 kRegExpPrototypeUnicodeGetter = 13,
7410 kPromiseAccept = 18,
7412 kHtmlCommentInExternalScript = 20,
7414 kSloppyModeBlockScopedFunctionRedefinition = 22,
7415 kForInInitializer = 23,
7416 kArrayProtectorDirtied = 24,
7417 kArraySpeciesModified = 25,
7418 kArrayPrototypeConstructorModified = 26,
7419 kArrayInstanceProtoModified = 27,
7420 kArrayInstanceConstructorModified = 28,
7421 kLegacyFunctionDeclaration = 29,
7422 kRegExpPrototypeSourceGetter = 30,
7423 kRegExpPrototypeOldFlagGetter = 31,
7424 kDecimalWithLeadingZeroInStrictMode = 32,
7425 kLegacyDateParser = 33,
7426 kDefineGetterOrSetterWouldThrow = 34,
7427 kFunctionConstructorReturnedUndefined = 35,
7428 kAssigmentExpressionLHSIsCallInSloppy = 36,
7429 kAssigmentExpressionLHSIsCallInStrict = 37,
7430 kPromiseConstructorReturnedUndefined = 38,
7431 kConstructorNonUndefinedPrimitiveReturn = 39,
7432 kLabeledExpressionStatement = 40,
7433 kLineOrParagraphSeparatorAsLineTerminator = 41,
7434 kIndexAccessor = 42,
7435 kErrorCaptureStackTrace = 43,
7436 kErrorPrepareStackTrace = 44,
7437 kErrorStackTraceLimit = 45,
7438 kWebAssemblyInstantiation = 46,
7439 kDeoptimizerDisableSpeculation = 47,
7440 kArrayPrototypeSortJSArrayModifiedPrototype = 48,
7441 kFunctionTokenOffsetTooLongForToString = 49,
7446 kUseCounterFeatureCount
7449 enum MessageErrorLevel {
7450 kMessageLog = (1 << 0),
7451 kMessageDebug = (1 << 1),
7452 kMessageInfo = (1 << 2),
7453 kMessageError = (1 << 3),
7454 kMessageWarning = (1 << 4),
7455 kMessageAll = kMessageLog | kMessageDebug | kMessageInfo | kMessageError |
7459 typedef void (*UseCounterCallback)(Isolate* isolate,
7460 UseCounterFeature feature);
7476 static Isolate* Allocate();
7481 static void Initialize(Isolate* isolate,
const CreateParams& params);
7492 static Isolate* New(
const CreateParams& params);
7500 static Isolate* GetCurrent();
7511 typedef bool (*AbortOnUncaughtExceptionCallback)(
Isolate*);
7512 void SetAbortOnUncaughtExceptionCallback(
7513 AbortOnUncaughtExceptionCallback callback);
7519 void SetHostImportModuleDynamicallyCallback(
7526 void SetHostInitializeImportMetaObjectCallback(
7568 void DumpAndResetStats();
7577 void DiscardThreadSpecificMetadata();
7583 V8_INLINE
void SetData(uint32_t slot,
void* data);
7589 V8_INLINE
void* GetData(uint32_t slot);
7595 V8_INLINE
static uint32_t GetNumberOfDataSlots();
7603 V8_INLINE
MaybeLocal<T> GetDataFromSnapshotOnce(
size_t index);
7613 size_t NumberOfHeapSpaces();
7630 size_t NumberOfTrackedHeapObjectTypes();
7665 void GetStackSample(
const RegisterState& state,
void** frames,
7666 size_t frames_limit,
SampleInfo* sample_info);
7682 AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
7688 size_t NumberOfPhantomHandleResetsSinceLastCall();
7699 void SetIdle(
bool is_idle);
7716 "Calling context concept is not compatible with tail calls, and will be " 7747 typedef void (*GCCallbackWithData)(
Isolate* isolate,
GCType type,
7759 void AddGCPrologueCallback(GCCallbackWithData callback,
void* data =
nullptr,
7760 GCType gc_type_filter = kGCTypeAll);
7761 void AddGCPrologueCallback(GCCallback callback,
7762 GCType gc_type_filter = kGCTypeAll);
7768 void RemoveGCPrologueCallback(GCCallbackWithData,
void* data =
nullptr);
7769 void RemoveGCPrologueCallback(GCCallback callback);
7787 kTerminatedExecution,
7842 size_t offset_in_bytes, int32_t value,
7843 double timeout_in_ms,
7853 void SetAtomicsWaitCallback(AtomicsWaitCallback callback,
void* data);
7864 void AddGCEpilogueCallback(GCCallbackWithData callback,
void* data =
nullptr,
7865 GCType gc_type_filter = kGCTypeAll);
7866 void AddGCEpilogueCallback(GCCallback callback,
7867 GCType gc_type_filter = kGCTypeAll);
7873 void RemoveGCEpilogueCallback(GCCallbackWithData callback,
7874 void* data =
nullptr);
7875 void RemoveGCEpilogueCallback(GCCallback callback);
7877 typedef size_t (*GetExternallyAllocatedMemoryInBytesCallback)();
7885 void SetGetExternallyAllocatedMemoryInBytesCallback(
7886 GetExternallyAllocatedMemoryInBytesCallback callback);
7895 void TerminateExecution();
7905 bool IsExecutionTerminating();
7921 void CancelTerminateExecution();
7931 void RequestInterrupt(InterruptCallback callback,
void* data);
7948 void SetEventLogger(LogEventCallback that);
7956 void AddBeforeCallEnteredCallback(BeforeCallEnteredCallback callback);
7961 void RemoveBeforeCallEnteredCallback(BeforeCallEnteredCallback callback);
7970 void AddCallCompletedCallback(CallCompletedCallback callback);
7972 "Use callback with parameter",
7973 void AddCallCompletedCallback(DeprecatedCallCompletedCallback callback));
7978 void RemoveCallCompletedCallback(CallCompletedCallback callback);
7979 V8_DEPRECATED(
"Use callback with parameter",
7980 void RemoveCallCompletedCallback(
7981 DeprecatedCallCompletedCallback callback));
7987 void SetPromiseHook(PromiseHook hook);
7993 void SetPromiseRejectCallback(PromiseRejectCallback callback);
7999 void RunMicrotasks();
8009 void EnqueueMicrotask(MicrotaskCallback callback,
void* data =
nullptr);
8015 V8_DEPRECATED(
"Use SetMicrotasksPolicy",
8016 void SetAutorunMicrotasks(
bool autorun));
8022 V8_DEPRECATED(
"Use GetMicrotasksPolicy",
bool WillAutorunMicrotasks()
const);
8036 void AddMicrotasksCompletedCallback(MicrotasksCompletedCallback callback);
8041 void RemoveMicrotasksCompletedCallback(MicrotasksCompletedCallback callback);
8046 void SetUseCounterCallback(UseCounterCallback callback);
8052 void SetCounterFunction(CounterLookupCallback);
8060 void SetCreateHistogramFunction(CreateHistogramCallback);
8061 void SetAddHistogramSampleFunction(AddHistogramSampleCallback);
8077 bool IdleNotificationDeadline(
double deadline_in_seconds);
8083 void LowMemoryNotification();
8094 int ContextDisposedNotification(
bool dependant_context =
true);
8100 void IsolateInForegroundNotification();
8106 void IsolateInBackgroundNotification();
8113 void EnableMemorySavingsMode();
8118 void DisableMemorySavingsMode();
8127 void SetRAILMode(
RAILMode rail_mode);
8133 void IncreaseHeapLimitForDebugging();
8138 void RestoreOriginalHeapLimit();
8144 bool IsHeapLimitIncreasedForDebugging();
8180 void SetStackLimit(uintptr_t stack_limit);
8195 void GetCodeRange(
void** start,
size_t* length_in_bytes);
8198 void SetFatalErrorHandler(FatalErrorCallback that);
8201 void SetOOMErrorHandler(OOMErrorCallback that);
8224 void SetAllowCodeGenerationFromStringsCallback(
8231 void SetAllowWasmCodeGenerationCallback(
8232 AllowWasmCodeGenerationCallback callback);
8238 void SetWasmModuleCallback(ExtensionCallback callback);
8239 void SetWasmInstanceCallback(ExtensionCallback callback);
8241 void SetWasmCompileStreamingCallback(ApiImplementationCallback callback);
8243 void SetWasmStreamingCallback(WasmStreamingCallback callback);
8260 bool AddMessageListener(MessageCallback that,
8274 bool AddMessageListenerWithErrorLevel(MessageCallback that,
8281 void RemoveMessageListeners(MessageCallback that);
8284 void SetFailedAccessCheckCallbackFunction(FailedAccessCheckCallback);
8290 void SetCaptureStackTraceForUncaughtExceptions(
8291 bool capture,
int frame_limit = 10,
8334 void SetAllowAtomicsWait(
bool allow);
8342 void*
operator new(
size_t size) =
delete;
8343 void*
operator new[](
size_t size) =
delete;
8344 void operator delete(
void*, size_t) =
delete;
8345 void operator delete[](
void*, size_t) =
delete;
8348 template <
class K,
class V,
class Traits>
8351 internal::Object** GetDataFromSnapshotOnce(
size_t index);
8352 void ReportExternalAllocationLimitReached();
8353 void CheckMemoryPressure();
8383 uintptr_t return_addr_location);
8406 static void SetNativesDataBlob(
StartupData* startup_blob);
8407 static void SetSnapshotDataBlob(
StartupData* startup_blob);
8415 V8_DEPRECATED(
"Use SnapshotCreator",
8417 const char* embedded_source = NULL));
8427 V8_DEPRECATED(
"Use SnapshotCreator",
8429 StartupData cold_startup_blob,
const char* warmup_source));
8432 static void SetDcheckErrorHandler(DcheckErrorCallback that);
8438 static void SetFlagsFromString(
const char* str,
int length);
8443 static void SetFlagsFromCommandLine(
int* argc,
8448 static const char* GetVersion();
8454 static bool Initialize();
8466 static void SetReturnAddressLocationResolver(
8478 static bool Dispose();
8487 static bool InitializeICU(
const char* icu_data_file =
nullptr);
8501 static bool InitializeICUDefaultLocation(
const char* exec_path,
8502 const char* icu_data_file =
nullptr);
8520 static void InitializeExternalStartupData(
const char* directory_path);
8521 static void InitializeExternalStartupData(
const char* natives_blob,
8522 const char* snapshot_blob);
8527 static void InitializePlatform(
Platform* platform);
8533 static void ShutdownPlatform();
8555 static bool TryHandleSignal(
int signal_number,
void* info,
void* context);
8556 #endif // V8_OS_POSIX 8562 V8_DEPRECATE_SOON(
"Use EnableWebAssemblyTrapHandler",
8563 static bool RegisterDefaultSignalHandler());
8571 static bool EnableWebAssemblyTrapHandler(
bool use_v8_signal_handler);
8576 static internal::Object** GlobalizeReference(internal::Isolate* isolate,
8577 internal::Object** handle);
8578 static internal::Object** CopyPersistent(internal::Object** handle);
8579 static void DisposeGlobal(internal::Object** global_handle);
8580 static void MakeWeak(internal::Object** location,
void* data,
8582 WeakCallbackType type);
8583 static void MakeWeak(internal::Object** location,
void* data,
8585 int internal_field_index1,
8587 int internal_field_index2,
8589 static void MakeWeak(internal::Object*** location_addr);
8590 static void* ClearWeak(internal::Object** location);
8591 static void AnnotateStrongRetainer(internal::Object** location,
8595 static void RegisterExternallyReferencedObject(internal::Object**
object,
8596 internal::Isolate* isolate);
8598 template <
class K,
class V,
class T>
8601 static void FromJustIsNothing();
8602 static void ToLocalEmpty();
8603 static void InternalFieldOutOfBounds(
int index);
8604 template <
class T>
friend class Local;
8611 template <
class T>
friend class Eternal;
8613 template <
class T,
class M>
friend class Persistent;
8622 enum class FunctionCodeHandling { kClear, kKeep };
8633 const intptr_t* external_references =
nullptr,
8699 V8_INLINE
size_t AddData(
Local<T> object);
8709 StartupData CreateBlob(FunctionCodeHandling function_code_handling);
8716 size_t AddData(
Local<Context> context, internal::Object*
object);
8717 size_t AddData(internal::Object*
object);
8735 V8_INLINE
bool IsNothing()
const {
return !has_value_; }
8736 V8_INLINE
bool IsJust()
const {
return has_value_; }
8747 V8_WARN_UNUSED_RESULT V8_INLINE
bool To(T* out)
const {
8748 if (V8_LIKELY(IsJust())) *out = value_;
8757 if (V8_UNLIKELY(!IsJust())) V8::FromJustIsNothing();
8766 return has_value_ ? value_ : default_value;
8769 V8_INLINE
bool operator==(
const Maybe& other)
const {
8770 return (IsJust() == other.IsJust()) &&
8771 (!IsJust() || FromJust() == other.
FromJust());
8774 V8_INLINE
bool operator!=(
const Maybe& other)
const {
8775 return !operator==(other);
8779 Maybe() : has_value_(false) {}
8780 explicit Maybe(
const T& t) : has_value_(true), value_(t) {}
8786 friend Maybe<U> Nothing();
8788 friend Maybe<U> Just(
const U& u);
8792 inline Maybe<T> Nothing() {
8797 inline Maybe<T> Just(
const T& t) {
8805 V8_INLINE
bool IsNothing()
const {
return !is_valid_; }
8806 V8_INLINE
bool IsJust()
const {
return is_valid_; }
8808 V8_INLINE
bool operator==(
const Maybe& other)
const {
8809 return IsJust() == other.IsJust();
8812 V8_INLINE
bool operator!=(
const Maybe& other)
const {
8813 return !operator==(other);
8819 Maybe() : is_valid_(
false) {}
8820 explicit Maybe(JustTag) : is_valid_(
true) {}
8851 bool HasCaught()
const;
8861 bool CanContinue()
const;
8875 bool HasTerminated()
const;
8931 void SetVerbose(
bool value);
8936 bool IsVerbose()
const;
8943 void SetCaptureMessage(
bool value);
8957 if (handler == NULL)
return NULL;
8958 return handler->js_stack_comparable_address_;
8962 void operator=(
const TryCatch&) =
delete;
8967 void*
operator new(
size_t size);
8968 void*
operator new[](
size_t size);
8969 void operator delete(
void*, size_t);
8970 void operator delete[](
void*, size_t);
8972 void ResetInternal();
8974 internal::Isolate* isolate_;
8978 void* js_stack_comparable_address_;
8979 bool is_verbose_ : 1;
8980 bool can_continue_ : 1;
8981 bool capture_message_ : 1;
8983 bool has_terminated_ : 1;
8985 friend class internal::Isolate;
8999 : name_count_(name_count), names_(names) { }
9001 const char** begin()
const {
return &names_[0]; }
9002 const char** end()
const {
return &names_[name_count_]; }
9005 const int name_count_;
9006 const char** names_;
9033 void DetachGlobal();
9080 Isolate* isolate,
size_t context_snapshot_index,
9114 void UseDefaultSecurityToken();
9145 uint32_t GetNumberOfEmbedderDataFields();
9174 V8_INLINE
void* GetAlignedPointerFromEmbedderData(
int index);
9181 void SetAlignedPointerInEmbedderData(
int index,
void* value);
9196 void AllowCodeGenerationFromStrings(
bool allow);
9202 bool IsCodeGenerationFromStringsAllowed();
9209 void SetErrorMessageForCodeGenerationFromStrings(
Local<String> message);
9217 V8_INLINE
MaybeLocal<T> GetDataFromSnapshotOnce(
size_t index);
9228 V8_INLINE ~
Scope() { context_->Exit(); }
9249 friend class internal::Isolate;
9261 internal::Object** GetDataFromSnapshotOnce(
size_t index);
9263 void* SlowGetAlignedPointerFromEmbedderData(
int index);
9352 void Initialize(
Isolate* isolate);
9354 internal::Isolate* isolate_;
9371 static bool IsLocked(
Isolate* isolate);
9376 static bool IsActive();
9380 void operator=(
const Locker&) =
delete;
9383 void Initialize(
Isolate* isolate);
9387 internal::Isolate* isolate_;
9394 namespace internal {
9405 static const int kHeapObjectMapOffset = 0;
9406 static const int kMapInstanceTypeOffset = 1 * kApiPointerSize + kApiIntSize;
9407 static const int kStringResourceOffset = 3 * kApiPointerSize;
9409 static const int kOddballKindOffset = 4 * kApiPointerSize + kApiDoubleSize;
9410 static const int kForeignAddressOffset = kApiPointerSize;
9411 static const int kJSObjectHeaderSize = 3 * kApiPointerSize;
9412 static const int kFixedArrayHeaderSize = 2 * kApiPointerSize;
9413 static const int kContextHeaderSize = 2 * kApiPointerSize;
9414 static const int kContextEmbedderDataIndex = 5;
9415 static const int kFullStringRepresentationMask = 0x0f;
9416 static const int kStringEncodingMask = 0x8;
9417 static const int kExternalTwoByteRepresentationTag = 0x02;
9418 static const int kExternalOneByteRepresentationTag = 0x0a;
9420 static const int kIsolateEmbedderDataOffset = 0 * kApiPointerSize;
9421 static const int kExternalMemoryOffset = 4 * kApiPointerSize;
9422 static const int kExternalMemoryLimitOffset =
9423 kExternalMemoryOffset + kApiInt64Size;
9424 static const int kExternalMemoryAtLastMarkCompactOffset =
9425 kExternalMemoryLimitOffset + kApiInt64Size;
9426 static const int kIsolateRootsOffset = kExternalMemoryLimitOffset +
9427 kApiInt64Size + kApiInt64Size +
9428 kApiPointerSize + kApiPointerSize;
9429 static const int kUndefinedValueRootIndex = 4;
9430 static const int kTheHoleValueRootIndex = 5;
9431 static const int kNullValueRootIndex = 6;
9432 static const int kTrueValueRootIndex = 7;
9433 static const int kFalseValueRootIndex = 8;
9434 static const int kEmptyStringRootIndex = 9;
9436 static const int kNodeClassIdOffset = 1 * kApiPointerSize;
9437 static const int kNodeFlagsOffset = 1 * kApiPointerSize + 3;
9438 static const int kNodeStateMask = 0x7;
9439 static const int kNodeStateIsWeakValue = 2;
9440 static const int kNodeStateIsPendingValue = 3;
9441 static const int kNodeStateIsNearDeathValue = 4;
9442 static const int kNodeIsIndependentShift = 3;
9443 static const int kNodeIsActiveShift = 4;
9445 static const int kFirstNonstringType = 0x80;
9446 static const int kOddballType = 0x83;
9447 static const int kForeignType = 0x87;
9448 static const int kJSSpecialApiObjectType = 0x410;
9449 static const int kJSApiObjectType = 0x420;
9450 static const int kJSObjectType = 0x421;
9452 static const int kUndefinedOddballKind = 5;
9453 static const int kNullOddballKind = 3;
9455 static const uint32_t kNumIsolateDataSlots = 4;
9457 V8_EXPORT
static void CheckInitializedImpl(
v8::Isolate* isolate);
9458 V8_INLINE
static void CheckInitialized(
v8::Isolate* isolate) {
9459 #ifdef V8_ENABLE_CHECKS 9460 CheckInitializedImpl(isolate);
9464 V8_INLINE
static bool HasHeapObjectTag(
const internal::Object* value) {
9465 return ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) ==
9469 V8_INLINE
static int SmiValue(
const internal::Object* value) {
9470 return PlatformSmiTagging::SmiToInt(value);
9473 V8_INLINE
static internal::Object* IntToSmi(
int value) {
9474 return PlatformSmiTagging::IntToSmi(value);
9477 V8_INLINE
static bool IsValidSmi(intptr_t value) {
9478 return PlatformSmiTagging::IsValidSmi(value);
9481 V8_INLINE
static int GetInstanceType(
const internal::Object* obj) {
9482 typedef internal::Object O;
9483 O* map = ReadField<O*>(obj, kHeapObjectMapOffset);
9484 return ReadField<uint16_t>(map, kMapInstanceTypeOffset);
9487 V8_INLINE
static int GetOddballKind(
const internal::Object* obj) {
9488 typedef internal::Object O;
9489 return SmiValue(ReadField<O*>(obj, kOddballKindOffset));
9492 V8_INLINE
static bool IsExternalTwoByteString(
int instance_type) {
9493 int representation = (instance_type & kFullStringRepresentationMask);
9494 return representation == kExternalTwoByteRepresentationTag;
9497 V8_INLINE
static uint8_t GetNodeFlag(internal::Object** obj,
int shift) {
9498 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + kNodeFlagsOffset;
9499 return *addr &
static_cast<uint8_t
>(1U << shift);
9502 V8_INLINE
static void UpdateNodeFlag(internal::Object** obj,
9503 bool value,
int shift) {
9504 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + kNodeFlagsOffset;
9505 uint8_t mask =
static_cast<uint8_t
>(1U << shift);
9506 *addr =
static_cast<uint8_t
>((*addr & ~mask) | (value << shift));
9509 V8_INLINE
static uint8_t GetNodeState(internal::Object** obj) {
9510 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + kNodeFlagsOffset;
9511 return *addr & kNodeStateMask;
9514 V8_INLINE
static void UpdateNodeState(internal::Object** obj,
9516 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + kNodeFlagsOffset;
9517 *addr =
static_cast<uint8_t
>((*addr & ~kNodeStateMask) | value);
9520 V8_INLINE
static void SetEmbedderData(
v8::Isolate* isolate,
9523 uint8_t* addr =
reinterpret_cast<uint8_t*
>(isolate) +
9524 kIsolateEmbedderDataOffset + slot * kApiPointerSize;
9525 *
reinterpret_cast<void**
>(addr) = data;
9528 V8_INLINE
static void* GetEmbedderData(
const v8::Isolate* isolate,
9530 const uint8_t* addr =
reinterpret_cast<const uint8_t*
>(isolate) +
9531 kIsolateEmbedderDataOffset + slot * kApiPointerSize;
9532 return *
reinterpret_cast<void* const*
>(addr);
9535 V8_INLINE
static internal::Object** GetRoot(
v8::Isolate* isolate,
9537 uint8_t* addr =
reinterpret_cast<uint8_t*
>(isolate) + kIsolateRootsOffset;
9538 return reinterpret_cast<internal::Object**
>(addr + index * kApiPointerSize);
9541 template <
typename T>
9542 V8_INLINE
static T ReadField(
const internal::Object* ptr,
int offset) {
9543 const uint8_t* addr =
9544 reinterpret_cast<const uint8_t*
>(ptr) + offset - kHeapObjectTag;
9545 return *
reinterpret_cast<const T*
>(addr);
9548 template <
typename T>
9549 V8_INLINE
static T ReadEmbedderData(
const v8::Context* context,
int index) {
9550 typedef internal::Object O;
9552 O* ctx = *
reinterpret_cast<O* const*
>(context);
9553 int embedder_data_offset = I::kContextHeaderSize +
9554 (internal::kApiPointerSize * I::kContextEmbedderDataIndex);
9555 O* embedder_data = I::ReadField<O*>(ctx, embedder_data_offset);
9557 I::kFixedArrayHeaderSize + (internal::kApiPointerSize * index);
9558 return I::ReadField<T>(embedder_data, value_offset);
9564 template <
bool PerformCheck>
9567 static void Perform(T* data);
9578 void CastCheck<false>::Perform(T* data) {}
9581 V8_INLINE
void PerformCastCheck(T* data) {
9582 CastCheck<std::is_base_of<Data, T>::value>::Perform(data);
9590 return New(isolate, that.val_);
9595 return New(isolate, that.val_);
9601 if (that == NULL)
return Local<T>();
9603 internal::Object** p =
reinterpret_cast<internal::Object**
>(that_ptr);
9604 return Local<T>(
reinterpret_cast<T*
>(HandleScope::CreateHandle(
9605 reinterpret_cast<internal::Isolate*>(isolate), *p)));
9611 void Eternal<T>::Set(Isolate* isolate, Local<S> handle) {
9613 val_ =
reinterpret_cast<T*
>(
9614 V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle)));
9618 Local<T> Eternal<T>::Get(Isolate* isolate)
const {
9621 return Local<T>(val_);
9627 if (V8_UNLIKELY(val_ ==
nullptr)) V8::ToLocalEmpty();
9634 #ifdef V8_ENABLE_CHECKS 9635 if (index < 0 || index >= kEmbedderFieldsInWeakCallback) {
9636 V8::InternalFieldOutOfBounds(index);
9639 return embedder_fields_[index];
9644 T* PersistentBase<T>::New(Isolate* isolate, T* that) {
9645 if (that == NULL)
return NULL;
9646 internal::Object** p =
reinterpret_cast<internal::Object**
>(that);
9647 return reinterpret_cast<T*
>(
9648 V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate),
9653 template <
class T,
class M>
9654 template <
class S,
class M2>
9655 void Persistent<T, M>::Copy(
const Persistent<S, M2>& that) {
9658 if (that.IsEmpty())
return;
9659 internal::Object** p =
reinterpret_cast<internal::Object**
>(that.val_);
9660 this->val_ =
reinterpret_cast<T*
>(V8::CopyPersistent(p));
9661 M::Copy(that,
this);
9665 bool PersistentBase<T>::IsIndependent()
const {
9666 typedef internal::Internals I;
9667 if (this->IsEmpty())
return false;
9668 return I::GetNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
9669 I::kNodeIsIndependentShift);
9675 if (this->IsEmpty())
return false;
9676 uint8_t node_state =
9677 I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_));
9678 return node_state == I::kNodeStateIsNearDeathValue ||
9679 node_state == I::kNodeStateIsPendingValue;
9686 if (this->IsEmpty())
return false;
9687 return I::GetNodeState(reinterpret_cast<internal::Object**>(this->val_)) ==
9688 I::kNodeStateIsWeakValue;
9694 if (this->IsEmpty())
return;
9695 V8::DisposeGlobal(reinterpret_cast<internal::Object**>(this->val_));
9705 if (other.IsEmpty())
return;
9706 this->val_ = New(isolate, other.val_);
9713 const PersistentBase<S>& other) {
9716 if (other.IsEmpty())
return;
9717 this->val_ = New(isolate, other.val_);
9722 template <
typename P>
9725 WeakCallbackType type) {
9727 V8::MakeWeak(reinterpret_cast<internal::Object**>(this->val_), parameter,
9728 reinterpret_cast<Callback>(callback), type);
9733 V8::MakeWeak(reinterpret_cast<internal::Object***>(&this->val_));
9737 template <
typename P>
9739 return reinterpret_cast<P*
>(
9740 V8::ClearWeak(reinterpret_cast<internal::Object**>(this->val_)));
9745 V8::AnnotateStrongRetainer(reinterpret_cast<internal::Object**>(this->val_),
9751 if (IsEmpty())
return;
9752 V8::RegisterExternallyReferencedObject(
9753 reinterpret_cast<internal::Object**>(this->val_),
9754 reinterpret_cast<internal::Isolate*>(isolate));
9760 if (this->IsEmpty())
return;
9761 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
true,
9762 I::kNodeIsIndependentShift);
9768 if (this->IsEmpty())
return;
9769 I::UpdateNodeFlag(reinterpret_cast<internal::Object**>(this->val_),
true,
9770 I::kNodeIsActiveShift);
9777 if (this->IsEmpty())
return;
9778 internal::Object** obj =
reinterpret_cast<internal::Object**
>(this->val_);
9779 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + I::kNodeClassIdOffset;
9780 *
reinterpret_cast<uint16_t*
>(addr) = class_id;
9787 if (this->IsEmpty())
return 0;
9788 internal::Object** obj =
reinterpret_cast<internal::Object**
>(this->val_);
9789 uint8_t* addr =
reinterpret_cast<uint8_t*
>(obj) + I::kNodeClassIdOffset;
9790 return *
reinterpret_cast<uint16_t*
>(addr);
9794 template<
typename T>
9797 template<
typename T>
9798 template<
typename S>
9799 void ReturnValue<T>::Set(
const Persistent<S>& handle) {
9801 if (V8_UNLIKELY(handle.IsEmpty())) {
9802 *value_ = GetDefaultValue();
9804 *value_ = *
reinterpret_cast<internal::Object**
>(*handle);
9808 template <
typename T>
9809 template <
typename S>
9810 void ReturnValue<T>::Set(
const Global<S>& handle) {
9812 if (V8_UNLIKELY(handle.IsEmpty())) {
9813 *value_ = GetDefaultValue();
9815 *value_ = *
reinterpret_cast<internal::Object**
>(*handle);
9819 template <
typename T>
9820 template <
typename S>
9821 void ReturnValue<T>::Set(
const Local<S> handle) {
9823 if (V8_UNLIKELY(handle.IsEmpty())) {
9824 *value_ = GetDefaultValue();
9826 *value_ = *
reinterpret_cast<internal::Object**
>(*handle);
9830 template<
typename T>
9831 void ReturnValue<T>::Set(
double i) {
9832 TYPE_CHECK(T, Number);
9833 Set(Number::New(GetIsolate(), i));
9836 template<
typename T>
9837 void ReturnValue<T>::Set(int32_t i) {
9838 TYPE_CHECK(T, Integer);
9839 typedef internal::Internals I;
9840 if (V8_LIKELY(I::IsValidSmi(i))) {
9841 *value_ = I::IntToSmi(i);
9844 Set(Integer::New(GetIsolate(), i));
9847 template<
typename T>
9848 void ReturnValue<T>::Set(uint32_t i) {
9849 TYPE_CHECK(T, Integer);
9851 bool fits_into_int32_t = (i & (1U << 31)) == 0;
9852 if (V8_LIKELY(fits_into_int32_t)) {
9853 Set(static_cast<int32_t>(i));
9856 Set(Integer::NewFromUnsigned(GetIsolate(), i));
9859 template<
typename T>
9860 void ReturnValue<T>::Set(
bool value) {
9861 TYPE_CHECK(T, Boolean);
9862 typedef internal::Internals I;
9865 root_index = I::kTrueValueRootIndex;
9867 root_index = I::kFalseValueRootIndex;
9869 *value_ = *I::GetRoot(GetIsolate(), root_index);
9872 template<
typename T>
9873 void ReturnValue<T>::SetNull() {
9874 TYPE_CHECK(T, Primitive);
9875 typedef internal::Internals I;
9876 *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
9879 template<
typename T>
9880 void ReturnValue<T>::SetUndefined() {
9881 TYPE_CHECK(T, Primitive);
9882 typedef internal::Internals I;
9883 *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
9886 template<
typename T>
9887 void ReturnValue<T>::SetEmptyString() {
9888 TYPE_CHECK(T, String);
9889 typedef internal::Internals I;
9890 *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
9893 template <
typename T>
9894 Isolate* ReturnValue<T>::GetIsolate()
const {
9896 return *
reinterpret_cast<Isolate**
>(&value_[-2]);
9899 template <
typename T>
9900 Local<Value> ReturnValue<T>::Get()
const {
9901 typedef internal::Internals I;
9902 if (*value_ == *I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex))
9903 return Local<Value>(*Undefined(GetIsolate()));
9907 template <
typename T>
9908 template <
typename S>
9909 void ReturnValue<T>::Set(S* whatever) {
9911 TYPE_CHECK(S*, Primitive);
9914 template<
typename T>
9915 internal::Object* ReturnValue<T>::GetDefaultValue() {
9920 template <
typename T>
9921 FunctionCallbackInfo<T>::FunctionCallbackInfo(internal::Object** implicit_args,
9922 internal::Object** values,
9924 : implicit_args_(implicit_args), values_(values), length_(length) {}
9926 template<
typename T>
9928 if (i < 0 || length_ <= i)
return Local<Value>(*Undefined(GetIsolate()));
9933 template<
typename T>
9939 template<
typename T>
9942 &implicit_args_[kHolderIndex]));
9945 template <
typename T>
9948 reinterpret_cast<Value*
>(&implicit_args_[kNewTargetIndex]));
9951 template <
typename T>
9957 template<
typename T>
9959 return *
reinterpret_cast<Isolate**
>(&implicit_args_[kIsolateIndex]);
9963 template<
typename T>
9969 template<
typename T>
9971 return !NewTarget()->IsUndefined();
9975 template<
typename T>
9989 : resource_name_(resource_name),
9990 resource_line_offset_(resource_line_offset),
9991 resource_column_offset_(resource_column_offset),
9992 options_(!resource_is_shared_cross_origin.IsEmpty() &&
9993 resource_is_shared_cross_origin->IsTrue(),
9994 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue(),
9995 !is_wasm.IsEmpty() && is_wasm->IsTrue(),
9996 !is_module.IsEmpty() && is_module->IsTrue()),
9997 script_id_(script_id),
9998 source_map_url_(source_map_url),
9999 host_defined_options_(host_defined_options) {}
10001 Local<Value> ScriptOrigin::ResourceName()
const {
return resource_name_; }
10003 Local<PrimitiveArray> ScriptOrigin::HostDefinedOptions()
const {
10004 return host_defined_options_;
10007 Local<Integer> ScriptOrigin::ResourceLineOffset()
const {
10008 return resource_line_offset_;
10012 Local<Integer> ScriptOrigin::ResourceColumnOffset()
const {
10013 return resource_column_offset_;
10017 Local<Integer> ScriptOrigin::ScriptID()
const {
return script_id_; }
10020 Local<Value> ScriptOrigin::SourceMapUrl()
const {
return source_map_url_; }
10022 ScriptCompiler::Source::Source(Local<String>
string,
const ScriptOrigin& origin,
10024 : source_string(string),
10025 resource_name(origin.ResourceName()),
10026 resource_line_offset(origin.ResourceLineOffset()),
10027 resource_column_offset(origin.ResourceColumnOffset()),
10028 resource_options(origin.Options()),
10029 source_map_url(origin.SourceMapUrl()),
10030 host_defined_options(origin.HostDefinedOptions()),
10031 cached_data(data) {}
10033 ScriptCompiler::Source::Source(Local<String>
string,
10035 : source_string(string), cached_data(data) {}
10038 ScriptCompiler::Source::~Source() {
10039 delete cached_data;
10043 const ScriptCompiler::CachedData* ScriptCompiler::Source::GetCachedData()
10045 return cached_data;
10048 const ScriptOriginOptions& ScriptCompiler::Source::GetResourceOptions()
const {
10049 return resource_options;
10052 Local<Boolean> Boolean::New(Isolate* isolate,
bool value) {
10053 return value ? True(isolate) : False(isolate);
10056 void Template::Set(Isolate* isolate,
const char* name, Local<Data> value) {
10062 FunctionTemplate* FunctionTemplate::Cast(Data* data) {
10063 #ifdef V8_ENABLE_CHECKS 10066 return reinterpret_cast<FunctionTemplate*
>(data);
10069 ObjectTemplate* ObjectTemplate::Cast(Data* data) {
10070 #ifdef V8_ENABLE_CHECKS 10073 return reinterpret_cast<ObjectTemplate*
>(data);
10076 Signature* Signature::Cast(Data* data) {
10077 #ifdef V8_ENABLE_CHECKS 10080 return reinterpret_cast<Signature*
>(data);
10083 AccessorSignature* AccessorSignature::Cast(Data* data) {
10084 #ifdef V8_ENABLE_CHECKS 10087 return reinterpret_cast<AccessorSignature*
>(data);
10091 #ifndef V8_ENABLE_CHECKS 10092 typedef internal::Object O;
10093 typedef internal::HeapObject HO;
10095 O* obj = *
reinterpret_cast<O**
>(
this);
10098 auto instance_type = I::GetInstanceType(obj);
10099 if (instance_type == I::kJSObjectType ||
10100 instance_type == I::kJSApiObjectType ||
10101 instance_type == I::kJSSpecialApiObjectType) {
10102 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
10103 O* value = I::ReadField<O*>(obj, offset);
10104 O** result = HandleScope::CreateHandle(reinterpret_cast<HO*>(obj), value);
10108 return SlowGetInternalField(index);
10113 #ifndef V8_ENABLE_CHECKS 10114 typedef internal::Object O;
10116 O* obj = *
reinterpret_cast<O**
>(
this);
10119 auto instance_type = I::GetInstanceType(obj);
10120 if (V8_LIKELY(instance_type == I::kJSObjectType ||
10121 instance_type == I::kJSApiObjectType ||
10122 instance_type == I::kJSSpecialApiObjectType)) {
10123 int offset = I::kJSObjectHeaderSize + (internal::kApiPointerSize * index);
10124 return I::ReadField<void*>(obj, offset);
10127 return SlowGetAlignedPointerFromInternalField(index);
10131 #ifdef V8_ENABLE_CHECKS 10134 return static_cast<String*
>(value);
10139 typedef internal::Object* S;
10141 I::CheckInitialized(isolate);
10142 S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex);
10148 typedef internal::Object O;
10150 O* obj = *
reinterpret_cast<O* const*
>(
this);
10152 if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
10153 void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
10158 #ifdef V8_ENABLE_CHECKS 10159 VerifyExternalStringResource(result);
10166 String::Encoding* encoding_out)
const {
10167 typedef internal::Object O;
10169 O* obj = *
reinterpret_cast<O* const*
>(
this);
10170 int type = I::GetInstanceType(obj) & I::kFullStringRepresentationMask;
10171 *encoding_out =
static_cast<Encoding
>(type & I::kStringEncodingMask);
10173 if (type == I::kExternalOneByteRepresentationTag ||
10174 type == I::kExternalTwoByteRepresentationTag) {
10175 void* value = I::ReadField<void*>(obj, I::kStringResourceOffset);
10178 #ifdef V8_ENABLE_CHECKS 10179 VerifyExternalStringResourceBase(resource, *encoding_out);
10186 #ifdef V8_ENABLE_CHECKS 10187 return FullIsUndefined();
10189 return QuickIsUndefined();
10193 bool Value::QuickIsUndefined()
const {
10194 typedef internal::Object O;
10196 O* obj = *
reinterpret_cast<O* const*
>(
this);
10197 if (!I::HasHeapObjectTag(obj))
return false;
10198 if (I::GetInstanceType(obj) != I::kOddballType)
return false;
10199 return (I::GetOddballKind(obj) == I::kUndefinedOddballKind);
10204 #ifdef V8_ENABLE_CHECKS 10205 return FullIsNull();
10207 return QuickIsNull();
10211 bool Value::QuickIsNull()
const {
10212 typedef internal::Object O;
10214 O* obj = *
reinterpret_cast<O* const*
>(
this);
10215 if (!I::HasHeapObjectTag(obj))
return false;
10216 if (I::GetInstanceType(obj) != I::kOddballType)
return false;
10217 return (I::GetOddballKind(obj) == I::kNullOddballKind);
10221 #ifdef V8_ENABLE_CHECKS 10222 return FullIsNull() || FullIsUndefined();
10224 return QuickIsNullOrUndefined();
10228 bool Value::QuickIsNullOrUndefined()
const {
10229 typedef internal::Object O;
10231 O* obj = *
reinterpret_cast<O* const*
>(
this);
10232 if (!I::HasHeapObjectTag(obj))
return false;
10233 if (I::GetInstanceType(obj) != I::kOddballType)
return false;
10234 int kind = I::GetOddballKind(obj);
10235 return kind == I::kNullOddballKind || kind == I::kUndefinedOddballKind;
10239 #ifdef V8_ENABLE_CHECKS 10240 return FullIsString();
10242 return QuickIsString();
10246 bool Value::QuickIsString()
const {
10247 typedef internal::Object O;
10249 O* obj = *
reinterpret_cast<O* const*
>(
this);
10250 if (!I::HasHeapObjectTag(obj))
return false;
10251 return (I::GetInstanceType(obj) < I::kFirstNonstringType);
10255 template <
class T> Value* Value::Cast(T* value) {
10256 return static_cast<Value*
>(value);
10260 Local<Boolean> Value::ToBoolean()
const {
10262 .FromMaybe(Local<Boolean>());
10266 Local<String> Value::ToString()
const {
10268 .FromMaybe(Local<String>());
10272 Local<Object> Value::ToObject()
const {
10274 .FromMaybe(Local<Object>());
10278 Local<Integer> Value::ToInteger()
const {
10280 .FromMaybe(Local<Integer>());
10284 Boolean* Boolean::Cast(
v8::Value* value) {
10285 #ifdef V8_ENABLE_CHECKS 10288 return static_cast<Boolean*
>(value);
10293 #ifdef V8_ENABLE_CHECKS 10296 return static_cast<Name*
>(value);
10300 Symbol* Symbol::Cast(
v8::Value* value) {
10301 #ifdef V8_ENABLE_CHECKS 10304 return static_cast<Symbol*
>(value);
10308 Private* Private::Cast(Data* data) {
10309 #ifdef V8_ENABLE_CHECKS 10312 return reinterpret_cast<Private*
>(data);
10316 Number* Number::Cast(
v8::Value* value) {
10317 #ifdef V8_ENABLE_CHECKS 10320 return static_cast<Number*
>(value);
10324 Integer* Integer::Cast(
v8::Value* value) {
10325 #ifdef V8_ENABLE_CHECKS 10328 return static_cast<Integer*
>(value);
10333 #ifdef V8_ENABLE_CHECKS 10336 return static_cast<Int32*
>(value);
10340 Uint32* Uint32::Cast(
v8::Value* value) {
10341 #ifdef V8_ENABLE_CHECKS 10344 return static_cast<Uint32*
>(value);
10347 BigInt* BigInt::Cast(
v8::Value* value) {
10348 #ifdef V8_ENABLE_CHECKS 10351 return static_cast<BigInt*
>(value);
10355 #ifdef V8_ENABLE_CHECKS 10358 return static_cast<Date*
>(value);
10362 StringObject* StringObject::Cast(
v8::Value* value) {
10363 #ifdef V8_ENABLE_CHECKS 10366 return static_cast<StringObject*
>(value);
10370 SymbolObject* SymbolObject::Cast(
v8::Value* value) {
10371 #ifdef V8_ENABLE_CHECKS 10374 return static_cast<SymbolObject*
>(value);
10378 NumberObject* NumberObject::Cast(
v8::Value* value) {
10379 #ifdef V8_ENABLE_CHECKS 10382 return static_cast<NumberObject*
>(value);
10385 BigIntObject* BigIntObject::Cast(
v8::Value* value) {
10386 #ifdef V8_ENABLE_CHECKS 10389 return static_cast<BigIntObject*
>(value);
10392 BooleanObject* BooleanObject::Cast(
v8::Value* value) {
10393 #ifdef V8_ENABLE_CHECKS 10396 return static_cast<BooleanObject*
>(value);
10400 RegExp* RegExp::Cast(
v8::Value* value) {
10401 #ifdef V8_ENABLE_CHECKS 10404 return static_cast<RegExp*
>(value);
10408 Object* Object::Cast(
v8::Value* value) {
10409 #ifdef V8_ENABLE_CHECKS 10412 return static_cast<Object*
>(value);
10417 #ifdef V8_ENABLE_CHECKS 10420 return static_cast<Array*
>(value);
10425 #ifdef V8_ENABLE_CHECKS 10428 return static_cast<Map*
>(value);
10433 #ifdef V8_ENABLE_CHECKS 10436 return static_cast<Set*
>(value);
10440 Promise* Promise::Cast(
v8::Value* value) {
10441 #ifdef V8_ENABLE_CHECKS 10444 return static_cast<Promise*
>(value);
10449 #ifdef V8_ENABLE_CHECKS 10452 return static_cast<Proxy*
>(value);
10455 WasmCompiledModule* WasmCompiledModule::Cast(
v8::Value* value) {
10456 #ifdef V8_ENABLE_CHECKS 10459 return static_cast<WasmCompiledModule*
>(value);
10462 Promise::Resolver* Promise::Resolver::Cast(
v8::Value* value) {
10463 #ifdef V8_ENABLE_CHECKS 10466 return static_cast<Promise::Resolver*
>(value);
10470 ArrayBuffer* ArrayBuffer::Cast(
v8::Value* value) {
10471 #ifdef V8_ENABLE_CHECKS 10474 return static_cast<ArrayBuffer*
>(value);
10478 ArrayBufferView* ArrayBufferView::Cast(
v8::Value* value) {
10479 #ifdef V8_ENABLE_CHECKS 10482 return static_cast<ArrayBufferView*
>(value);
10486 TypedArray* TypedArray::Cast(
v8::Value* value) {
10487 #ifdef V8_ENABLE_CHECKS 10490 return static_cast<TypedArray*
>(value);
10494 Uint8Array* Uint8Array::Cast(
v8::Value* value) {
10495 #ifdef V8_ENABLE_CHECKS 10498 return static_cast<Uint8Array*
>(value);
10502 Int8Array* Int8Array::Cast(
v8::Value* value) {
10503 #ifdef V8_ENABLE_CHECKS 10506 return static_cast<Int8Array*
>(value);
10510 Uint16Array* Uint16Array::Cast(
v8::Value* value) {
10511 #ifdef V8_ENABLE_CHECKS 10514 return static_cast<Uint16Array*
>(value);
10518 Int16Array* Int16Array::Cast(
v8::Value* value) {
10519 #ifdef V8_ENABLE_CHECKS 10522 return static_cast<Int16Array*
>(value);
10526 Uint32Array* Uint32Array::Cast(
v8::Value* value) {
10527 #ifdef V8_ENABLE_CHECKS 10530 return static_cast<Uint32Array*
>(value);
10534 Int32Array* Int32Array::Cast(
v8::Value* value) {
10535 #ifdef V8_ENABLE_CHECKS 10538 return static_cast<Int32Array*
>(value);
10542 Float32Array* Float32Array::Cast(
v8::Value* value) {
10543 #ifdef V8_ENABLE_CHECKS 10546 return static_cast<Float32Array*
>(value);
10550 Float64Array* Float64Array::Cast(
v8::Value* value) {
10551 #ifdef V8_ENABLE_CHECKS 10554 return static_cast<Float64Array*
>(value);
10557 BigInt64Array* BigInt64Array::Cast(
v8::Value* value) {
10558 #ifdef V8_ENABLE_CHECKS 10561 return static_cast<BigInt64Array*
>(value);
10564 BigUint64Array* BigUint64Array::Cast(
v8::Value* value) {
10565 #ifdef V8_ENABLE_CHECKS 10568 return static_cast<BigUint64Array*
>(value);
10571 Uint8ClampedArray* Uint8ClampedArray::Cast(
v8::Value* value) {
10572 #ifdef V8_ENABLE_CHECKS 10575 return static_cast<Uint8ClampedArray*
>(value);
10579 DataView* DataView::Cast(
v8::Value* value) {
10580 #ifdef V8_ENABLE_CHECKS 10583 return static_cast<DataView*
>(value);
10587 SharedArrayBuffer* SharedArrayBuffer::Cast(
v8::Value* value) {
10588 #ifdef V8_ENABLE_CHECKS 10591 return static_cast<SharedArrayBuffer*
>(value);
10595 Function* Function::Cast(
v8::Value* value) {
10596 #ifdef V8_ENABLE_CHECKS 10599 return static_cast<Function*
>(value);
10603 External* External::Cast(
v8::Value* value) {
10604 #ifdef V8_ENABLE_CHECKS 10607 return static_cast<External*
>(value);
10611 template<
typename T>
10613 return *
reinterpret_cast<Isolate**
>(&args_[kIsolateIndex]);
10617 template<
typename T>
10623 template<
typename T>
10629 template<
typename T>
10635 template<
typename T>
10640 template <
typename T>
10643 return args_[kShouldThrowOnErrorIndex] != I::IntToSmi(0);
10648 typedef internal::Object* S;
10650 I::CheckInitialized(isolate);
10651 S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
10656 Local<Primitive> Null(Isolate* isolate) {
10657 typedef internal::Object* S;
10658 typedef internal::Internals I;
10659 I::CheckInitialized(isolate);
10660 S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
10661 return Local<Primitive>(
reinterpret_cast<Primitive*
>(slot));
10665 Local<Boolean> True(Isolate* isolate) {
10666 typedef internal::Object* S;
10667 typedef internal::Internals I;
10668 I::CheckInitialized(isolate);
10669 S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
10670 return Local<Boolean>(
reinterpret_cast<Boolean*
>(slot));
10674 Local<Boolean> False(Isolate* isolate) {
10675 typedef internal::Object* S;
10676 typedef internal::Internals I;
10677 I::CheckInitialized(isolate);
10678 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
10679 return Local<Boolean>(
reinterpret_cast<Boolean*
>(slot));
10685 I::SetEmbedderData(
this, slot, data);
10691 return I::GetEmbedderData(
this, slot);
10697 return I::kNumIsolateDataSlots;
10702 T* data =
reinterpret_cast<T*
>(GetDataFromSnapshotOnce(index));
10703 if (data) internal::PerformCastCheck(data);
10708 int64_t change_in_bytes) {
10710 const int64_t kMemoryReducerActivationLimit = 32 * 1024 * 1024;
10711 int64_t* external_memory =
reinterpret_cast<int64_t*
>(
10712 reinterpret_cast<uint8_t*
>(
this) + I::kExternalMemoryOffset);
10713 int64_t* external_memory_limit =
reinterpret_cast<int64_t*
>(
10714 reinterpret_cast<uint8_t*
>(
this) + I::kExternalMemoryLimitOffset);
10715 int64_t* external_memory_at_last_mc =
10716 reinterpret_cast<int64_t*
>(
reinterpret_cast<uint8_t*
>(
this) +
10717 I::kExternalMemoryAtLastMarkCompactOffset);
10718 const int64_t amount = *external_memory + change_in_bytes;
10720 *external_memory = amount;
10722 int64_t allocation_diff_since_last_mc =
10723 *external_memory_at_last_mc - *external_memory;
10724 allocation_diff_since_last_mc = allocation_diff_since_last_mc < 0
10725 ? -allocation_diff_since_last_mc
10726 : allocation_diff_since_last_mc;
10727 if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
10728 CheckMemoryPressure();
10731 if (change_in_bytes < 0) {
10732 *external_memory_limit += change_in_bytes;
10735 if (change_in_bytes > 0 && amount > *external_memory_limit) {
10736 ReportExternalAllocationLimitReached();
10738 return *external_memory;
10742 #ifndef V8_ENABLE_CHECKS 10743 typedef internal::Object O;
10744 typedef internal::HeapObject HO;
10746 HO* context = *
reinterpret_cast<HO**
>(
this);
10748 HandleScope::CreateHandle(context, I::ReadEmbedderData<O*>(
this, index));
10751 return SlowGetEmbedderData(index);
10757 #ifndef V8_ENABLE_CHECKS 10759 return I::ReadEmbedderData<void*>(
this, index);
10761 return SlowGetAlignedPointerFromEmbedderData(index);
10767 T* data =
reinterpret_cast<T*
>(GetDataFromSnapshotOnce(index));
10768 if (data) internal::PerformCastCheck(data);
10774 T* object_ptr = *object;
10775 internal::Object** p =
reinterpret_cast<internal::Object**
>(object_ptr);
10776 return AddData(context, *p);
10781 T* object_ptr = *object;
10782 internal::Object** p =
reinterpret_cast<internal::Object**
>(object_ptr);
10783 return AddData(*p);
10804 #endif // INCLUDE_V8_H_ V8_INLINE bool IsNearDeath() const
Definition: v8.h:9673
V8_INLINE uint16_t WrapperClassId() const
Definition: v8.h:9785
void(* NamedPropertyDeleterCallback)(Local< String > property, const PropertyCallbackInfo< Boolean > &info)
Definition: v8.h:5459
void(* HostInitializeImportMetaObjectCallback)(Local< Context > context, Local< Module > module, Local< Object > meta)
Definition: v8.h:6593
UseCounterFeature
Definition: v8.h:7391
IndexedPropertyHandlerConfiguration(IndexedPropertyGetterCallback getter=0, IndexedPropertySetterCallback setter=0, IndexedPropertyQueryCallback query=0, IndexedPropertyDeleterCallback deleter=0, IndexedPropertyEnumeratorCallback enumerator=0, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
Definition: v8.h:6028
IntegrityLevel
Definition: v8.h:3335
void(* IndexedPropertyDeleterCallback)(uint32_t index, const PropertyCallbackInfo< Boolean > &info)
Definition: v8.h:5668
GCCallbackFlags
Definition: v8.h:6763
KeyConversionMode
Definition: v8.h:3330
static V8_INLINE Local< Context > CreationContext(const PersistentBase< Object > &object)
Definition: v8.h:3698
Definition: v8-profiler.h:962
bool only_terminate_in_safe_scope
Definition: v8.h:7274
V8_INLINE bool IsNullOrUndefined() const
Definition: v8.h:10220
void(* NamedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Definition: v8.h:5469
WriteOptions
Definition: v8.h:2737
NewStringType
Definition: v8.h:2658
static Isolate * GetCurrent()
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
void(* GenericNamedPropertyDefinerCallback)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:5617
V8_INLINE void Clear()
Definition: v8.h:324
V8_INLINE bool IsString() const
Definition: v8.h:10238
virtual ~ExternalStringResource()
Definition: v8.h:2818
GarbageCollectionType
Definition: v8.h:7381
V8_INLINE Local< T > Escape(Local< T > value)
Definition: v8.h:1028
IndexFilter
Definition: v8.h:3324
PropertyAttribute
Definition: v8.h:3240
static V8_INLINE int InternalFieldCount(const PersistentBase< Object > &object)
Definition: v8.h:3570
V8_INLINE int Length() const
Definition: v8.h:9976
static V8_INLINE Local< T > Cast(Local< S > that)
Definition: v8.h:375
KeyCollectionMode
Definition: v8.h:3318
V8_INLINE Global(Isolate *isolate, const PersistentBase< S > &that)
Definition: v8.h:899
V8_INLINE bool IsWeak() const
Definition: v8.h:9684
static V8_INLINE void * GetAlignedPointerFromInternalField(const PersistentBase< Object > &object, int index)
Definition: v8.h:3589
void(* GenericNamedPropertyDeleterCallback)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info)
Definition: v8.h:5585
void(* NamedPropertySetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:5438
V8_WARN_UNUSED_RESULT Maybe< bool > SetNativeDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=nullptr, Local< Value > data=Local< Value >(), PropertyAttribute attributes=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect)
EmbedderDataFields
Definition: v8.h:9140
virtual ~ExternalOneByteStringResource()
Definition: v8.h:2851
void(* IndexedPropertyDescriptorCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:5691
size_t does_zap_garbage()
Definition: v8.h:6811
void(* AccessorGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:3256
V8_INLINE bool IsEmpty() const
Definition: v8.h:319
Definition: v8-util.h:162
V8_INLINE Local< Object > Holder() const
Definition: v8.h:9940
V8_INLINE Persistent(Isolate *isolate, Local< S > that)
Definition: v8.h:795
V8_INLINE Local< Value > NewTarget() const
Definition: v8.h:9946
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:10612
V8_INLINE T FromJust() const
Definition: v8.h:8756
V8_INLINE bool ShouldThrowOnError() const
Definition: v8.h:10641
V8_INLINE void SetWeak()
Definition: v8.h:9732
PropertyHandlerFlags
Definition: v8.h:5947
JitCodeEventOptions
Definition: v8.h:6998
V8_INLINE Local< S > As() const
Definition: v8.h:390
static void * JSStackComparableAddress(TryCatch *handler)
Definition: v8.h:8956
bool(* EntropySource)(unsigned char *buffer, size_t length)
Definition: v8.h:8367
static V8_WARN_UNUSED_RESULT MaybeLocal< String > NewFromUtf8(Isolate *isolate, const char *data, v8::NewStringType type, int length=-1)
V8_INLINE void * GetAlignedPointerFromEmbedderData(int index)
Definition: v8.h:10756
void(* IndexedPropertyDefinerCallback)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:5684
V8_INLINE Global()
Definition: v8.h:882
V8_INLINE Unlocker(Isolate *isolate)
Definition: v8.h:9348
V8_INLINE Persistent(const Persistent &that)
Definition: v8.h:815
V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local< S > *out) const
Definition: v8.h:471
bool(* AccessCheckCallback)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data)
Definition: v8.h:5710
CreateHistogramCallback create_histogram_callback
Definition: v8.h:7248
void(* GenericNamedPropertyQueryCallback)(Local< Name > property, const PropertyCallbackInfo< Integer > &info)
Definition: v8.h:5561
V8_DEPRECATE_SOON("Objects are always considered independent. " "Use MarkActive to avoid collecting otherwise dead weak handles.", V8_INLINE void MarkIndependent())
void(* GenericNamedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Definition: v8.h:5594
StartupData * snapshot_blob
Definition: v8.h:7233
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
Definition: v8-platform.h:16
V8_INLINE Local< Value > operator[](int i) const
Definition: v8.h:9927
V8_INLINE Global & operator=(Global< S > &&rhs)
Definition: v8.h:914
V8_INLINE bool operator!=(const Local< S > &that) const
Definition: v8.h:361
CounterLookupCallback counter_lookup_callback
Definition: v8.h:7240
AccessType
Definition: v8.h:5697
AtomicsWaitEvent
Definition: v8.h:7779
Definition: v8-util.h:426
void(* GenericNamedPropertyDescriptorCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:5640
V8_INLINE bool operator==(const Local< S > &that) const
Definition: v8.h:337
void(* IndexedPropertyGetterCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:5646
V8_INLINE Local< Value > GetEmbedderData(int index)
Definition: v8.h:10741
V8_INLINE Local< T > ToLocalChecked()
Definition: v8.h:9626
V8_INLINE Local< Value > Data() const
Definition: v8.h:9952
V8_INLINE ReturnValue< T > GetReturnValue() const
Definition: v8.h:10636
void(* NamedPropertyGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:5429
V8_WARN_UNUSED_RESULT V8_INLINE bool To(T *out) const
Definition: v8.h:8747
V8_INLINE ExternalStringResourceBase * GetExternalStringResourceBase(Encoding *encoding_out) const
Definition: v8.h:10165
FunctionEntryHook entry_hook
Definition: v8.h:7217
V8_INLINE Persistent()
Definition: v8.h:788
V8_INLINE void MarkActive()
Definition: v8.h:9766
V8_INLINE Local< Value > Data() const
Definition: v8.h:10618
void(* IndexedPropertySetterCallback)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:5653
size_t length() const
Definition: v8.h:6354
V8_WARN_UNUSED_RESULT Maybe< bool > SetAccessor(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, AccessorNameSetterCallback setter=0, MaybeLocal< Value > data=MaybeLocal< Value >(), AccessControl settings=DEFAULT, PropertyAttribute attribute=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect)
Flags
Definition: v8.h:5259
V8_INLINE Local(Local< S > that)
Definition: v8.h:306
V8_INLINE Locker(Isolate *isolate)
Definition: v8.h:9363
void(* IndexedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
Definition: v8.h:5678
void(* IndexedPropertyQueryCallback)(uint32_t index, const PropertyCallbackInfo< Integer > &info)
Definition: v8.h:5661
bool allow_atomics_wait
Definition: v8.h:7269
const intptr_t * external_references
Definition: v8.h:7263
V8_INLINE void SetData(uint32_t slot, void *data)
Definition: v8.h:10683
void Set(Local< Name > name, Local< Data > value, PropertyAttribute attributes=None)
Definition: v8-util.h:569
void(* JitCodeEventHandler)(const JitCodeEvent *event)
Definition: v8.h:7010
size_t(* NearHeapLimitCallback)(void *data, size_t current_heap_limit, size_t initial_heap_limit)
Definition: v8.h:6784
V8_INLINE Persistent(Isolate *isolate, const Persistent< S, M2 > &that)
Definition: v8.h:805
V8_INLINE Global(Isolate *isolate, Local< S > that)
Definition: v8.h:889
V8_INLINE Local< Object > Holder() const
Definition: v8.h:10630
static V8_INLINE uint32_t GetNumberOfDataSlots()
Definition: v8.h:10695
V8_INLINE ReturnValue< T > GetReturnValue() const
Definition: v8.h:9964
SideEffectType
Definition: v8.h:3309
V8_INLINE void SetWrapperClassId(uint16_t class_id)
Definition: v8.h:9775
V8_INLINE void * GetAlignedPointerFromInternalField(int index)
Definition: v8.h:10112
static V8_INLINE Local< T > New(Isolate *isolate, Local< T > that)
Definition: v8.h:9589
V8_INLINE T FromMaybe(const T &default_value) const
Definition: v8.h:8765
void(* GenericNamedPropertyGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:5512
V8_INLINE ExternalStringResource * GetExternalStringResource() const
Definition: v8.h:10147
StackTraceOptions
Definition: v8.h:1834
JitCodeEventHandler code_event_handler
Definition: v8.h:7223
PromiseHookType
Definition: v8.h:6613
V8_INLINE size_t AddData(Local< Context > context, Local< T > object)
static V8_INLINE Local< String > Empty(Isolate *isolate)
Definition: v8.h:10138
V8_INLINE Global(Global &&other)
Definition: v8.h:906
V8_INLINE void * GetData(uint32_t slot)
Definition: v8.h:10689
ArrayBuffer::Allocator * array_buffer_allocator
Definition: v8.h:7255
V8_INLINE int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes)
Definition: v8.h:10707
V8_INLINE bool IsNull() const
Definition: v8.h:10203
bool(* AllowCodeGenerationFromStringsCallback)(Local< Context > context, Local< String > source)
Definition: v8.h:6715
V8_INLINE void RegisterExternalReference(Isolate *isolate) const
Definition: v8.h:9750
MemoryPressureLevel
Definition: v8.h:7041
GCType
Definition: v8.h:6740
MicrotasksPolicy
Definition: v8.h:6660
const char * data() const
Definition: v8.h:6353
Definition: v8-profiler.h:719
V8_INLINE Local< Object > This() const
Definition: v8.h:10624
MaybeLocal< Promise >(* HostImportModuleDynamicallyCallback)(Local< Context > context, Local< ScriptOrModule > referrer, Local< String > specifier)
Definition: v8.h:6579
V8_INLINE void AnnotateStrongRetainer(const char *label)
Definition: v8.h:9744
NoCacheReason
Definition: v8.h:1566
V8_INLINE bool IsUndefined() const
Definition: v8.h:10185
V8_INLINE bool IsConstructCall() const
Definition: v8.h:9970
V8_INLINE T ToChecked() const
Definition: v8.h:8741
V8_INLINE Local< S > FromMaybe(Local< S > default_value) const
Definition: v8.h:487
virtual void Dispose()
Definition: v8.h:2794
void(* GenericNamedPropertySetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
Definition: v8.h:5536
V8_INLINE Local< Object > This() const
Definition: v8.h:9934
AllocationMode
Definition: v8.h:4614
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
Definition: v8.h:8382
V8_WARN_UNUSED_RESULT Maybe< bool > SetLazyDataProperty(Local< Context > context, Local< Name > name, AccessorNameGetterCallback getter, Local< Value > data=Local< Value >(), PropertyAttribute attributes=None, SideEffectType getter_side_effect_type=SideEffectType::kHasSideEffect)
Status
Definition: v8.h:1264
PromiseState
Definition: v8.h:4182
V8_INLINE void Reset()
Definition: v8.h:9693
AccessControl
Definition: v8.h:3283
void(* FunctionEntryHook)(uintptr_t function, uintptr_t return_addr_location)
Definition: v8.h:6897
Definition: v8-util.h:354
Global Pass()
Definition: v8.h:926
V8_INLINE Isolate * GetIsolate() const
Definition: v8.h:9958
void(* NamedPropertyQueryCallback)(Local< String > property, const PropertyCallbackInfo< Integer > &info)
Definition: v8.h:5449
PropertyFilter
Definition: v8.h:3293
ResourceConstraints constraints
Definition: v8.h:7228
RAILMode
Definition: v8.h:6978
V8_INLINE Local< Value > GetInternalField(int index)
Definition: v8.h:10090
void SetIndexedPropertyHandler(IndexedPropertyGetterCallback getter, IndexedPropertySetterCallback setter=0, IndexedPropertyQueryCallback query=0, IndexedPropertyDeleterCallback deleter=0, IndexedPropertyEnumeratorCallback enumerator=0, Local< Value > data=Local< Value >())
Definition: v8.h:6204
V8_INLINE ~Persistent()
Definition: v8.h:836
NamedPropertyHandlerConfiguration(GenericNamedPropertyGetterCallback getter=0, GenericNamedPropertySetterCallback setter=0, GenericNamedPropertyQueryCallback query=0, GenericNamedPropertyDeleterCallback deleter=0, GenericNamedPropertyEnumeratorCallback enumerator=0, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
Definition: v8.h:5977