37 class AccessorSignature;
49 class FunctionTemplate;
51 class ImplementationUtilities;
62 class ObjectOperationDescriptor;
69 class RawOperationDescriptor;
92 template <
class T,
class M = NonCopyablePersistentTraits<T> >
99 template <
class K,
class V,
class T>
101 template <
class K,
class V,
class T>
112 class CallHandlerHelper;
118 class DeferredHandles;
122 class LocalEmbedderHeapTracer;
124 class NeverReadOnlySpaceObject;
125 struct ScriptStreamingData;
127 class PropertyCallbackArguments;
128 class FunctionCallbackArguments;
130 class ScopedExternalStringLock;
134 class StreamingDecoder;
140 class ConsoleCallArguments;
145 #define TYPE_CHECK(T, S) \ 147 *(static_cast<T* volatile*>(0)) = static_cast<S*>(0); \ 187 : val_(reinterpret_cast<T*>(*that)) {
220 if (a ==
nullptr)
return b ==
nullptr;
221 if (b ==
nullptr)
return false;
229 if (a ==
nullptr)
return b ==
nullptr;
230 if (b ==
nullptr)
return false;
256 #ifdef V8_ENABLE_CHECKS 259 if (that.IsEmpty())
return Local<T>();
289 template<
class F>
friend class Local;
306 template <
class F1,
class F2,
class F3>
320 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS) 343 : val_(reinterpret_cast<T*>(*that)) {
355 out->val_ =
IsEmpty() ? nullptr : this->val_;
382 template <
class T>
class Eternal {
387 Set(isolate, handle);
399 static const int kInternalFieldsInWeakCallback = 2;
400 static const int kEmbedderFieldsInWeakCallback = 2;
402 template <
typename T>
408 void* embedder_fields[kEmbedderFieldsInWeakCallback],
410 : isolate_(isolate), parameter_(parameter), callback_(callback) {
411 for (
int i = 0; i < kEmbedderFieldsInWeakCallback; ++i) {
412 embedder_fields_[i] = embedder_fields[i];
432 void* embedder_fields_[kEmbedderFieldsInWeakCallback];
456 template <
class T>
class PersistentBase {
488 if (a ==
nullptr)
return b ==
nullptr;
489 if (b ==
nullptr)
return false;
497 if (a ==
nullptr)
return b ==
nullptr;
498 if (b ==
nullptr)
return false;
519 template <
typename P>
553 "Used TracedGlobal and EmbedderHeapTracer::RegisterEmbedderReference",
563 "Weak objects are always considered independent. " 564 "Use TracedGlobal when trying to use EmbedderHeapTracer. " 565 "Use a strong handle when trying to keep an object alive.",
580 V8_DEPRECATED(
"Garbage collection internal state should not be relied on.",
603 template<
class F>
friend class Local;
609 template <
class F1,
class F2,
class F3>
628 class NonCopyablePersistentTraits {
632 template<
class S,
class M>
635 Uncompilable<Object>();
652 template<
class S,
class M>
668 template <
class T,
class M>
class Persistent :
public PersistentBase<T> {
689 template <
class S,
class M2>
703 template <
class S,
class M2>
711 template <
class S,
class M2>
722 if (M::kResetInDestructor) this->
Reset();
728 #ifdef V8_ENABLE_CHECKS 731 if (!that.IsEmpty()) T::Cast(*that);
745 template<
class F>
friend class Local;
750 V8_INLINE T* operator*()
const {
return this->val_; }
751 template<
class S,
class M2>
752 V8_INLINE void Copy(
const Persistent<S, M2>& that);
762 class Global :
public PersistentBase<T> {
820 V8_INLINE T* operator*()
const {
return this->val_; }
839 template <
typename T>
856 : val_(New(isolate, *that, &val_)) {
881 bool IsEmpty()
const {
return val_ ==
nullptr; }
911 if (a ==
nullptr)
return b ==
nullptr;
912 if (b ==
nullptr)
return false;
920 if (a ==
nullptr)
return b ==
nullptr;
921 if (b ==
nullptr)
return false;
927 return !operator==(that);
932 return !operator==(that);
938 V8_INLINE void SetWrapperClassId(uint16_t class_id);
944 V8_INLINE uint16_t WrapperClassId()
const;
962 T* operator*()
const {
return this->val_; }
967 template <
typename F>
970 template <
typename F>
997 static int NumberOfHandles(
Isolate* isolate);
1000 return reinterpret_cast<Isolate*>(isolate_);
1009 void Initialize(
Isolate* isolate);
1017 void*
operator new(
size_t size);
1018 void*
operator new[](
size_t size);
1019 void operator delete(
void*, size_t);
1020 void operator delete[](
void*, size_t);
1022 internal::Isolate* isolate_;
1052 Escape(reinterpret_cast<internal::Address*>(*value));
1053 return Local<T>(reinterpret_cast<T*>(slot));
1067 void*
operator new(
size_t size);
1068 void*
operator new[](
size_t size);
1069 void operator delete(
void*, size_t);
1070 void operator delete[](
void*, size_t);
1092 void*
operator new(
size_t size);
1093 void*
operator new[](
size_t size);
1094 void operator delete(
void*, size_t);
1095 void operator delete[](
void*, size_t);
1097 internal::Isolate*
const isolate_;
1099 int prev_sealed_level_;
1157 bool is_opaque =
false,
bool is_wasm =
false,
1158 bool is_module =
false)
1159 : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
1160 (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) |
1161 (is_module ? kIsModule : 0)) {}
1164 (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {}
1167 return (flags_ & kIsSharedCrossOrigin) != 0;
1169 bool IsOpaque()
const {
return (flags_ & kIsOpaque) != 0; }
1170 bool IsWasm()
const {
return (flags_ & kIsWasm) != 0; }
1171 bool IsModule()
const {
return (flags_ & kIsModule) != 0; }
1177 kIsSharedCrossOrigin = 1,
1246 int GetLineNumber(
int code_pos);
1248 static const int kNoScriptId = 0;
1267 : line_number_(line_number), column_number_(column_number) {}
1298 Status GetStatus()
const;
1308 int GetModuleRequestsLength()
const;
1320 Location GetModuleRequestLocation(
int i)
const;
1325 int GetIdentityHash()
const;
1339 ResolveCallback callback);
1416 buffer_policy(BufferNotOwned) {}
1423 BufferPolicy buffer_policy = BufferNotOwned);
1508 virtual size_t GetMoreData(
const uint8_t** src) = 0;
1520 virtual bool SetBookmark();
1525 virtual void ResetToBookmark();
1541 internal::ScriptStreamingData*
impl()
const {
return impl_.get(); }
1548 std::unique_ptr<internal::ScriptStreamingData> impl_;
1565 internal::ScriptStreamingData* data_;
1569 kNoCompileOptions = 0,
1578 kNoCacheNoReason = 0,
1592 kNoCacheBecauseDeferredProduceCodeCache
1609 Isolate* isolate, Source* source,
1610 CompileOptions options = kNoCompileOptions,
1611 NoCacheReason no_cache_reason = kNoCacheNoReason);
1626 CompileOptions options = kNoCompileOptions,
1627 NoCacheReason no_cache_reason = kNoCacheNoReason);
1640 static ScriptStreamingTask* StartStreamingScript(
1641 Isolate* isolate, StreamedSource* source,
1642 CompileOptions options = kNoCompileOptions);
1673 static uint32_t CachedDataVersionTag();
1683 Isolate* isolate, Source* source,
1684 CompileOptions options = kNoCompileOptions,
1685 NoCacheReason no_cache_reason = kNoCacheNoReason);
1701 CompileOptions options = kNoCompileOptions,
1702 NoCacheReason no_cache_reason = kNoCacheNoReason);
1716 static CachedData* CreateCodeCache(
1725 static CachedData* CreateCodeCacheForFunction(
Local<Function> function);
1729 Isolate* isolate, Source* source, CompileOptions options,
1730 NoCacheReason no_cache_reason);
1777 int GetStartPosition()
const;
1783 int GetEndPosition()
const;
1788 int ErrorLevel()
const;
1794 int GetStartColumn()
const;
1801 int GetEndColumn()
const;
1808 bool IsSharedCrossOrigin()
const;
1809 bool IsOpaque()
const;
1812 static void PrintCurrentStackTrace(
Isolate* isolate, FILE* out);
1814 static const int kNoLineNumberInfo = 0;
1815 static const int kNoColumnInfo = 0;
1816 static const int kNoScriptIdInfo = 0;
1835 kColumnOffset = 1 << 1 | kLineNumber,
1836 kScriptName = 1 << 2,
1837 kFunctionName = 1 << 3,
1839 kIsConstructor = 1 << 5,
1840 kScriptNameOrSourceURL = 1 << 6,
1842 kExposeFramesAcrossSecurityOrigins = 1 << 8,
1843 kOverview = kLineNumber | kColumnOffset | kScriptName | kFunctionName,
1844 kDetailed = kOverview | kIsEval | kIsConstructor | kScriptNameOrSourceURL
1855 int GetFrameCount()
const;
1865 Isolate* isolate,
int frame_limit, StackTraceOptions options = kDetailed);
1880 int GetLineNumber()
const;
1889 int GetColumn()
const;
1897 int GetScriptId()
const;
1922 bool IsEval()
const;
1928 bool IsConstructor()
const;
1933 bool IsWasm()
const;
2024 virtual void ThrowDataCloneError(
Local<String> message) = 0;
2059 virtual void* ReallocateBufferMemory(
void* old_buffer,
size_t size,
2060 size_t* actual_size);
2067 virtual void FreeBufferMemory(
void* buffer);
2098 void TransferArrayBuffer(uint32_t transfer_id,
2109 void SetTreatArrayBufferViewsAsHostObjects(
bool mode);
2116 void WriteUint32(uint32_t value);
2117 void WriteUint64(uint64_t value);
2118 void WriteDouble(
double value);
2119 void WriteRawBytes(
const void* source,
size_t length);
2126 PrivateData* private_;
2151 Isolate* isolate, uint32_t transfer_id);
2158 Isolate* isolate, uint32_t clone_id);
2181 void TransferArrayBuffer(uint32_t transfer_id,
2189 void TransferSharedArrayBuffer(uint32_t
id,
2199 void SetSupportsLegacyWireFormat(
bool supports_legacy_wire_format);
2204 void SetExpectInlineWasm(
bool allow_inline_wasm);
2211 uint32_t GetWireFormatVersion()
const;
2228 PrivateData* private_;
2257 V8_INLINE bool IsNullOrUndefined()
const;
2262 bool IsTrue()
const;
2267 bool IsFalse()
const;
2272 bool IsName()
const;
2283 bool IsSymbol()
const;
2288 bool IsFunction()
const;
2294 bool IsArray()
const;
2299 bool IsObject()
const;
2304 bool IsBigInt()
const;
2309 bool IsBoolean()
const;
2314 bool IsNumber()
const;
2319 bool IsExternal()
const;
2324 bool IsInt32()
const;
2329 bool IsUint32()
const;
2334 bool IsDate()
const;
2339 bool IsArgumentsObject()
const;
2344 bool IsBigIntObject()
const;
2349 bool IsBooleanObject()
const;
2354 bool IsNumberObject()
const;
2359 bool IsStringObject()
const;
2364 bool IsSymbolObject()
const;
2369 bool IsNativeError()
const;
2374 bool IsRegExp()
const;
2379 bool IsAsyncFunction()
const;
2384 bool IsGeneratorFunction()
const;
2389 bool IsGeneratorObject()
const;
2394 bool IsPromise()
const;
2409 bool IsMapIterator()
const;
2414 bool IsSetIterator()
const;
2419 bool IsWeakMap()
const;
2424 bool IsWeakSet()
const;
2429 bool IsArrayBuffer()
const;
2434 bool IsArrayBufferView()
const;
2439 bool IsTypedArray()
const;
2444 bool IsUint8Array()
const;
2449 bool IsUint8ClampedArray()
const;
2454 bool IsInt8Array()
const;
2459 bool IsUint16Array()
const;
2464 bool IsInt16Array()
const;
2469 bool IsUint32Array()
const;
2474 bool IsInt32Array()
const;
2479 bool IsFloat32Array()
const;
2484 bool IsFloat64Array()
const;
2489 bool IsBigInt64Array()
const;
2494 bool IsBigUint64Array()
const;
2499 bool IsDataView()
const;
2505 bool IsSharedArrayBuffer()
const;
2510 bool IsProxy()
const;
2512 bool IsWebAssemblyCompiledModule()
const;
2517 bool IsModuleNamespaceObject()
const;
2557 bool BooleanValue(
Isolate* isolate)
const;
2559 V8_DEPRECATED(
"BooleanValue can never throw. Use Isolate version.",
2582 V8_INLINE bool QuickIsUndefined()
const;
2584 V8_INLINE bool QuickIsNullOrUndefined()
const;
2586 bool FullIsUndefined()
const;
2587 bool FullIsNull()
const;
2588 bool FullIsString()
const;
2625 int GetIdentityHash();
2630 static void CheckCast(
Value* obj);
2663 UNKNOWN_ENCODING = 0x1,
2664 TWO_BYTE_ENCODING = 0x0,
2665 ONE_BYTE_ENCODING = 0x8
2676 int Utf8Length(
Isolate* isolate)
const;
2684 bool IsOneByte()
const;
2691 bool ContainsOnlyOneByte()
const;
2720 HINT_MANY_WRITES_EXPECTED = 1,
2721 NO_NULL_TERMINATION = 2,
2722 PRESERVE_ONE_BYTE_NULL = 4,
2726 REPLACE_INVALID_UTF8 = 8
2730 int Write(
Isolate* isolate, uint16_t* buffer,
int start = 0,
int length = -1,
2731 int options = NO_OPTIONS)
const;
2733 int WriteOneByte(
Isolate* isolate, uint8_t* buffer,
int start = 0,
2734 int length = -1,
int options = NO_OPTIONS)
const;
2736 int WriteUtf8(
Isolate* isolate,
char* buffer,
int length = -1,
2737 int* nchars_ref =
nullptr,
int options = NO_OPTIONS)
const;
2747 bool IsExternal()
const;
2752 bool IsExternalOneByte()
const;
2799 friend class internal::Heap;
2801 friend class internal::ScopedExternalStringLock;
2822 virtual const uint16_t* data()
const = 0;
2827 virtual size_t length()
const = 0;
2852 virtual const char* data()
const = 0;
2854 virtual size_t length()
const = 0;
2889 "Use maybe version",
2908 "Use maybe version",
2935 Isolate* isolate, ExternalStringResource* resource);
2946 bool MakeExternal(ExternalStringResource* resource);
2957 "Use maybe version",
2959 ExternalOneByteStringResource* resource));
2961 Isolate* isolate, ExternalOneByteStringResource* resource);
2972 bool MakeExternal(ExternalOneByteStringResource* resource);
2977 bool CanMakeExternal();
2995 char* operator*() {
return str_; }
2996 const char* operator*()
const {
return str_; }
3001 void operator=(
const Utf8Value&) =
delete;
3018 uint16_t* operator*() {
return str_; }
3019 const uint16_t* operator*()
const {
return str_; }
3024 void operator=(
const Value&) =
delete;
3032 void VerifyExternalStringResourceBase(ExternalStringResourceBase* v,
3033 Encoding encoding)
const;
3034 void VerifyExternalStringResource(ExternalStringResource* val)
const;
3035 ExternalStringResource* GetExternalStringResourceSlow()
const;
3036 ExternalStringResourceBase* GetExternalStringResourceBaseSlow(
3091 static void CheckCast(
Value* obj);
3129 static void CheckCast(
Data* that);
3138 double Value()
const;
3154 int64_t
Value()
const;
3167 int32_t
Value()
const;
3181 uint32_t
Value()
const;
3204 int word_count,
const uint64_t* words);
3212 uint64_t Uint64Value(
bool* lossless =
nullptr)
const;
3219 int64_t Int64Value(
bool* lossless =
nullptr)
const;
3225 int WordCount()
const;
3235 void ToWordsArray(
int* sign_bit,
int* word_count, uint64_t* words)
const;
3585 int InternalFieldCount();
3590 return object.val_->InternalFieldCount();
3595 return object.val_->InternalFieldCount();
3609 V8_INLINE void* GetAlignedPointerFromInternalField(
int index);
3614 return object.val_->GetAlignedPointerFromInternalField(index);
3620 return object.val_->GetAlignedPointerFromInternalField(index);
3628 void SetAlignedPointerInInternalField(
int index,
void* value);
3629 void SetAlignedPointerInInternalFields(
int argc,
int indices[],
3674 GetRealNamedPropertyAttributesInPrototypeChain(
Local<Context> context,
3694 bool HasNamedLookupInterceptor();
3697 bool HasIndexedLookupInterceptor();
3706 int GetIdentityHash();
3723 return object.val_->CreationContext();
3736 bool IsConstructor();
3789 static void CheckCast(
Value* obj);
3791 void* SlowGetAlignedPointerFromInternalField(
int index);
3800 uint32_t Length()
const;
3817 static void CheckCast(
Value* obj);
3826 size_t Size()
const;
3853 static void CheckCast(
Value* obj);
3862 size_t Size()
const;
3885 static void CheckCast(
Value* obj);
3889 template<
typename T>
3893 : value_(that.value_) {
3897 template <
typename S>
3900 template <
typename S>
3902 template <
typename S>
3904 template <
typename S>
3919 template <
typename S>
3931 template <
class F,
class G,
class H>
3946 template<
typename T>
3947 class FunctionCallbackInfo {
4002 template<
typename T>
4095 friend class internal::PropertyCallbackArguments;
4134 return NewInstance(context, 0,
nullptr);
4177 int GetScriptLineNumber()
const;
4182 int GetScriptColumnNumber()
const;
4187 int ScriptId()
const;
4201 static void CheckCast(
Value* obj);
4204 #ifndef V8_PROMISE_INTERNAL_FIELD_COUNT 4206 #define V8_PROMISE_INTERNAL_FIELD_COUNT 0 4247 static void CheckCast(
Value* obj);
4286 void MarkAsHandled();
4294 static void CheckCast(
Value* obj);
4342 bool has_value()
const;
4345 bool has_get()
const;
4347 bool has_set()
const;
4349 void set_enumerable(
bool enumerable);
4350 bool enumerable()
const;
4351 bool has_enumerable()
const;
4353 void set_configurable(
bool configurable);
4354 bool configurable()
const;
4355 bool has_configurable()
const;
4357 bool writable()
const;
4358 bool has_writable()
const;
4367 PrivateData* private_;
4392 static void CheckCast(
Value* obj);
4405 template <
typename T>
4411 constexpr
MemorySpan(T* data,
size_t size) : data_(data), size_(size) {}
4414 constexpr T*
data()
const {
return data_; }
4416 constexpr
size_t size()
const {
return size_; }
4453 const std::shared_ptr<internal::wasm::NativeModule> native_module_;
4474 typedef std::shared_ptr<internal::wasm::NativeModule> SharedModule;
4477 : shared_module_(std::move(shared_module)) {}
4479 : serialized_(std::move(serialized)), wire_bytes_(std::move(bytes)) {}
4481 SharedModule shared_module_;
4483 OwnedBuffer wire_bytes_ = {
nullptr, 0};
4491 TransferrableModule GetTransferrableModule();
4497 static MaybeLocal<WasmModuleObject> FromTransferrableModule(
4498 Isolate* isolate,
const TransferrableModule&);
4504 CompiledWasmModule GetCompiledModule();
4510 static MaybeLocal<WasmModuleObject> DeserializeOrCompile(
4511 Isolate* isolate, MemorySpan<const uint8_t> serialized_module,
4512 MemorySpan<const uint8_t> wire_bytes);
4513 V8_INLINE static WasmModuleObject* Cast(Value* obj);
4516 static MaybeLocal<WasmModuleObject> Deserialize(
4517 Isolate* isolate, MemorySpan<const uint8_t> serialized_module,
4518 MemorySpan<const uint8_t> wire_bytes);
4519 static MaybeLocal<WasmModuleObject> Compile(Isolate* isolate,
4520 const uint8_t* start,
4522 static MemorySpan<const uint8_t> AsReference(
const OwnedBuffer& buff) {
4523 return {buff.buffer.get(), buff.size};
4527 static void CheckCast(Value* obj);
4531 typedef WasmModuleObject WasmCompiledModule);
4541 class WasmStreamingImpl;
4548 virtual ~
Client() =
default;
4556 explicit WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl);
4564 void OnBytesReceived(
const uint8_t* bytes,
size_t size);
4587 bool SetCompiledModuleBytes(
const uint8_t* bytes,
size_t size);
4593 void SetClient(std::shared_ptr<Client> client);
4600 static std::shared_ptr<WasmStreaming> Unpack(
Isolate* isolate,
4604 std::unique_ptr<WasmStreamingImpl> impl_;
4615 void OnBytesReceived(
const uint8_t*,
size_t size);
4650 std::shared_ptr<internal::wasm::StreamingDecoder> streaming_decoder_;
4653 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 4655 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2 4690 virtual void* Allocate(
size_t length) = 0;
4696 virtual void* AllocateUninitialized(
size_t length) = 0;
4702 virtual void Free(
void* data,
size_t length) = 0;
4717 static Allocator* NewDefaultAllocator();
4736 allocation_base_(nullptr),
4737 allocation_length_(0),
4740 deleter_data_(nullptr) {}
4745 return allocation_mode_;
4748 void*
Data()
const {
return data_; }
4754 Contents(
void* data,
size_t byte_length,
void* allocation_base,
4755 size_t allocation_length,
4757 void* deleter_data);
4760 size_t byte_length_;
4761 void* allocation_base_;
4762 size_t allocation_length_;
4764 DeleterCallback deleter_;
4765 void* deleter_data_;
4774 size_t ByteLength()
const;
4794 Isolate* isolate,
void* data,
size_t byte_length,
4801 bool IsExternal()
const;
4806 bool IsDetachable()
const;
4810 inline bool IsNeuterable()
const) {
4811 return IsDetachable();
4835 Contents Externalize();
4845 Contents GetContents();
4854 static void CheckCast(
Value* obj);
4858 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 4860 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2 4877 size_t ByteOffset();
4881 size_t ByteLength();
4892 size_t CopyContents(
void* dest,
size_t byte_length);
4898 bool HasBuffer()
const;
4902 static const int kInternalFieldCount =
4904 static const int kEmbedderFieldCount =
4909 static void CheckCast(
Value* obj);
4934 static void CheckCast(
Value* obj);
4944 size_t byte_offset,
size_t length);
4946 size_t byte_offset,
size_t length);
4951 static void CheckCast(
Value* obj);
4961 size_t byte_offset,
size_t length);
4969 static void CheckCast(
Value* obj);
4978 size_t byte_offset,
size_t length);
4980 size_t byte_offset,
size_t length);
4985 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);
5012 size_t byte_offset,
size_t length);
5014 size_t byte_offset,
size_t length);
5019 static void CheckCast(
Value* obj);
5029 size_t byte_offset,
size_t length);
5031 size_t byte_offset,
size_t length);
5036 static void CheckCast(
Value* obj);
5046 size_t byte_offset,
size_t length);
5048 size_t byte_offset,
size_t length);
5053 static void CheckCast(
Value* obj);
5063 size_t byte_offset,
size_t length);
5065 size_t byte_offset,
size_t length);
5070 static void CheckCast(
Value* obj);
5080 size_t byte_offset,
size_t length);
5082 size_t byte_offset,
size_t length);
5087 static void CheckCast(
Value* obj);
5096 size_t byte_offset,
size_t length);
5098 size_t byte_offset,
size_t length);
5103 static void CheckCast(
Value* obj);
5112 size_t byte_offset,
size_t length);
5114 size_t byte_offset,
size_t length);
5119 static void CheckCast(
Value* obj);
5128 size_t byte_offset,
size_t length);
5130 size_t byte_offset,
size_t length);
5135 static void CheckCast(
Value* obj);
5164 allocation_base_(nullptr),
5165 allocation_length_(0),
5168 deleter_data_(nullptr),
5169 is_growable_(false) {}
5174 return allocation_mode_;
5177 void*
Data()
const {
return data_; }
5184 Contents(
void* data,
size_t byte_length,
void* allocation_base,
5185 size_t allocation_length,
5186 Allocator::AllocationMode allocation_mode, DeleterCallback deleter,
5187 void* deleter_data,
bool is_growable);
5190 size_t byte_length_;
5191 void* allocation_base_;
5192 size_t allocation_length_;
5193 Allocator::AllocationMode allocation_mode_;
5194 DeleterCallback deleter_;
5195 void* deleter_data_;
5204 size_t ByteLength()
const;
5221 Isolate* isolate,
void* data,
size_t byte_length,
5236 bool IsExternal()
const;
5272 static void CheckCast(
Value* obj);
5288 double ValueOf()
const;
5320 "Use Isolate::DateTimeConfigurationChangeNotification",
5321 static void DateTimeConfigurationChangeNotification(
5323 TimeZoneDetection time_zone_detection = TimeZoneDetection::kSkip));
5326 static void CheckCast(
Value* obj);
5337 double ValueOf()
const;
5342 static void CheckCast(
Value* obj);
5357 static void CheckCast(
Value* obj);
5367 bool ValueOf()
const;
5372 static void CheckCast(
Value* obj);
5388 static void CheckCast(
Value* obj);
5404 static void CheckCast(
Value* obj);
5420 kIgnoreCase = 1 << 1,
5421 kMultiline = 1 << 2,
5450 Flags GetFlags()
const;
5455 static void CheckCast(
Value* obj);
5467 void*
Value()
const;
5472 #define V8_INTRINSICS_LIST(F) \ 5473 F(ArrayProto_entries, array_entries_iterator) \ 5474 F(ArrayProto_forEach, array_for_each_iterator) \ 5475 F(ArrayProto_keys, array_keys_iterator) \ 5476 F(ArrayProto_values, array_values_iterator) \ 5477 F(ErrorPrototype, initial_error_prototype) \ 5478 F(IteratorPrototype, initial_iterator_prototype) 5481 #define V8_DECL_INTRINSIC(name, iname) k##name, 5483 #undef V8_DECL_INTRINSIC 5506 void SetAccessorProperty(
5540 void SetNativeDataProperty(
5549 void SetNativeDataProperty(
5563 void SetLazyDataProperty(
5965 void SetCallHandler(
5970 void SetLength(
int length);
6008 void SetAcceptAnyReceiver(
bool value);
6023 void SetHiddenPrototype(
bool value));
6029 void ReadOnlyPrototype();
6035 void RemovePrototype();
6048 static void CheckCast(
Data* that);
6331 deleter, enumerator, data));
6363 void MarkAsUndetectable();
6382 void SetAccessCheckCallbackAndHandler(
6392 int InternalFieldCount();
6398 void SetInternalFieldCount(
int value);
6403 bool IsImmutableProto();
6409 void SetImmutableProto();
6417 static void CheckCast(
Data* that);
6440 static void CheckCast(
Data* that);
6459 static void CheckCast(
Data* that);
6472 Extension(
const char* name,
const char* source =
nullptr,
int dep_count = 0,
6473 const char** deps =
nullptr,
int source_length = -1);
6480 const char*
name()
const {
return name_; }
6492 void operator=(
const Extension&) =
delete;
6496 size_t source_length_;
6504 "Use unique_ptr version or stop using extension (http://crbug.com/334679).",
6543 void ConfigureDefaults(uint64_t physical_memory,
6544 uint64_t virtual_memory_limit);
6548 return max_semi_space_size_in_kb_;
6553 max_semi_space_size_in_kb_ = limit_in_kb;
6558 max_old_space_size_ = limit_in_mb;
6565 code_range_size_ = limit_in_mb;
6568 size_t max_zone_pool_size()
const) {
6569 return max_zone_pool_size_;
6572 void set_max_zone_pool_size(
size_t bytes)) {
6573 max_zone_pool_size_ = bytes;
6578 size_t max_semi_space_size_in_kb_;
6581 size_t max_old_space_size_;
6582 uint32_t* stack_limit_;
6583 size_t code_range_size_;
6584 size_t max_zone_pool_size_;
6596 const char* message);
6633 typedef int* (*CounterLookupCallback)(
const char* name);
6635 typedef void* (*CreateHistogramCallback)(
const char* name,
6728 : promise_(promise),
6731 stack_trace_(stack_trace) {}
6781 static std::unique_ptr<MicrotaskQueue> New();
6788 virtual void EnqueueMicrotask(
Isolate* isolate,
6794 virtual void EnqueueMicrotask(
v8::Isolate* isolate,
6796 void* data =
nullptr) = 0;
6810 virtual void AddMicrotasksCompletedCallback(
6816 virtual void RemoveMicrotasksCompletedCallback(
6822 virtual void PerformCheckpoint(
Isolate* isolate) = 0;
6827 virtual bool IsRunningMicrotasks()
const = 0;
6830 friend class internal::MicrotaskQueue;
6847 enum Type { kRunMicrotasks, kDoNotRunMicrotasks };
6856 static void PerformCheckpoint(
Isolate* isolate);
6861 static int GetCurrentDepth(
Isolate* isolate);
6866 static bool IsRunningMicrotasks(
Isolate* isolate);
6873 internal::Isolate*
const isolate_;
6874 internal::MicrotaskQueue*
const microtask_queue_;
6963 size_t initial_heap_limit);
6993 size_t total_heap_size_;
6994 size_t total_heap_size_executable_;
6995 size_t total_physical_size_;
6996 size_t total_available_size_;
6997 size_t used_heap_size_;
6998 size_t heap_size_limit_;
6999 size_t malloced_memory_;
7000 size_t external_memory_;
7001 size_t peak_malloced_memory_;
7002 bool does_zap_garbage_;
7003 size_t number_of_native_contexts_;
7004 size_t number_of_detached_contexts_;
7021 const char* space_name_;
7023 size_t space_used_size_;
7024 size_t space_available_size_;
7025 size_t physical_space_size_;
7040 const char* object_type_;
7041 const char* object_sub_type_;
7042 size_t object_count_;
7043 size_t object_size_;
7056 size_t code_and_metadata_size_;
7057 size_t bytecode_and_metadata_size_;
7058 size_t external_script_source_size_;
7195 uint16_t class_id) {}
7247 virtual void RegisterV8References(
7248 const std::vector<std::pair<void*, void*> >& embedder_fields) = 0;
7255 virtual void TracePrologue() = 0;
7267 virtual bool AdvanceTracing(
double deadline_in_ms) = 0;
7273 virtual bool IsTracingDone() = 0;
7280 virtual void TraceEpilogue() = 0;
7297 void FinalizeTracing();
7315 void GarbageCollectionForTesting(EmbedderStackState stack_state);
7326 friend class internal::LocalEmbedderHeapTracer;
7341 void* data_arg =
nullptr)
7358 void* data_arg =
nullptr)
7381 : code_event_handler(nullptr),
7382 snapshot_blob(nullptr),
7383 counter_lookup_callback(nullptr),
7384 create_histogram_callback(nullptr),
7385 add_histogram_sample_callback(nullptr),
7386 array_buffer_allocator(nullptr),
7387 external_references(nullptr),
7388 allow_atomics_wait(true),
7389 only_terminate_in_safe_scope(false) {}
7488 OnFailure on_failure_;
7508 void* internal_throws_;
7509 void* internal_assert_;
7510 void* internal_dump_;
7530 internal::Isolate*
const isolate_;
7531 internal::MicrotaskQueue*
const microtask_queue_;
7548 internal::Isolate* isolate_;
7558 kMinorGarbageCollection
7570 kMarkDequeOverflow = 3,
7571 kStoreBufferOverflow = 4,
7572 kSlotsBufferOverflow = 5,
7578 kRegExpPrototypeStickyGetter = 11,
7579 kRegExpPrototypeToString = 12,
7580 kRegExpPrototypeUnicodeGetter = 13,
7585 kPromiseAccept = 18,
7587 kHtmlCommentInExternalScript = 20,
7589 kSloppyModeBlockScopedFunctionRedefinition = 22,
7590 kForInInitializer = 23,
7591 kArrayProtectorDirtied = 24,
7592 kArraySpeciesModified = 25,
7593 kArrayPrototypeConstructorModified = 26,
7594 kArrayInstanceProtoModified = 27,
7595 kArrayInstanceConstructorModified = 28,
7596 kLegacyFunctionDeclaration = 29,
7597 kRegExpPrototypeSourceGetter = 30,
7598 kRegExpPrototypeOldFlagGetter = 31,
7599 kDecimalWithLeadingZeroInStrictMode = 32,
7600 kLegacyDateParser = 33,
7601 kDefineGetterOrSetterWouldThrow = 34,
7602 kFunctionConstructorReturnedUndefined = 35,
7603 kAssigmentExpressionLHSIsCallInSloppy = 36,
7604 kAssigmentExpressionLHSIsCallInStrict = 37,
7605 kPromiseConstructorReturnedUndefined = 38,
7606 kConstructorNonUndefinedPrimitiveReturn = 39,
7607 kLabeledExpressionStatement = 40,
7608 kLineOrParagraphSeparatorAsLineTerminator = 41,
7609 kIndexAccessor = 42,
7610 kErrorCaptureStackTrace = 43,
7611 kErrorPrepareStackTrace = 44,
7612 kErrorStackTraceLimit = 45,
7613 kWebAssemblyInstantiation = 46,
7614 kDeoptimizerDisableSpeculation = 47,
7615 kArrayPrototypeSortJSArrayModifiedPrototype = 48,
7616 kFunctionTokenOffsetTooLongForToString = 49,
7617 kWasmSharedMemory = 50,
7618 kWasmThreadOpcodes = 51,
7619 kAtomicsNotify = 52,
7623 kDateTimeFormat = 56,
7625 kRelativeTimeFormat = 58,
7629 kStringLocaleCompare = 62,
7630 kStringToLocaleUpperCase = 63,
7631 kStringToLocaleLowerCase = 64,
7632 kNumberToLocaleString = 65,
7633 kDateToLocaleString = 66,
7634 kDateToLocaleDateString = 67,
7635 kDateToLocaleTimeString = 68,
7636 kAttemptOverrideReadOnlyOnPrototypeSloppy = 69,
7637 kAttemptOverrideReadOnlyOnPrototypeStrict = 70,
7638 kOptimizedFunctionWithOneShotBytecode = 71,
7639 kRegExpMatchIsTrueishOnNonJSRegExp = 72,
7640 kRegExpMatchIsFalseishOnJSRegExp = 73,
7641 kDateGetTimezoneOffset = 74,
7642 kStringNormalize = 75,
7647 kUseCounterFeatureCount
7651 kMessageLog = (1 << 0),
7652 kMessageDebug = (1 << 1),
7653 kMessageInfo = (1 << 2),
7654 kMessageError = (1 << 3),
7655 kMessageWarning = (1 << 4),
7656 kMessageAll = kMessageLog | kMessageDebug | kMessageInfo | kMessageError |
7660 typedef void (*UseCounterCallback)(
Isolate* isolate,
7712 typedef bool (*AbortOnUncaughtExceptionCallback)(
Isolate*);
7713 void SetAbortOnUncaughtExceptionCallback(
7714 AbortOnUncaughtExceptionCallback callback);
7720 void SetHostImportModuleDynamicallyCallback(
7727 void SetHostInitializeImportMetaObjectCallback(
7775 void DumpAndResetStats();
7784 void DiscardThreadSpecificMetadata();
7790 V8_INLINE void SetData(uint32_t slot,
void* data);
7802 V8_INLINE static uint32_t GetNumberOfDataSlots();
7820 size_t NumberOfHeapSpaces();
7837 size_t NumberOfTrackedHeapObjectTypes();
7872 void GetStackSample(
const RegisterState& state,
void** frames,
7873 size_t frames_limit,
SampleInfo* sample_info);
7889 AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes);
7895 size_t NumberOfPhantomHandleResetsSinceLastCall();
7906 void SetIdle(
bool is_idle);
7960 void AddGCPrologueCallback(GCCallbackWithData callback,
void* data =
nullptr,
7962 void AddGCPrologueCallback(
GCCallback callback,
7969 void RemoveGCPrologueCallback(GCCallbackWithData,
void* data =
nullptr);
7970 void RemoveGCPrologueCallback(
GCCallback callback);
7993 kTerminatedExecution,
8048 size_t offset_in_bytes, int64_t value,
8049 double timeout_in_ms,
8059 void SetAtomicsWaitCallback(AtomicsWaitCallback callback,
void* data);
8070 void AddGCEpilogueCallback(GCCallbackWithData callback,
void* data =
nullptr,
8072 void AddGCEpilogueCallback(
GCCallback callback,
8079 void RemoveGCEpilogueCallback(GCCallbackWithData callback,
8080 void* data =
nullptr);
8081 void RemoveGCEpilogueCallback(
GCCallback callback);
8083 typedef size_t (*GetExternallyAllocatedMemoryInBytesCallback)();
8091 void SetGetExternallyAllocatedMemoryInBytesCallback(
8092 GetExternallyAllocatedMemoryInBytesCallback callback);
8101 void TerminateExecution();
8111 bool IsExecutionTerminating();
8127 void CancelTerminateExecution();
8199 void RunMicrotasks();
8244 void SetUseCounterCallback(UseCounterCallback callback);
8275 bool IdleNotificationDeadline(
double deadline_in_seconds);
8281 void LowMemoryNotification();
8292 int ContextDisposedNotification(
bool dependant_context =
true);
8298 void IsolateInForegroundNotification();
8304 void IsolateInBackgroundNotification();
8311 void EnableMemorySavingsMode();
8316 void DisableMemorySavingsMode();
8325 void SetRAILMode(
RAILMode rail_mode);
8331 void IncreaseHeapLimitForDebugging();
8336 void RestoreOriginalHeapLimit();
8342 bool IsHeapLimitIncreasedForDebugging();
8378 void SetStackLimit(uintptr_t stack_limit);
8395 void GetCodeRange(
void** start,
size_t* length_in_bytes);
8431 void AutomaticallyRestoreInitialHeapLimit(
double threshold_percent = 0.5);
8437 void SetAllowCodeGenerationFromStringsCallback(
8444 void SetAllowWasmCodeGenerationCallback(
8503 void SetCaptureStackTraceForUncaughtExceptions(
8504 bool capture,
int frame_limit = 10,
8528 "Use VisitHandlesWithClassIds",
8549 void SetAllowAtomicsWait(
bool allow);
8576 void DateTimeConfigurationChangeNotification(
8577 TimeZoneDetection time_zone_detection = TimeZoneDetection::kSkip);
8588 void LocaleConfigurationChangeNotification();
8596 void*
operator new(
size_t size) =
delete;
8597 void*
operator new[](
size_t size) =
delete;
8598 void operator delete(
void*, size_t) =
delete;
8599 void operator delete[](
void*, size_t) =
delete;
8602 template <
class K,
class V,
class Traits>
8606 void ReportExternalAllocationLimitReached();
8607 void CheckMemoryPressure();
8637 uintptr_t return_addr_location);
8660 static void SetNativesDataBlob(
StartupData* startup_blob);
8661 static void SetSnapshotDataBlob(
StartupData* startup_blob);
8670 static void SetFlagsFromString(
const char* str,
int length);
8675 static void SetFlagsFromCommandLine(
int* argc,
8680 static const char* GetVersion();
8686 static bool Initialize();
8698 static void SetReturnAddressLocationResolver(
8710 static bool Dispose();
8719 static bool InitializeICU(
const char* icu_data_file =
nullptr);
8733 static bool InitializeICUDefaultLocation(
const char* exec_path,
8734 const char* icu_data_file =
nullptr);
8752 static void InitializeExternalStartupData(
const char* directory_path);
8753 static void InitializeExternalStartupData(
const char* natives_blob,
8754 const char* snapshot_blob);
8759 static void InitializePlatform(
Platform* platform);
8765 static void ShutdownPlatform();
8788 static bool TryHandleSignal(
int signal_number,
void* info,
8790 #endif // V8_OS_POSIX 8798 static bool EnableWebAssemblyTrapHandler(
bool use_v8_signal_handler);
8820 static void SetFinalizationCallbackTraced(
8828 internal::Isolate* isolate);
8830 template <
class K,
class V,
class T>
8833 static void FromJustIsNothing();
8834 static void ToLocalEmpty();
8835 static void InternalFieldOutOfBounds(
int index);
8869 const intptr_t* external_references =
nullptr,
8945 StartupData CreateBlob(FunctionCodeHandling function_code_handling);
9010 return has_value_ ? value_ : default_value;
9014 return (
IsJust() == other.IsJust()) &&
9023 Maybe() : has_value_(false) {}
9024 explicit Maybe(
const T& t) : has_value_(true), value_(t) {}
9032 friend Maybe<U>
Just(
const U& u);
9053 return IsJust() == other.IsJust();
9063 Maybe() : is_valid_(false) {}
9064 explicit Maybe(JustTag) : is_valid_(true) {}
9095 bool HasCaught()
const;
9105 bool CanContinue()
const;
9119 bool HasTerminated()
const;
9174 void SetVerbose(
bool value);
9179 bool IsVerbose()
const;
9186 void SetCaptureMessage(
bool value);
9200 if (handler ==
nullptr)
return nullptr;
9201 return handler->js_stack_comparable_address_;
9205 void operator=(
const TryCatch&) =
delete;
9210 void*
operator new(
size_t size);
9211 void*
operator new[](
size_t size);
9212 void operator delete(
void*, size_t);
9213 void operator delete[](
void*, size_t);
9215 void ResetInternal();
9217 internal::Isolate* isolate_;
9221 void* js_stack_comparable_address_;
9222 bool is_verbose_ : 1;
9223 bool can_continue_ : 1;
9224 bool capture_message_ : 1;
9226 bool has_terminated_ : 1;
9228 friend class internal::Isolate;
9242 : name_count_(name_count), names_(names) { }
9244 const char**
begin()
const {
return &names_[0]; }
9245 const char**
end()
const {
return &names_[name_count_]; }
9248 const int name_count_;
9249 const char** names_;
9276 void DetachGlobal();
9323 Isolate* isolate,
size_t context_snapshot_index,
9358 void UseDefaultSecurityToken();
9389 uint32_t GetNumberOfEmbedderDataFields();
9418 V8_INLINE void* GetAlignedPointerFromEmbedderData(
int index);
9425 void SetAlignedPointerInEmbedderData(
int index,
void* value);
9440 void AllowCodeGenerationFromStrings(
bool allow);
9446 bool IsCodeGenerationFromStringsAllowed();
9453 void SetErrorMessageForCodeGenerationFromStrings(
Local<String> message);
9498 return js_stack_comparable_address_;
9502 friend class internal::Isolate;
9505 uintptr_t js_stack_comparable_address_ = 0;
9517 void* SlowGetAlignedPointerFromEmbedderData(
int index);
9606 void Initialize(
Isolate* isolate);
9608 internal::Isolate* isolate_;
9625 static bool IsLocked(
Isolate* isolate);
9630 static bool IsActive();
9634 void operator=(
const Locker&) =
delete;
9637 void Initialize(
Isolate* isolate);
9641 internal::Isolate* isolate_;
9679 static bool TryUnwindV8Frames(
const UnwindState& unwind_state,
9681 const void* stack_base);
9691 static bool PCIsInV8(
const UnwindState& unwind_state,
void* pc);
9698 return New(isolate, that.val_);
9703 return New(isolate, that.val_);
9708 return New(isolate, that.val_);
9713 if (that ==
nullptr)
return Local<T>();
9717 reinterpret_cast<internal::Isolate*>(isolate), *p)));
9725 val_ = reinterpret_cast<T*>(
9726 V8::Eternalize(isolate, reinterpret_cast<Value*>(*handle)));
9739 if (
V8_UNLIKELY(val_ ==
nullptr)) V8::ToLocalEmpty();
9746 #ifdef V8_ENABLE_CHECKS 9747 if (index < 0 || index >= kEmbedderFieldsInWeakCallback) {
9748 V8::InternalFieldOutOfBounds(index);
9751 return embedder_fields_[index];
9757 if (that ==
nullptr)
return nullptr;
9759 return reinterpret_cast<T*>(
9760 V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate),
9765 template <
class T,
class M>
9766 template <
class S,
class M2>
9770 if (that.IsEmpty())
return;
9772 this->val_ = reinterpret_cast<T*>(V8::CopyGlobalReference(p));
9773 M::Copy(that,
this);
9779 if (this->IsEmpty())
return false;
9780 return I::GetNodeFlag(reinterpret_cast<internal::Address*>(this->val_),
9781 I::kNodeIsIndependentShift);
9785 bool PersistentBase<T>::IsNearDeath()
const {
9786 typedef internal::Internals I;
9787 if (this->IsEmpty())
return false;
9788 uint8_t node_state =
9789 I::GetNodeState(reinterpret_cast<internal::Address*>(this->val_));
9790 return node_state == I::kNodeStateIsNearDeathValue ||
9791 node_state == I::kNodeStateIsPendingValue;
9798 if (this->IsEmpty())
return false;
9799 return I::GetNodeState(reinterpret_cast<internal::Address*>(this->val_)) ==
9800 I::kNodeStateIsWeakValue;
9806 if (this->IsEmpty())
return;
9807 V8::DisposeGlobal(reinterpret_cast<internal::Address*>(this->val_));
9817 if (other.IsEmpty())
return;
9818 this->val_ = New(isolate, other.val_);
9828 if (other.IsEmpty())
return;
9829 this->val_ = New(isolate, other.val_);
9834 template <
typename P>
9839 V8::MakeWeak(reinterpret_cast<internal::Address*>(this->val_), parameter,
9840 reinterpret_cast<Callback>(callback), type);
9845 V8::MakeWeak(reinterpret_cast<internal::Address**>(&this->val_));
9849 template <
typename P>
9851 return reinterpret_cast<P*>(
9852 V8::ClearWeak(reinterpret_cast<internal::Address*>(this->val_)));
9857 V8::AnnotateStrongRetainer(reinterpret_cast<internal::Address*>(this->val_),
9863 if (IsEmpty())
return;
9864 V8::RegisterExternallyReferencedObject(
9865 reinterpret_cast<internal::Address*>(this->val_),
9866 reinterpret_cast<internal::Isolate*>(isolate));
9870 void PersistentBase<T>::MarkIndependent() {
9871 typedef internal::Internals I;
9872 if (this->IsEmpty())
return;
9873 I::UpdateNodeFlag(reinterpret_cast<internal::Address*>(this->val_),
true,
9874 I::kNodeIsIndependentShift);
9878 void PersistentBase<T>::MarkActive() {
9879 typedef internal::Internals I;
9880 if (this->IsEmpty())
return;
9881 I::UpdateNodeFlag(reinterpret_cast<internal::Address*>(this->val_),
true,
9882 I::kNodeIsActiveShift);
9889 if (this->IsEmpty())
return;
9891 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
9892 *reinterpret_cast<uint16_t*>(addr) = class_id;
9899 if (this->IsEmpty())
return 0;
9901 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
9902 return *reinterpret_cast<uint16_t*>(addr);
9907 if (other.val_ !=
nullptr) {
9908 V8::MoveGlobalReference(reinterpret_cast<internal::Address**>(&other.val_),
9909 reinterpret_cast<internal::Address**>(&this->val_));
9910 other.val_ =
nullptr;
9920 if (rhs.val_ !=
nullptr) {
9921 this->val_ = rhs.val_;
9922 V8::MoveGlobalReference(
9923 reinterpret_cast<internal::Address**>(&rhs.val_),
9924 reinterpret_cast<internal::Address**>(&this->val_));
9933 if (that ==
nullptr)
return nullptr;
9935 return reinterpret_cast<T*>(V8::GlobalizeTracedReference(
9936 reinterpret_cast<internal::Isolate*>(isolate), p,
9937 reinterpret_cast<internal::Address*>(slot)));
9942 if (IsEmpty())
return;
9943 V8::DisposeTracedGlobal(reinterpret_cast<internal::Address*>(val_));
9952 if (other.IsEmpty())
return;
9953 this->val_ = New(isolate, other.val_, &val_);
9958 if (other.val_ !=
nullptr) {
9959 V8::MoveTracedGlobalReference(
9960 reinterpret_cast<internal::Address**>(&other.val_),
9961 reinterpret_cast<internal::Address**>(&this->val_));
9962 other.val_ =
nullptr;
9972 if (rhs.val_ !=
nullptr) {
9973 this->val_ = rhs.val_;
9974 V8::MoveTracedGlobalReference(
9975 reinterpret_cast<internal::Address**>(&rhs.val_),
9976 reinterpret_cast<internal::Address**>(&this->val_));
9986 if (IsEmpty())
return;
9988 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
9989 *reinterpret_cast<uint16_t*>(addr) = class_id;
9995 if (IsEmpty())
return 0;
9997 uint8_t* addr = reinterpret_cast<uint8_t*>(obj) + I::kNodeClassIdOffset;
9998 return *reinterpret_cast<uint16_t*>(addr);
10004 V8::SetFinalizationCallbackTraced(
10005 reinterpret_cast<internal::Address*>(this->val_), parameter, callback);
10008 template <
typename T>
10011 template<
typename T>
10012 template<
typename S>
10016 *value_ = GetDefaultValue();
10018 *value_ = *reinterpret_cast<internal::Address*>(*handle);
10022 template <
typename T>
10023 template <
typename S>
10027 *value_ = GetDefaultValue();
10029 *value_ = *reinterpret_cast<internal::Address*>(*handle);
10033 template <
typename T>
10034 template <
typename S>
10038 *value_ = GetDefaultValue();
10040 *value_ = *reinterpret_cast<internal::Address*>(*handle);
10044 template <
typename T>
10045 template <
typename S>
10049 *value_ = GetDefaultValue();
10051 *value_ = *reinterpret_cast<internal::Address*>(*handle);
10055 template<
typename T>
10061 template<
typename T>
10066 *value_ = I::IntToSmi(i);
10072 template<
typename T>
10076 bool fits_into_int32_t = (i & (1U << 31)) == 0;
10078 Set(static_cast<int32_t>(i));
10084 template<
typename T>
10090 root_index = I::kTrueValueRootIndex;
10092 root_index = I::kFalseValueRootIndex;
10094 *value_ = *I::GetRoot(GetIsolate(), root_index);
10097 template<
typename T>
10101 *value_ = *I::GetRoot(GetIsolate(), I::kNullValueRootIndex);
10104 template<
typename T>
10108 *value_ = *I::GetRoot(GetIsolate(), I::kUndefinedValueRootIndex);
10111 template<
typename T>
10115 *value_ = *I::GetRoot(GetIsolate(), I::kEmptyStringRootIndex);
10118 template <
typename T>
10121 return *reinterpret_cast<Isolate**>(&value_[-2]);
10124 template <
typename T>
10127 if (*value_ == *I::GetRoot(GetIsolate(), I::kTheHoleValueRootIndex))
10132 template <
typename T>
10133 template <
typename S>
10139 template <
typename T>
10145 template <
typename T>
10149 : implicit_args_(implicit_args), values_(values), length_(length) {}
10151 template<
typename T>
10154 return Local<Value>(reinterpret_cast<Value*>(values_ - i));
10158 template<
typename T>
10160 return Local<Object>(reinterpret_cast<Object*>(values_ + 1));
10164 template<
typename T>
10167 &implicit_args_[kHolderIndex]));
10170 template <
typename T>
10173 reinterpret_cast<Value*>(&implicit_args_[kNewTargetIndex]));
10176 template <
typename T>
10178 return Local<Value>(reinterpret_cast<Value*>(&implicit_args_[kDataIndex]));
10182 template<
typename T>
10184 return *reinterpret_cast<Isolate**>(&implicit_args_[kIsolateIndex]);
10188 template<
typename T>
10194 template<
typename T>
10196 return !NewTarget()->IsUndefined();
10200 template<
typename T>
10214 : resource_name_(resource_name),
10215 resource_line_offset_(resource_line_offset),
10216 resource_column_offset_(resource_column_offset),
10217 options_(!resource_is_shared_cross_origin.IsEmpty() &&
10218 resource_is_shared_cross_origin->IsTrue(),
10219 !resource_is_opaque.IsEmpty() && resource_is_opaque->IsTrue(),
10220 !is_wasm.IsEmpty() && is_wasm->IsTrue(),
10221 !is_module.IsEmpty() && is_module->IsTrue()),
10222 script_id_(script_id),
10223 source_map_url_(source_map_url),
10224 host_defined_options_(host_defined_options) {}
10229 return host_defined_options_;
10233 return resource_line_offset_;
10238 return resource_column_offset_;
10249 : source_string(string),
10250 resource_name(origin.ResourceName()),
10251 resource_line_offset(origin.ResourceLineOffset()),
10252 resource_column_offset(origin.ResourceColumnOffset()),
10253 resource_options(origin.Options()),
10254 source_map_url(origin.SourceMapUrl()),
10255 host_defined_options(origin.HostDefinedOptions()),
10256 cached_data(data) {}
10260 : source_string(string), cached_data(data) {}
10264 delete cached_data;
10270 return cached_data;
10274 return resource_options;
10278 return value ?
True(isolate) :
False(isolate);
10288 #ifdef V8_ENABLE_CHECKS 10291 return reinterpret_cast<FunctionTemplate*>(data);
10295 #ifdef V8_ENABLE_CHECKS 10298 return reinterpret_cast<ObjectTemplate*>(data);
10302 #ifdef V8_ENABLE_CHECKS 10305 return reinterpret_cast<Signature*>(data);
10309 #ifdef V8_ENABLE_CHECKS 10312 return reinterpret_cast<AccessorSignature*>(data);
10316 #if !defined(V8_ENABLE_CHECKS) && !defined(V8_COMPRESS_POINTERS) 10319 A obj = *reinterpret_cast<A*>(
this);
10322 auto instance_type = I::GetInstanceType(obj);
10323 if (instance_type == I::kJSObjectType ||
10324 instance_type == I::kJSApiObjectType ||
10325 instance_type == I::kJSSpecialApiObjectType) {
10326 int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index);
10327 A value = I::ReadTaggedAnyField(obj, offset);
10328 internal::Isolate* isolate =
10331 return Local<Value>(reinterpret_cast<Value*>(result));
10334 return SlowGetInternalField(index);
10339 #if !defined(V8_ENABLE_CHECKS) && !defined(V8_COMPRESS_POINTERS) 10342 A obj = *reinterpret_cast<A*>(
this);
10345 auto instance_type = I::GetInstanceType(obj);
10346 if (
V8_LIKELY(instance_type == I::kJSObjectType ||
10347 instance_type == I::kJSApiObjectType ||
10348 instance_type == I::kJSSpecialApiObjectType)) {
10349 int offset = I::kJSObjectHeaderSize + (I::kEmbedderDataSlotSize * index);
10350 return I::ReadRawField<void*>(obj, offset);
10353 return SlowGetAlignedPointerFromInternalField(index);
10357 #ifdef V8_ENABLE_CHECKS 10360 return static_cast<String*>(value);
10367 I::CheckInitialized(isolate);
10368 S* slot = I::GetRoot(isolate, I::kEmptyStringRootIndex);
10376 A obj = *reinterpret_cast<const A*>(
this);
10379 if (I::IsExternalTwoByteString(I::GetInstanceType(obj))) {
10380 void* value = I::ReadRawField<void*>(obj, I::kStringResourceOffset);
10381 result = reinterpret_cast<String::ExternalStringResource*>(value);
10383 result = GetExternalStringResourceSlow();
10385 #ifdef V8_ENABLE_CHECKS 10386 VerifyExternalStringResource(result);
10396 A obj = *reinterpret_cast<const A*>(
this);
10397 int type = I::GetInstanceType(obj) & I::kFullStringRepresentationMask;
10398 *encoding_out = static_cast<Encoding>(type & I::kStringEncodingMask);
10400 if (type == I::kExternalOneByteRepresentationTag ||
10401 type == I::kExternalTwoByteRepresentationTag) {
10402 void* value = I::ReadRawField<void*>(obj, I::kStringResourceOffset);
10403 resource = static_cast<ExternalStringResourceBase*>(value);
10405 resource = GetExternalStringResourceBaseSlow(encoding_out);
10407 #ifdef V8_ENABLE_CHECKS 10408 VerifyExternalStringResourceBase(resource, *encoding_out);
10415 #ifdef V8_ENABLE_CHECKS 10416 return FullIsUndefined();
10418 return QuickIsUndefined();
10422 bool Value::QuickIsUndefined()
const {
10425 A obj = *reinterpret_cast<const A*>(
this);
10426 if (!I::HasHeapObjectTag(obj))
return false;
10427 if (I::GetInstanceType(obj) != I::kOddballType)
return false;
10428 return (I::GetOddballKind(obj) == I::kUndefinedOddballKind);
10433 #ifdef V8_ENABLE_CHECKS 10434 return FullIsNull();
10436 return QuickIsNull();
10440 bool Value::QuickIsNull()
const {
10443 A obj = *reinterpret_cast<const A*>(
this);
10444 if (!I::HasHeapObjectTag(obj))
return false;
10445 if (I::GetInstanceType(obj) != I::kOddballType)
return false;
10446 return (I::GetOddballKind(obj) == I::kNullOddballKind);
10450 #ifdef V8_ENABLE_CHECKS 10451 return FullIsNull() || FullIsUndefined();
10453 return QuickIsNullOrUndefined();
10457 bool Value::QuickIsNullOrUndefined()
const {
10460 A obj = *reinterpret_cast<const A*>(
this);
10461 if (!I::HasHeapObjectTag(obj))
return false;
10462 if (I::GetInstanceType(obj) != I::kOddballType)
return false;
10463 int kind = I::GetOddballKind(obj);
10464 return kind == I::kNullOddballKind || kind == I::kUndefinedOddballKind;
10468 #ifdef V8_ENABLE_CHECKS 10469 return FullIsString();
10471 return QuickIsString();
10475 bool Value::QuickIsString()
const {
10478 A obj = *reinterpret_cast<const A*>(
this);
10479 if (!I::HasHeapObjectTag(obj))
return false;
10480 return (I::GetInstanceType(obj) < I::kFirstNonstringType);
10485 return static_cast<Value*>(value);
10490 #ifdef V8_ENABLE_CHECKS 10493 return static_cast<Boolean*>(value);
10498 #ifdef V8_ENABLE_CHECKS 10501 return static_cast<Name*>(value);
10506 #ifdef V8_ENABLE_CHECKS 10509 return static_cast<Symbol*>(value);
10514 #ifdef V8_ENABLE_CHECKS 10517 return reinterpret_cast<Private*>(data);
10522 #ifdef V8_ENABLE_CHECKS 10525 return static_cast<Number*>(value);
10530 #ifdef V8_ENABLE_CHECKS 10533 return static_cast<Integer*>(value);
10538 #ifdef V8_ENABLE_CHECKS 10541 return static_cast<Int32*>(value);
10546 #ifdef V8_ENABLE_CHECKS 10549 return static_cast<Uint32*>(value);
10553 #ifdef V8_ENABLE_CHECKS 10556 return static_cast<BigInt*>(value);
10560 #ifdef V8_ENABLE_CHECKS 10563 return static_cast<Date*>(value);
10568 #ifdef V8_ENABLE_CHECKS 10571 return static_cast<StringObject*>(value);
10576 #ifdef V8_ENABLE_CHECKS 10579 return static_cast<SymbolObject*>(value);
10584 #ifdef V8_ENABLE_CHECKS 10587 return static_cast<NumberObject*>(value);
10591 #ifdef V8_ENABLE_CHECKS 10594 return static_cast<BigIntObject*>(value);
10598 #ifdef V8_ENABLE_CHECKS 10601 return static_cast<BooleanObject*>(value);
10606 #ifdef V8_ENABLE_CHECKS 10609 return static_cast<RegExp*>(value);
10614 #ifdef V8_ENABLE_CHECKS 10617 return static_cast<Object*>(value);
10622 #ifdef V8_ENABLE_CHECKS 10625 return static_cast<Array*>(value);
10630 #ifdef V8_ENABLE_CHECKS 10633 return static_cast<Map*>(value);
10638 #ifdef V8_ENABLE_CHECKS 10641 return static_cast<Set*>(value);
10646 #ifdef V8_ENABLE_CHECKS 10649 return static_cast<Promise*>(value);
10654 #ifdef V8_ENABLE_CHECKS 10657 return static_cast<Proxy*>(value);
10661 #ifdef V8_ENABLE_CHECKS 10664 return static_cast<WasmModuleObject*>(value);
10668 #ifdef V8_ENABLE_CHECKS 10671 return static_cast<Promise::Resolver*>(value);
10676 #ifdef V8_ENABLE_CHECKS 10679 return static_cast<ArrayBuffer*>(value);
10684 #ifdef V8_ENABLE_CHECKS 10687 return static_cast<ArrayBufferView*>(value);
10692 #ifdef V8_ENABLE_CHECKS 10695 return static_cast<TypedArray*>(value);
10700 #ifdef V8_ENABLE_CHECKS 10703 return static_cast<Uint8Array*>(value);
10708 #ifdef V8_ENABLE_CHECKS 10711 return static_cast<Int8Array*>(value);
10716 #ifdef V8_ENABLE_CHECKS 10719 return static_cast<Uint16Array*>(value);
10724 #ifdef V8_ENABLE_CHECKS 10727 return static_cast<Int16Array*>(value);
10732 #ifdef V8_ENABLE_CHECKS 10735 return static_cast<Uint32Array*>(value);
10740 #ifdef V8_ENABLE_CHECKS 10743 return static_cast<Int32Array*>(value);
10748 #ifdef V8_ENABLE_CHECKS 10751 return static_cast<Float32Array*>(value);
10756 #ifdef V8_ENABLE_CHECKS 10759 return static_cast<Float64Array*>(value);
10763 #ifdef V8_ENABLE_CHECKS 10766 return static_cast<BigInt64Array*>(value);
10770 #ifdef V8_ENABLE_CHECKS 10773 return static_cast<BigUint64Array*>(value);
10777 #ifdef V8_ENABLE_CHECKS 10780 return static_cast<Uint8ClampedArray*>(value);
10785 #ifdef V8_ENABLE_CHECKS 10788 return static_cast<DataView*>(value);
10793 #ifdef V8_ENABLE_CHECKS 10796 return static_cast<SharedArrayBuffer*>(value);
10801 #ifdef V8_ENABLE_CHECKS 10804 return static_cast<Function*>(value);
10809 #ifdef V8_ENABLE_CHECKS 10812 return static_cast<External*>(value);
10816 template<
typename T>
10818 return *reinterpret_cast<Isolate**>(&args_[kIsolateIndex]);
10822 template<
typename T>
10824 return Local<Value>(reinterpret_cast<Value*>(&args_[kDataIndex]));
10828 template<
typename T>
10830 return Local<Object>(reinterpret_cast<Object*>(&args_[kThisIndex]));
10834 template<
typename T>
10836 return Local<Object>(reinterpret_cast<Object*>(&args_[kHolderIndex]));
10840 template<
typename T>
10845 template <
typename T>
10848 if (args_[kShouldThrowOnErrorIndex] !=
10849 I::IntToSmi(I::kInferShouldThrowMode)) {
10850 return args_[kShouldThrowOnErrorIndex] != I::IntToSmi(I::kDontThrow);
10853 reinterpret_cast<v8::internal::Isolate*>(GetIsolate()));
10859 I::CheckInitialized(isolate);
10860 S* slot = I::GetRoot(isolate, I::kUndefinedValueRootIndex);
10868 I::CheckInitialized(isolate);
10869 S* slot = I::GetRoot(isolate, I::kNullValueRootIndex);
10877 I::CheckInitialized(isolate);
10878 S* slot = I::GetRoot(isolate, I::kTrueValueRootIndex);
10886 I::CheckInitialized(isolate);
10887 S* slot = I::GetRoot(isolate, I::kFalseValueRootIndex);
10894 I::SetEmbedderData(
this, slot, data);
10900 return I::GetEmbedderData(
this, slot);
10906 return I::kNumIsolateDataSlots;
10911 T* data = reinterpret_cast<T*>(GetDataFromSnapshotOnce(index));
10917 int64_t change_in_bytes) {
10919 constexpr int64_t kMemoryReducerActivationLimit = 32 * 1024 * 1024;
10920 int64_t* external_memory = reinterpret_cast<int64_t*>(
10921 reinterpret_cast<uint8_t*>(
this) + I::kExternalMemoryOffset);
10922 int64_t* external_memory_limit = reinterpret_cast<int64_t*>(
10923 reinterpret_cast<uint8_t*>(
this) + I::kExternalMemoryLimitOffset);
10924 int64_t* external_memory_at_last_mc =
10925 reinterpret_cast<int64_t*>(reinterpret_cast<uint8_t*>(
this) +
10926 I::kExternalMemoryAtLastMarkCompactOffset);
10928 const int64_t amount = *external_memory + change_in_bytes;
10929 *external_memory = amount;
10931 int64_t allocation_diff_since_last_mc =
10932 *external_memory - *external_memory_at_last_mc;
10935 if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
10936 CheckMemoryPressure();
10939 if (change_in_bytes < 0) {
10940 const int64_t lower_limit = *external_memory_limit + change_in_bytes;
10941 if (lower_limit > I::kExternalAllocationSoftLimit)
10942 *external_memory_limit = lower_limit;
10943 }
else if (change_in_bytes > 0 && amount > *external_memory_limit) {
10944 ReportExternalAllocationLimitReached();
10946 return *external_memory;
10950 #if !defined(V8_ENABLE_CHECKS) && !defined(V8_COMPRESS_POINTERS) 10954 *reinterpret_cast<A*>(
this));
10957 return Local<Value>(reinterpret_cast<Value*>(result));
10959 return SlowGetEmbedderData(index);
10965 #if !defined(V8_ENABLE_CHECKS) && !defined(V8_COMPRESS_POINTERS) 10967 return I::ReadEmbedderData<void*>(
this, index);
10969 return SlowGetAlignedPointerFromEmbedderData(index);
10975 T* data = reinterpret_cast<T*>(GetDataFromSnapshotOnce(index));
10982 T* object_ptr = *object;
10984 return AddData(context, *p);
10989 T* object_ptr = *object;
10991 return AddData(*p);
11012 #endif // INCLUDE_V8_H_ GenericNamedPropertyDefinerCallback definer
V8_DEPRECATED("Weak objects are always considered independent. " "Use TracedGlobal when trying to use EmbedderHeapTracer. " "Use a strong handle when trying to keep an object alive.", V8_INLINE void MarkIndependent())
static V8_INLINE StringObject * Cast(Value *obj)
TracedGlobal(Isolate *isolate, Local< S > that)
Location(int line_number, int column_number)
void(* GCCallback)(GCType type, GCCallbackFlags flags)
V8_INLINE Local< Boolean > True(Isolate *isolate)
size_t space_available_size()
V8_INLINE Local< Value > GetEmbedderData(int index)
Local< T > Get(Isolate *isolate) const
V8_INLINE Local< Value > GetValue() const
friend Maybe< U > Just(const U &u)
static V8_INLINE BigInt64Array * Cast(Value *obj)
V8_INLINE void Set(const Global< S > &handle)
static V8_INLINE Object * Cast(Value *obj)
void(* FatalErrorCallback)(const char *location, const char *message)
OwnedBuffer(std::unique_ptr< const uint8_t[]> buffer, size_t size)
static V8_INLINE Uint8ClampedArray * Cast(Value *obj)
void(* BeforeCallEnteredCallback)(Isolate *)
void V8_EXPORT RegisterExtension(std::unique_ptr< Extension >)
Persistent< T, CopyablePersistentTraits< T > > CopyablePersistent
V8_INLINE void SetWrapperClassId(uint16_t class_id)
V8_INLINE uint16_t WrapperClassId() const
static V8_INLINE void Uncompilable()
virtual bool IsRootForNonTracingGC(const v8::TracedGlobal< v8::Value > &handle)
size_t number_of_native_contexts()
SerializeInternalFieldsCallback SerializeEmbedderFieldsCallback
void(* WasmStreamingCallback)(const FunctionCallbackInfo< Value > &)
V8_INLINE bool operator==(const Local< S > &that) const
const char * space_name()
friend Maybe< U > Nothing()
void(* ApiImplementationCallback)(const FunctionCallbackInfo< Value > &)
static V8_INLINE Int8Array * Cast(Value *obj)
V8_INLINE Persistent & operator=(const Persistent< S, M2 > &that)
static V8_INLINE ArrayBufferView * Cast(Value *obj)
friend Local< Primitive > Undefined(Isolate *isolate)
size_t code_and_metadata_size()
V8_INLINE Eternal(Isolate *isolate, Local< S > handle)
MaybeLocal< Promise >(* HostImportModuleDynamicallyCallback)(Local< Context > context, Local< ScriptOrModule > referrer, Local< String > specifier)
static V8_INLINE SharedArrayBuffer * Cast(Value *obj)
PropertyHandlerFlags flags
V8_INLINE void SetUndefined()
static V8_INLINE Float32Array * Cast(Value *obj)
static V8_INLINE Map * Cast(Value *obj)
Maybe< T > Just(const T &t)
V8_INLINE bool IsNothing() const
v8::Isolate * isolate() const
#define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
V8_INLINE PropertyCallbackInfo(internal::Address *args)
IndexedPropertyDefinerCallback definer
static V8_INLINE Proxy * Cast(Value *obj)
size_t peak_malloced_memory()
V8_INLINE void * GetAlignedPointerFromInternalField(int index)
V8_INLINE Local< T > Get(Isolate *isolate) const
V8_INLINE bool IsJust() const
V8_INLINE bool operator!=(const Persistent< S > &that) const
static V8_INLINE Uint32Array * Cast(Value *obj)
const char * object_type()
void set_code_range_size(size_t limit_in_mb)
static V8_INLINE AccessorSignature * Cast(Data *data)
virtual void Lock() const
void(* InterruptCallback)(Isolate *isolate, void *data)
CreateHistogramCallback create_histogram_callback
V8_INLINE bool operator!=(const Local< S > &that) const
V8_INLINE T FromJust() const
V8_INLINE T * GetParameter() const
size_t does_zap_garbage()
void(* AddHistogramSampleCallback)(void *histogram, int sample)
V8_INLINE Local< Value > SourceMapUrl() const
size_t code_range_size() const
int dependency_count() const
V8_INLINE const CachedData * GetCachedData() const
static const int kArgsLength
friend class PersistentBase
V8_INLINE bool operator==(const Local< S > &that) const
IndexedPropertyDeleterCallback deleter
friend Local< Primitive > Null(Isolate *isolate)
static V8_INLINE Uint32 * Cast(v8::Value *obj)
V8_INLINE ReturnValue< T > GetReturnValue() const
static V8_INLINE Array * Cast(Value *obj)
size_t AllocationLength() const
void(* IndexedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
static const int kHolderIndex
V8_INLINE Persistent & operator=(const Persistent &that)
void(* MicrotasksCompletedCallback)(Isolate *)
V8_INLINE void * GetAlignedPointerFromEmbedderData(int index)
void(* IndexedPropertyDeleterCallback)(uint32_t index, const PropertyCallbackInfo< Boolean > &info)
V8_INLINE bool IsString() const
friend class internal::FunctionCallbackArguments
V8_INLINE bool IsNothing() const
static V8_INLINE Float64Array * Cast(Value *obj)
static const bool kResetInDestructor
const char * name() const
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
static V8_INLINE uint32_t GetNumberOfDataSlots()
bool(* ExtensionCallback)(const FunctionCallbackInfo< Value > &)
constexpr MemorySpan(T *data, size_t size)
V8_INLINE Local< S > As() const
void(* CallCompletedCallback)(Isolate *)
V8_INLINE Local< Value > ResourceName() const
V8_INLINE Local< T > Escape(Local< T > value)
V8_INLINE bool IsEmpty() const
void(* IndexedPropertyGetterCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
static const int kNewTargetIndex
GenericNamedPropertyEnumeratorCallback enumerator
AddHistogramSampleCallback add_histogram_sample_callback
void(* LogEventCallback)(const char *name, int event)
static const int kLineOffsetNotFound
V8_INLINE ExternalStringResource * GetExternalStringResource() const
V8_INLINE Persistent(const Persistent< S, M2 > &that)
static V8_INLINE ObjectTemplate * Cast(Data *data)
static V8_INLINE Resolver * Cast(Value *obj)
DeleterCallback Deleter() const
V8_DEPRECATED("Use WasmModuleObject", typedef WasmModuleObject WasmCompiledModule)
V8_INLINE T FromMaybe(const T &default_value) const
static V8_INLINE Boolean * Cast(v8::Value *obj)
Persistent< T, NonCopyablePersistentTraits< T > > NonCopyablePersistent
V8_DEPRECATE_SOON("Zone does not pool memory any more.", void set_max_zone_pool_size(size_t bytes))
V8_INLINE ScriptOrigin(Local< Value > resource_name, Local< Integer > resource_line_offset=Local< Integer >(), Local< Integer > resource_column_offset=Local< Integer >(), Local< Boolean > resource_is_shared_cross_origin=Local< Boolean >(), Local< Integer > script_id=Local< Integer >(), Local< Value > source_map_url=Local< Value >(), Local< Boolean > resource_is_opaque=Local< Boolean >(), Local< Boolean > is_wasm=Local< Boolean >(), Local< Boolean > is_module=Local< Boolean >(), Local< PrimitiveArray > host_defined_options=Local< PrimitiveArray >())
V8_INLINE bool operator==(const TracedGlobal< S > &that) const
const char * object_sub_type()
static const bool kResetInDestructor
BufferPolicy buffer_policy
static V8_INLINE BigUint64Array * Cast(Value *obj)
V8_INLINE bool IsUndefined() const
MaybeLocal< Value >(* PrepareStackTraceCallback)(Local< Context > context, Local< Value > error, Local< Array > sites)
V8_INLINE Local< T > Get(Isolate *isolate) const
V8_INLINE Local< Value > GetInternalField(int index)
DeleterCallback Deleter() const
void(* GenericNamedPropertyQueryCallback)(Local< Name > property, const PropertyCallbackInfo< Integer > &info)
V8_INLINE bool IsNullOrUndefined() const
V8_INLINE Local< Value > Data() const
void(* GenericNamedPropertyEnumeratorCallback)(const PropertyCallbackInfo< Array > &info)
V8_INLINE bool operator==(const PersistentBase< S > &that) const
void(* PromiseRejectCallback)(PromiseRejectMessage message)
internal::ScriptStreamingData * impl() const
GenericNamedPropertyDescriptorCallback descriptor
void(* GenericNamedPropertyDeleterCallback)(Local< Name > property, const PropertyCallbackInfo< Boolean > &info)
V8_INLINE Global(Isolate *isolate, const PersistentBase< S > &that)
void(* Callback)(const WeakCallbackInfo< T > &data)
void(* IndexedPropertyDescriptorCallback)(uint32_t index, const PropertyCallbackInfo< Value > &info)
void * DeleterData() const
V8_INLINE ExternalStringResourceBase * GetExternalStringResourceBase(Encoding *encoding_out) const
V8_INLINE Isolate * GetIsolate() const
void SetIndexedPropertyHandler(IndexedPropertyGetterCallback getter, IndexedPropertySetterCallback setter=nullptr, IndexedPropertyQueryCallback query=nullptr, IndexedPropertyDeleterCallback deleter=nullptr, IndexedPropertyEnumeratorCallback enumerator=nullptr, Local< Value > data=Local< Value >())
static V8_INLINE void Copy(const Persistent< S, M > &source, CopyablePersistent *dest)
void * AllocationBase() const
V8_INLINE TracedGlobal< S > & As() const
V8_INLINE void Set(Isolate *isolate, Local< S > handle)
static V8_INLINE Function * Cast(Value *obj)
V8_INLINE Persistent(Isolate *isolate, const Persistent< S, M2 > &that)
V8_INLINE V8_DEPRECATED("Use Global<> instead", void Set(const Persistent< S > &handle))
V8_INLINE void SetWrapperClassId(uint16_t class_id)
V8_INLINE int Length() const
size_t physical_space_size()
static const int kArgsLength
static V8_INLINE Date * Cast(Value *obj)
V8_INLINE Local< Object > This() const
V8_INLINE P * ClearWeak()
static V8_INLINE Number * Cast(v8::Value *obj)
static V8_INLINE WasmModuleObject * Cast(Value *obj)
IndexedPropertySetterCallback setter
IndexedPropertyGetterCallback getter
void(* MessageCallback)(Local< Message > message, Local< Value > data)
size_t max_old_space_size() const
ExtensionConfiguration(int name_count, const char *names[])
IndexedPropertyHandlerConfiguration(IndexedPropertyGetterCallback getter, IndexedPropertySetterCallback setter, IndexedPropertyDescriptorCallback descriptor, IndexedPropertyDeleterCallback deleter, IndexedPropertyEnumeratorCallback enumerator, IndexedPropertyDefinerCallback definer, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
bool IsSharedCrossOrigin() const
friend Local< Boolean > True(Isolate *isolate)
NamedPropertyHandlerConfiguration(GenericNamedPropertyGetterCallback getter, GenericNamedPropertySetterCallback setter, GenericNamedPropertyQueryCallback query, GenericNamedPropertyDeleterCallback deleter, GenericNamedPropertyEnumeratorCallback enumerator, GenericNamedPropertyDefinerCallback definer, GenericNamedPropertyDescriptorCallback descriptor, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
V8_INLINE Local< PrimitiveArray > HostDefinedOptions() const
V8_DEPRECATE_SOON("Use Detach() instead.", inline void Neuter())
uintptr_t(* ReturnAddressLocationResolver)(uintptr_t return_addr_location)
V8_INLINE Isolate * GetIsolate() const
size_t total_physical_size()
ResourceConstraints constraints
void MoveOnlyTypeForCPP03
size_t ByteLength() const
V8_INLINE bool IsEmpty() const
V8_INLINE void AnnotateStrongRetainer(const char *label)
static V8_INLINE Int32Array * Cast(Value *obj)
size_t external_script_source_size()
static const int kDataIndex
#define V8_DEPRECATE_SOON(message, declarator)
static V8_INLINE Set * Cast(Value *obj)
V8_EXPORT bool ShouldThrowOnError(v8::internal::Isolate *isolate)
V8_INLINE Local< Primitive > Undefined(Isolate *isolate)
static V8_INLINE Int32 * Cast(v8::Value *obj)
internal::Address * implicit_args_
bool(* WasmThreadsEnabledCallback)(Local< Context > context)
V8_INLINE bool ShouldThrowOnError() const
V8_INLINE bool operator!=(const TracedGlobal< S > &that) const
V8_INLINE Local< Integer > ResourceColumnOffset() const
V8_INLINE ReturnValue< T > GetReturnValue() const
static V8_INLINE Local< Context > CreationContext(const PersistentBase< Object > &object)
virtual void VisitExternalString(Local< String > string)
void(* AccessorGetterCallback)(Local< String > property, const PropertyCallbackInfo< Value > &info)
bool(* AllowCodeGenerationFromStringsCallback)(Local< Context > context, Local< String > source)
static V8_INLINE void * GetAlignedPointerFromInternalField(const PersistentBase< Object > &object, int index)
V8_INLINE PromiseRejectEvent GetEvent() const
V8_INLINE ReturnValue(const ReturnValue< S > &that)
V8_INLINE bool operator!=(const Local< S > &that) const
void operator=(const PersistentBase &)=delete
PrivateData * get_private() const
static const int kReturnValueDefaultValueIndex
bool(* AccessCheckCallback)(Local< Context > accessing_context, Local< Object > accessed_object, Local< Value > data)
V8_INLINE Local< Integer > ScriptID() const
StartupData * snapshot_blob
V8_INLINE MaybeLocal< T > GetDataFromSnapshotOnce(size_t index)
V8_INLINE Local< Primitive > Null(Isolate *isolate)
V8_INLINE bool operator==(const PersistentBase< S > &that) const
static const int kReturnValueIndex
V8_INLINE bool operator!=(const Maybe &other) const
static V8_WARN_UNUSED_RESULT MaybeLocal< String > NewFromUtf8(Isolate *isolate, const char *data, v8::NewStringType type, int length=-1)
MemoryRange embedded_code_range
size_t number_of_detached_contexts()
void(* IndexedPropertyQueryCallback)(uint32_t index, const PropertyCallbackInfo< Integer > &info)
void(* GenericNamedPropertyGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
#define V8_PROMISE_INTERNAL_FIELD_COUNT
V8_WARN_UNUSED_RESULT V8_INLINE bool ToLocal(Local< S > *out) const
static V8_INLINE SymbolObject * Cast(Value *obj)
V8_INLINE bool operator!=(const Maybe &other) const
V8_INLINE Local< Object > This() const
void(*)(void *buffer, size_t length, void *info) DeleterCallback
void(* callback)(Local< Object > holder, int index, StartupData payload, void *data)
V8_WARN_UNUSED_RESULT V8_INLINE bool To(T *out) const
V8_INLINE bool operator==(const Maybe &other) const
#define V8_DECL_INTRINSIC(name, iname)
static V8_INLINE NumberObject * Cast(Value *obj)
V8_INLINE void PerformCastCheck(T *data)
CallbackFunction callback
V8_DEPRECATE_SOON("Used TracedGlobal and EmbedderHeapTracer::RegisterEmbedderReference", V8_INLINE void RegisterExternalReference(Isolate *isolate) const)
V8_INLINE bool IsJust() const
V8_INLINE Isolate * GetIsolate() const
bool(* EntropySource)(unsigned char *buffer, size_t length)
V8_INLINE void SetData(uint32_t slot, void *data)
DeserializeInternalFieldsCallback DeserializeEmbedderFieldsCallback
static V8_INLINE Symbol * Cast(Value *obj)
static Local< Integer > NewFromUnsigned(Isolate *isolate, uint32_t value)
V8_INLINE bool IsNull() const
V8_INLINE MaybeLocal< T > EscapeMaybe(MaybeLocal< T > value)
const char ** begin() const
size_t AllocationLength() const
V8_INLINE Unlocker(Isolate *isolate)
void(* AccessorNameSetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
virtual void Unlock() const
void(* MicrotasksCompletedCallbackWithData)(Isolate *, void *)
static Local< Number > New(Isolate *isolate, double value)
V8_INLINE Local< Object > Holder() const
static const int kReturnValueDefaultValueIndex
#define V8_UNLIKELY(condition)
V8_INLINE bool operator==(const Local< S > &that) const
void set_stack_limit(uint32_t *value)
const intptr_t * external_references
V8_INLINE Local< T > ToLocalChecked()
void Set(Local< Name > name, Local< Data > value, PropertyAttribute attributes=None)
void(* JitCodeEventHandler)(const JitCodeEvent *event)
static V8_INLINE String * Cast(v8::Value *obj)
V8_INLINE TracedGlobal & operator=(TracedGlobal< S > &&rhs)
void(* GenericNamedPropertyDescriptorCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
V8_INLINE FunctionCallbackInfo(internal::Address *implicit_args, internal::Address *values, int length)
static V8_INLINE External * Cast(Value *obj)
V8_INLINE bool IsWeak() const
void(* PromiseHook)(PromiseHookType type, Local< Promise > promise, Local< Value > parent)
virtual Local< FunctionTemplate > GetNativeFunctionTemplate(Isolate *isolate, Local< String > name)
V8_INLINE size_t AddData(Local< Context > context, Local< T > object)
static V8_INLINE Integer * Cast(v8::Value *obj)
V8_DEPRECATE_SOON("Use IsDetachable() instead.", inline bool IsNeuterable() const)
static V8_INLINE ArrayBuffer * Cast(Value *obj)
static V8_INLINE Local< T > Cast(Local< S > that)
V8_INLINE bool operator==(const Maybe &other) const
struct line_info_t line_info
static const int kShouldThrowOnErrorIndex
size_t ByteLength() const
JitCodeEventHandler code_event_handler
V8_INLINE Local(Local< S > that)
V8_INLINE bool IsEmpty() const
V8_INLINE void SetFinalizationCallback(void *parameter, WeakCallbackInfo< void >::Callback callback)
static V8_INLINE BooleanObject * Cast(Value *obj)
void(* FunctionCallback)(const FunctionCallbackInfo< Value > &info)
IndexedPropertyHandlerConfiguration(IndexedPropertyGetterCallback getter=nullptr, IndexedPropertySetterCallback setter=nullptr, IndexedPropertyQueryCallback query=nullptr, IndexedPropertyDeleterCallback deleter=nullptr, IndexedPropertyEnumeratorCallback enumerator=nullptr, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
IndexedPropertyQueryCallback query
ArrayBuffer::Allocator * array_buffer_allocator
NamedPropertyHandlerConfiguration(GenericNamedPropertyGetterCallback getter=nullptr, GenericNamedPropertySetterCallback setter=nullptr, GenericNamedPropertyQueryCallback query=nullptr, GenericNamedPropertyDeleterCallback deleter=nullptr, GenericNamedPropertyEnumeratorCallback enumerator=nullptr, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
static V8_INLINE BigIntObject * Cast(Value *obj)
const String::ExternalOneByteStringResource * source() const
static V8_INLINE Name * Cast(Value *obj)
V8_INLINE Local< Object > Holder() const
static V8_INLINE void Copy(const Persistent< S, M > &source, NonCopyablePersistent *dest)
V8_INLINE Isolate * GetIsolate() const
void * AllocationBase() const
V8_DEPRECATE_SOON("Zone does not pool memory any more.", size_t max_zone_pool_size() const)
static const int kIsolateIndex
internal::Address * args_
V8_EXPORT internal::Isolate * IsolateFromNeverReadOnlySpaceObject(Address obj)
V8_INLINE Local< Boolean > False(Isolate *isolate)
V8_INLINE ScriptOriginOptions(int flags)
size_t source_length() const
friend class debug::ConsoleCallArguments
V8_INLINE void ClearWeak()
V8_INLINE ScriptOriginOptions(bool is_shared_cross_origin=false, bool is_opaque=false, bool is_wasm=false, bool is_module=false)
V8_INLINE T ToChecked() const
static Local< Integer > New(Isolate *isolate, int32_t value)
V8_INLINE bool IsEmpty() const
JSEntryStub js_entry_stub
static internal::Address * CreateHandle(internal::Isolate *isolate, internal::Address value)
IndexedPropertyEnumeratorCallback enumerator
V8_INLINE ScriptOriginOptions Options() const
SerializeInternalFieldsCallback(CallbackFunction function=nullptr, void *data_arg=nullptr)
void SetSecondPassCallback(Callback callback) const
void set_max_old_space_size(size_t limit_in_mb)
static V8_INLINE DataView * Cast(Value *obj)
V8_INLINE Isolate * GetIsolate() const
V8_INLINE void Check() const
static V8_INLINE Promise * Cast(Value *obj)
V8_INLINE Global & operator=(Global< S > &&rhs)
V8_INLINE bool operator!=(const Local< S > &that) const
#define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
size_t(* NearHeapLimitCallback)(void *data, size_t current_heap_limit, size_t initial_heap_limit)
V8_INLINE void * GetInternalField(int index) const
static const int kIsolateIndex
#define V8_WARN_UNUSED_RESULT
#define V8_INTRINSICS_LIST(F)
size_t bytecode_and_metadata_size()
GenericNamedPropertyDeleterCallback deleter
IndexedPropertyDescriptorCallback descriptor
V8_INLINE Local< Value > Get() const
constexpr size_t size() const
V8_INLINE void * GetData(uint32_t slot)
void *(* CreateHistogramCallback)(const char *name, int min, int max, size_t buckets)
uintptr_t JSStackComparableAddress() const
void(*)(void *buffer, size_t length, void *info) DeleterCallback
static V8_INLINE void * GetAlignedPointerFromInternalField(const TracedGlobal< Object > &object, int index)
const char ** dependencies() const
void(* GenericNamedPropertyDefinerCallback)(Local< Name > property, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info)
static V8_INLINE Signature * Cast(Data *data)
void set_max_semi_space_size_in_kb(size_t limit_in_kb)
static void * JSStackComparableAddress(TryCatch *handler)
friend Local< Boolean > False(Isolate *isolate)
GenericNamedPropertySetterCallback setter
void set_auto_enable(bool value)
virtual void VisitPersistentHandle(Persistent< Value > *value, uint16_t class_id)
static const int kThisIndex
size_t total_available_size()
Allocator::AllocationMode AllocationMode() const
static V8_INLINE Private * Cast(Data *data)
static V8_INLINE Local< T > New(Isolate *isolate, Local< T > that)
bool(* AllowWasmCodeGenerationCallback)(Local< Context > context, Local< String > source)
DeserializeInternalFieldsCallback(CallbackFunction function=nullptr, void *data_arg=nullptr)
V8_INLINE uint16_t WrapperClassId() const
StartupData(* CallbackFunction)(Local< Object > holder, int index, void *data)
V8_INLINE Persistent(Isolate *isolate, Local< S > that)
WeakCallbackInfo(Isolate *isolate, T *parameter, void *embedder_fields[kEmbedderFieldsInWeakCallback], Callback *callback)
static V8_INLINE FunctionTemplate * Cast(Data *data)
void(* IndexedPropertyDefinerCallback)(uint32_t index, const PropertyDescriptor &desc, const PropertyCallbackInfo< Value > &info)
V8_INLINE bool IsConstructCall() const
int *(* CounterLookupCallback)(const char *name)
void(* AccessorNameGetterCallback)(Local< Name > property, const PropertyCallbackInfo< Value > &info)
V8_INLINE void SetEmptyString()
static const int kHolderIndex
static V8_INLINE RegExp * Cast(Value *obj)
static V8_INLINE Uint16Array * Cast(Value *obj)
std::unique_ptr< const uint8_t[]> buffer
V8_INLINE int64_t AdjustAmountOfExternalAllocatedMemory(int64_t change_in_bytes)
friend class MacroAssembler
Local< UnboundScript > script
PropertyHandlerFlags flags
GenericNamedPropertyQueryCallback query
void(* IndexedPropertySetterCallback)(uint32_t index, Local< Value > value, const PropertyCallbackInfo< Value > &info)
V8_INLINE Persistent(const Persistent &that)
V8_INLINE Persistent< S > & As() const
V8_INLINE Source(Local< String > source_string, const ScriptOrigin &origin, CachedData *cached_data=nullptr)
constexpr T * data() const
const char ** end() const
Allocator::AllocationMode AllocationMode() const
static V8_INLINE Uint8Array * Cast(Value *obj)
NamedPropertyHandlerConfiguration(GenericNamedPropertyGetterCallback getter, GenericNamedPropertySetterCallback setter, GenericNamedPropertyDescriptorCallback descriptor, GenericNamedPropertyDeleterCallback deleter, GenericNamedPropertyEnumeratorCallback enumerator, GenericNamedPropertyDefinerCallback definer, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
CounterLookupCallback counter_lookup_callback
internal::Address * values_
static V8_INLINE TypedArray * Cast(Value *obj)
static V8_INLINE Value * Cast(T *value)
void(* DcheckErrorCallback)(const char *file, int line, const char *message)
uint32_t * stack_limit() const
size_t max_semi_space_size_in_kb() const
V8_INLINE bool operator!=(const PersistentBase< S > &that) const
void(* CallbackFunction)(Local< Object > holder, int index, StartupData payload, void *data)
V8_INLINE Local< S > FromMaybe(Local< S > default_value) const
void(* FailedAccessCheckCallback)(Local< Object > target, AccessType type, Local< Value > data)
void * DeleterData() const
static V8_INLINE int InternalFieldCount(const TracedGlobal< Object > &object)
static V8_INLINE int InternalFieldCount(const PersistentBase< Object > &object)
static const int kReturnValueIndex
V8_INLINE T * operator *() const
PromiseRejectMessage(Local< Promise > promise, PromiseRejectEvent event, Local< Value > value, Local< StackTrace > stack_trace)
void * external_callback_entry
V8_WARN_UNUSED_RESULT MaybeLocal< Object > NewInstance(Local< Context > context) const
bool only_terminate_in_safe_scope
V8_INLINE Locker(Isolate *isolate)
static V8_INLINE Local< String > Empty(Isolate *isolate)
void(* MicrotaskCallback)(void *data)
V8_INLINE Scope(Local< Context > context)
void(* GenericNamedPropertySetterCallback)(Local< Name > property, Local< Value > value, const PropertyCallbackInfo< Value > &info)
static V8_INLINE Int16Array * Cast(Value *obj)
IndexedPropertyHandlerConfiguration(IndexedPropertyGetterCallback getter, IndexedPropertySetterCallback setter, IndexedPropertyQueryCallback query, IndexedPropertyDeleterCallback deleter, IndexedPropertyEnumeratorCallback enumerator, IndexedPropertyDefinerCallback definer, IndexedPropertyDescriptorCallback descriptor, Local< Value > data=Local< Value >(), PropertyHandlerFlags flags=PropertyHandlerFlags::kNone)
void(* OOMErrorCallback)(const char *location, bool is_heap_oom)
V8_INLINE Local< Value > NewTarget() const
#define V8_LIKELY(condition)
static const int kDataIndex
V8_INLINE Global(Isolate *isolate, Local< S > that)
size_t total_heap_size_executable()
V8_INLINE Local< Promise > GetPromise() const
V8_INLINE T * operator->() const
GenericNamedPropertyGetterCallback getter
V8_INLINE MaybeLocal(Local< S > that)
void(* AccessorSetterCallback)(Local< String > property, Local< Value > value, const PropertyCallbackInfo< void > &info)
V8_INLINE Local< Value > Data() const
static V8_INLINE Local< Boolean > New(Isolate *isolate, bool value)
static V8_INLINE BigInt * Cast(v8::Value *obj)
static V8_INLINE Persistent< T > & Cast(const Persistent< S > &that)
V8_INLINE Local< Integer > ResourceLineOffset() const
void(* HostInitializeImportMetaObjectCallback)(Local< Context > context, Local< Module > module, Local< Object > meta)
virtual bool IsCacheable() const
V8_INLINE const ScriptOriginOptions & GetResourceOptions() const
PositionType position_type
V8_INLINE Local< Value > operator[](int i) const