23 #include <type_traits> 53 class ImplementationUtilities;
64 class ObjectOperationDescriptor;
71 class RawOperationDescriptor;
92 template<
class T>
class NonCopyablePersistentTraits;
94 template <
class T,
class M = NonCopyablePersistentTraits<T> >
105 template <
class K,
class V,
class T>
107 template <
class K,
class V,
class T>
110 template<
class T,
class P>
class WeakCallbackObject;
118 class CallHandlerHelper;
124 class DeferredHandles;
127 class ExternalString;
129 class LocalEmbedderHeapTracer;
130 class MicrotaskQueue;
131 struct ScriptStreamingData;
133 class PropertyCallbackArguments;
134 class FunctionCallbackArguments;
136 class ScopedExternalStringLock;
137 class ThreadLocalTop;
141 class StreamingDecoder;
147 class ConsoleCallArguments;
152 #define TYPE_CHECK(T, S) 154 *(static_cast<T* volatile*>(0
)) = static_cast<S*>(0
); 194 : val_(
reinterpret_cast<T*>(*that)) {
231 if (a ==
nullptr)
return b ==
nullptr;
232 if (b ==
nullptr)
return false;
240 if (a ==
nullptr)
return b ==
nullptr;
241 if (b ==
nullptr)
return false;
257 return !operator==(that);
262 return !operator==(that);
271 #ifdef V8_ENABLE_CHECKS 274 if (that.IsEmpty())
return Local<T>();
276 return Local<T>(T::Cast(*that));
286 return Local<S>::Cast(*
this);
305 template<
class F>
friend class Local;
322 template <
class F1,
class F2,
class F3>
336 explicit V8_INLINE Local(T* that) : val_(that) {}
342 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS) 365 : val_(
reinterpret_cast<T*>(*that)) {
377 out->val_ =
IsEmpty() ?
nullptr :
this->val_;
404 template <
class T>
class Eternal {
409 Set(isolate, handle);
421 static const int kInternalFieldsInWeakCallback = 2;
422 static const int kEmbedderFieldsInWeakCallback = 2;
424 template <
typename T>
430 void* embedder_fields[kEmbedderFieldsInWeakCallback],
432 : isolate_(isolate), parameter_(parameter), callback_(callback) {
433 for (
int i = 0; i < kEmbedderFieldsInWeakCallback; ++i) {
434 embedder_fields_[i] = embedder_fields[i];
454 void* embedder_fields_[kEmbedderFieldsInWeakCallback];
503 return Local<T>::New(isolate, *
this);
510 if (a ==
nullptr)
return b ==
nullptr;
511 if (b ==
nullptr)
return false;
519 if (a ==
nullptr)
return b ==
nullptr;
520 if (b ==
nullptr)
return false;
526 return !operator==(that);
531 return !operator==(that);
541 template <
typename P>
589 template<
class F>
friend class Local;
595 template <
class F1,
class F2,
class F3>
600 explicit V8_INLINE PersistentBase(T* val) : val_(val) {}
614 class NonCopyablePersistentTraits {
618 template<
class S,
class M>
638 template<
class S,
class M>
675 template <
class S,
class M2>
689 template <
class S,
class M2>
697 template <
class S,
class M2>
708 if (M::kResetInDestructor)
this->Reset();
714 #ifdef V8_ENABLE_CHECKS 717 if (!that.IsEmpty()) T::Cast(*that);
731 template<
class F>
friend class Local;
736 V8_INLINE T* operator*()
const {
return this->val_; }
737 template<
class S,
class M2>
806 V8_INLINE T* operator*()
const {
return this->val_; }
817 template <
typename T>
835 template <
typename T>
842 bool IsEmpty()
const {
return val_ ==
nullptr; }
859 if (a ==
nullptr)
return b ==
nullptr;
860 if (b ==
nullptr)
return false;
868 if (a ==
nullptr)
return b ==
nullptr;
869 if (b ==
nullptr)
return false;
875 return !operator==(that);
880 return !operator==(that);
901 enum DestructionMode { kWithDestructor, kWithoutDestructor };
906 TracedReferenceBase() =
default;
909 DestructionMode destruction_mode);
914 template <
typename F>
917 template <
typename F>
919 template <
typename F>
921 template <
typename F>
929 template <
typename T>
952 this->val_ =
this->New(isolate, that.val_, &
this->val_,
962 *
this = std::move(other);
968 template <
typename S>
971 *
this = std::move(other);
985 template <
typename S>
1057 template <
typename T>
1075 this->val_ =
this->New(isolate, that.val_, &
this->val_,
1086 *
this = std::move(other);
1093 template <
typename S>
1096 *
this = std::move(other);
1112 template <
typename S>
1169 V8_DEPRECATED(
"Use TracedGlobal<> if callbacks are required.")
1200 return reinterpret_cast<
Isolate*>(isolate_);
1217 void* operator
new(size_t size);
1218 void* operator
new[](size_t size);
1219 void operator
delete(
void*, size_t);
1220 void operator
delete[](
void*, size_t);
1253 return Local<T>(
reinterpret_cast<T*>(slot));
1258 return Escape(value.FromMaybe(
Local<T>()));
1267 void* operator
new(size_t size);
1268 void* operator
new[](size_t size);
1269 void operator
delete(
void*, size_t);
1270 void operator
delete[](
void*, size_t);
1292 void* operator
new(size_t size);
1293 void* operator
new[](size_t size);
1294 void operator
delete(
void*, size_t);
1295 void operator
delete[](
void*, size_t);
1299 int prev_sealed_level_;
1356 bool is_opaque =
false,
bool is_wasm =
false,
1357 bool is_module =
false)
1358 : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
1359 (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) |
1360 (is_module ? kIsModule : 0)) {}
1363 (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {}
1366 return (flags_ & kIsSharedCrossOrigin) != 0;
1368 bool IsOpaque()
const {
return (flags_ & kIsOpaque) != 0; }
1369 bool IsWasm()
const {
return (flags_ & kIsWasm) != 0; }
1370 bool IsModule()
const {
return (flags_ & kIsModule) != 0; }
1376 kIsSharedCrossOrigin = 1,
1466 : line_number_(line_number), column_number_(column_number) {}
1597 "Use the preceding SetSyntheticModuleExport with an Isolate parameter, " 1598 "instead of the one that follows. The former will throw a runtime " 1599 "error if called for an export that doesn't exist (as per spec); " 1600 "the latter will crash with a failed CHECK().")
1601 void SetSyntheticModuleExport(
Local<
String> export_name,
1746 virtual size_t
GetMoreData(
const uint8_t** src) = 0;
1777 "This class takes ownership of source_stream, so use the constructor " 1778 "taking a unique_ptr to make these semantics clearer")
1791 std::unique_ptr<
internal::ScriptStreamingData> impl_;
1805 explicit ScriptStreamingTask(
internal::ScriptStreamingData* data)
1808 internal::ScriptStreamingData* data_;
1942 Local<
String> arguments[], size_t context_extension_count,
2326 size_t* actual_size);
2392 PrivateData* private_;
2417 Isolate* isolate, uint32_t transfer_id);
2424 Isolate* isolate, uint32_t clone_id);
2471 "Wasm module serialization is only supported via explicit methods, e.g. " 2472 "CompiledWasmModule::Serialize()")
2473 void SetExpectInlineWasm(
bool allow_inline_wasm) {}
2497 PrivateData* private_;
2909 V8_INLINE bool QuickIsUndefined()
const;
2911 V8_INLINE bool QuickIsNullOrUndefined()
const;
2913 bool FullIsUndefined()
const;
2914 bool FullIsNull()
const;
2915 bool FullIsString()
const;
2936 static void CheckCast(
v8::
Value* obj);
2957 static void CheckCast(
Value* obj);
3057 int Write(
Isolate* isolate, uint16_t* buffer,
int start = 0,
int length = -1,
3061 int length = -1,
int options =
NO_OPTIONS)
const;
3064 int* nchars_ref =
nullptr,
int options =
NO_OPTIONS)
const;
3149 virtual const uint16_t*
data()
const = 0;
3154 virtual size_t
length()
const = 0;
3179 virtual const char*
data()
const = 0;
3181 virtual size_t
length()
const = 0;
3211 Isolate* isolate,
const char* data,
3217 Isolate* isolate,
const uint8_t* data,
3223 Isolate* isolate,
const uint16_t* data,
3342 static void CheckCast(
v8::
Value* obj);
3399 static void CheckCast(
Value* obj);
3437 static void CheckCast(
Data* that);
3446 double Value()
const;
3451 static void CheckCast(
v8::
Value* obj);
3462 int64_t
Value()
const;
3466 static void CheckCast(
v8::
Value* obj);
3475 int32_t
Value()
const;
3480 static void CheckCast(
v8::
Value* obj);
3489 uint32_t
Value()
const;
3494 static void CheckCast(
v8::
Value* obj);
3512 int word_count,
const uint64_t* words);
3520 uint64_t
Uint64Value(
bool* lossless =
nullptr)
const;
3527 int64_t
Int64Value(
bool* lossless =
nullptr)
const;
3543 void ToWordsArray(
int* sign_bit,
int* word_count, uint64_t* words)
const;
3549 static void CheckCast(
v8::
Value* obj);
4102 static void CheckCast(
Value* obj);
4103 Local<
Value> SlowGetInternalField(
int index);
4104 void* SlowGetAlignedPointerFromInternalField(
int index);
4130 static void CheckCast(
Value* obj);
4139 size_t
Size()
const;
4166 static void CheckCast(
Value* obj);
4175 size_t
Size()
const;
4198 static void CheckCast(
Value* obj);
4202 template<
typename T>
4206 : value_(that.value_) {
4210 template <
typename S>
4212 template <
typename S>
4214 template <
typename S>
4229 template <
typename S>
4241 template <
class F,
class G,
class H>
4256 template<
typename T>
4295 friend class debug::ConsoleCallArguments;
4315 template<
typename T>
4407 friend class MacroAssembler;
4514 static void CheckCast(
Value* obj);
4517 #ifndef V8_PROMISE_INTERNAL_FIELD_COUNT 4519 #define V8_PROMISE_INTERNAL_FIELD_COUNT 0
4560 static void CheckCast(
Value* obj);
4607 static void CheckCast(
Value* obj);
4680 PrivateData* private_;
4705 static void CheckCast(
Value* obj);
4718 template <
typename T>
4724 constexpr MemorySpan(T* data, size_t size) : data_(data), size_(size) {}
4727 constexpr T*
data()
const {
return data_; }
4729 constexpr size_t
size()
const {
return size_; }
4763 explicit CompiledWasmModule(std::shared_ptr<
internal::
wasm::NativeModule>);
4766 const std::shared_ptr<
internal::
wasm::NativeModule> native_module_;
4792 "Use WasmStreaming for deserialization from cache or the " 4793 "CompiledWasmModule to transfer between isolates")
4805 const uint8_t* start,
4808 static void CheckCast(
Value* obj);
4819 class WasmStreamingImpl;
4826 virtual ~
Client() =
default;
4834 explicit WasmStreaming(std::unique_ptr<WasmStreamingImpl> impl);
4877 void SetUrl(
const char* url, size_t length);
4884 static std::shared_ptr<WasmStreaming>
Unpack(
Isolate* isolate,
4888 std::unique_ptr<WasmStreamingImpl> impl_;
4912 WasmModuleObjectBuilderStreaming(
const WasmModuleObjectBuilderStreaming&) =
4914 WasmModuleObjectBuilderStreaming(WasmModuleObjectBuilderStreaming&&) =
4916 WasmModuleObjectBuilderStreaming& operator=(
4917 const WasmModuleObjectBuilderStreaming&) =
delete;
4918 WasmModuleObjectBuilderStreaming& operator=(
4919 WasmModuleObjectBuilderStreaming&&) =
default;
4930 Persistent<Promise, CopyablePersistentTraits<Promise>> promise_;
4934 std::shared_ptr<
internal::
wasm::StreamingDecoder> streaming_decoder_;
4937 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 4939 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2