23 #include <type_traits>
53 class ImplementationUtilities;
64 class ObjectOperationDescriptor;
71 class RawOperationDescriptor;
88 template <
class T>
class Local;
91 template <
class T>
class Eternal;
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)) {
227 if (a ==
nullptr)
return b ==
nullptr;
228 if (b ==
nullptr)
return false;
236 if (a ==
nullptr)
return b ==
nullptr;
237 if (b ==
nullptr)
return false;
249 return !operator==(that);
254 return !operator==(that);
263 #ifdef V8_ENABLE_CHECKS
266 if (that.IsEmpty())
return Local<T>();
268 return Local<T>(T::Cast(*that));
278 return Local<S>::Cast(*
this);
297 template<
class F>
friend class Local;
314 template <
class F1,
class F2,
class F3>
328 explicit V8_INLINE Local(T* that) : val_(that) {}
334 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
357 : val_(
reinterpret_cast<T*>(*that)) {
369 out->val_ =
IsEmpty() ?
nullptr :
this->val_;
401 Set(isolate, handle);
413 static const int kInternalFieldsInWeakCallback = 2;
414 static const int kEmbedderFieldsInWeakCallback = 2;
416 template <
typename T>
422 void* embedder_fields[kEmbedderFieldsInWeakCallback],
424 : isolate_(isolate), parameter_(parameter), callback_(callback) {
425 for (
int i = 0; i < kEmbedderFieldsInWeakCallback; ++i) {
426 embedder_fields_[i] = embedder_fields[i];
446 void* embedder_fields_[kEmbedderFieldsInWeakCallback];
495 return Local<T>::New(isolate, *
this);
502 if (a ==
nullptr)
return b ==
nullptr;
503 if (b ==
nullptr)
return false;
511 if (a ==
nullptr)
return b ==
nullptr;
512 if (b ==
nullptr)
return false;
518 return !operator==(that);
523 return !operator==(that);
533 template <
typename P>
581 template<
class F>
friend class Local;
587 template <
class F1,
class F2,
class F3>
592 explicit V8_INLINE PersistentBase(T* val) : val_(val) {}
606 class NonCopyablePersistentTraits {
610 template<
class S,
class M>
630 template<
class S,
class M>
667 template <
class S,
class M2>
681 template <
class S,
class M2>
689 template <
class S,
class M2>
700 if (M::kResetInDestructor)
this->Reset();
706 #ifdef V8_ENABLE_CHECKS
709 if (!that.IsEmpty()) T::Cast(*that);
723 template<
class F>
friend class Local;
728 V8_INLINE T* operator*()
const {
return this->val_; }
729 template<
class S,
class M2>
798 V8_INLINE T* operator*()
const {
return this->val_; }
809 template <
typename T>
827 template <
typename T>
834 bool IsEmpty()
const {
return val_ ==
nullptr; }
851 if (a ==
nullptr)
return b ==
nullptr;
852 if (b ==
nullptr)
return false;
860 if (a ==
nullptr)
return b ==
nullptr;
861 if (b ==
nullptr)
return false;
867 return !operator==(that);
872 return !operator==(that);
906 enum DestructionMode { kWithDestructor, kWithoutDestructor };
911 TracedReferenceBase() =
default;
914 DestructionMode destruction_mode);
919 template <
typename F>
922 template <
typename F>
924 template <
typename F>
926 template <
typename F>
934 template <
typename T>
957 this->val_ =
this->New(isolate, that.val_, &
this->val_,
967 *
this = std::move(other);
973 template <
typename S>
976 *
this = std::move(other);
990 template <
typename S>
1044 template <
typename T>
1062 this->val_ =
this->New(isolate, that.val_, &
this->val_,
1073 *
this = std::move(other);
1080 template <
typename S>
1083 *
this = std::move(other);
1099 template <
typename S>
1173 return reinterpret_cast<
Isolate*>(isolate_);
1190 void* operator
new(size_t size);
1191 void* operator
new[](size_t size);
1192 void operator
delete(
void*, size_t);
1193 void operator
delete[](
void*, size_t);
1226 return Local<T>(
reinterpret_cast<T*>(slot));
1231 return Escape(value.FromMaybe(
Local<T>()));
1240 void* operator
new(size_t size);
1241 void* operator
new[](size_t size);
1242 void operator
delete(
void*, size_t);
1243 void operator
delete[](
void*, size_t);
1265 void* operator
new(size_t size);
1266 void* operator
new[](size_t size);
1267 void operator
delete(
void*, size_t);
1268 void operator
delete[](
void*, size_t);
1272 int prev_sealed_level_;
1329 bool is_opaque =
false,
bool is_wasm =
false,
1330 bool is_module =
false)
1331 : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
1332 (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) |
1333 (is_module ? kIsModule : 0)) {}
1336 (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {}
1339 return (flags_ & kIsSharedCrossOrigin) != 0;
1341 bool IsOpaque()
const {
return (flags_ & kIsOpaque) != 0; }
1342 bool IsWasm()
const {
return (flags_ & kIsWasm) != 0; }
1343 bool IsModule()
const {
return (flags_ & kIsModule) != 0; }
1349 kIsSharedCrossOrigin = 1,
1439 : line_number_(line_number), column_number_(column_number) {}
1742 "This class takes ownership of source_stream, so use the constructor "
1743 "taking a unique_ptr to make these semantics clearer")
1756 std::unique_ptr<
internal::ScriptStreamingData> impl_;
1770 explicit ScriptStreamingTask(
internal::ScriptStreamingData* data)
1773 internal::ScriptStreamingData* data_;
1907 Local<
String> arguments[], size_t context_extension_count,
2276 size_t* actual_size);
2342 PrivateData* private_;
2367 Isolate* isolate, uint32_t transfer_id);
2374 Isolate* isolate, uint32_t clone_id);
2444 PrivateData* private_;
2782 V8_INLINE bool QuickIsUndefined()
const;
2784 V8_INLINE bool QuickIsNullOrUndefined()
const;
2786 bool FullIsUndefined()
const;
2787 bool FullIsNull()
const;
2788 bool FullIsString()
const;
2809 static void CheckCast(
v8::
Value* obj);
2830 static void CheckCast(
Value* obj);
2930 int Write(
Isolate* isolate, uint16_t* buffer,
int start = 0,
int length = -1,
2934 int length = -1,
int options =
NO_OPTIONS)
const;
2937 int* nchars_ref =
nullptr,
int options =
NO_OPTIONS)
const;
3022 virtual const uint16_t*
data()
const = 0;
3052 virtual const char*
data()
const = 0;
3084 Isolate* isolate,
const char* data,
3090 Isolate* isolate,
const uint8_t* data,
3096 Isolate* isolate,
const uint16_t* data,
3215 static void CheckCast(
v8::
Value* obj);
3267 static void CheckCast(
Value* obj);
3305 static void CheckCast(
Data* that);
3319 static void CheckCast(
v8::
Value* obj);
3334 static void CheckCast(
v8::
Value* obj);
3348 static void CheckCast(
v8::
Value* obj);
3362 static void CheckCast(
v8::
Value* obj);
3380 int word_count,
const uint64_t* words);
3417 static void CheckCast(
v8::
Value* obj);
3970 static void CheckCast(
Value* obj);
3971 Local<
Value> SlowGetInternalField(
int index);
3972 void* SlowGetAlignedPointerFromInternalField(
int index);
3998 static void CheckCast(
Value* obj);
4034 static void CheckCast(
Value* obj);
4066 static void CheckCast(
Value* obj);
4070 template<
typename T>
4074 : value_(that.value_) {
4078 template <
typename S>
4080 template <
typename S>
4082 template <
typename S>
4097 template <
typename S>
4109 template <
class F,
class G,
class H>
4124 template<
typename T>
4160 friend class debug::ConsoleCallArguments;
4180 template<
typename T>
4272 friend class MacroAssembler;
4379 static void CheckCast(
Value* obj);
4382 #ifndef V8_PROMISE_INTERNAL_FIELD_COUNT
4384 #define V8_PROMISE_INTERNAL_FIELD_COUNT 0
4425 static void CheckCast(
Value* obj);
4472 static void CheckCast(
Value* obj);
4545 PrivateData* private_;
4570 static void CheckCast(
Value* obj);
4583 template <
typename T>
4589 constexpr MemorySpan(T* data, size_t size) : data_(data), size_(size) {}
4592 constexpr T*
data()
const {
return data_; }
4594 constexpr size_t
size()
const {
return size_; }
4628 explicit CompiledWasmModule(std::shared_ptr<
internal::
wasm::NativeModule>);
4631 const std::shared_ptr<
internal::
wasm::NativeModule> native_module_;
4660 Isolate* isolate,
const TransferrableModule&);
4689 const uint8_t* start,
4692 static void CheckCast(
Value* obj);
4703 class WasmStreamingImpl;
4766 std::unique_ptr<WasmStreamingImpl> impl_;
4790 WasmModuleObjectBuilderStreaming(
const WasmModuleObjectBuilderStreaming&) =
4792 WasmModuleObjectBuilderStreaming(WasmModuleObjectBuilderStreaming&&) =
4794 WasmModuleObjectBuilderStreaming& operator=(
4795 const WasmModuleObjectBuilderStreaming&) =
delete;
4796 WasmModuleObjectBuilderStreaming& operator=(
4797 WasmModuleObjectBuilderStreaming&&) =
default;
4808 Persistent<Promise, CopyablePersistentTraits<Promise>> promise_;
4812 std::shared_ptr<
internal::
wasm::StreamingDecoder> streaming_decoder_;
4815 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
4817 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
4891 virtual void Free(
void* data, size_t length) = 0;
4920 using DeleterCallback =
void (*)(
void* buffer, size_t length,
void* info);
4925 allocation_base_(
nullptr),
4926 allocation_length_(0),
4929 deleter_data_(
nullptr) {}
4934 return allocation_mode_;
4937 void*
Data()
const {
return data_; }
4939 DeleterCallback
Deleter()
const {
return deleter_; }
4943 Contents(
void* data, size_t byte_length,
void* allocation_base,
4944 size_t allocation_length,
4946 void* deleter_data);
4949 size_t byte_length_;
4950 void* allocation_base_;
4951 size_t allocation_length_;
4953 DeleterCallback deleter_;
4954 void* deleter_data_;
4983 Isolate* isolate,
void* data, size_t byte_length,
5068 static void CheckCast(
Value* obj);
5069 Contents GetContents(
bool externalize);
5073 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
5075 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
5124 static void CheckCast(
Value* obj);
5149 static void CheckCast(
Value* obj);
5159 size_t byte_offset, size_t length);
5161 size_t byte_offset, size_t length);
5166 static void CheckCast(
Value* obj);
5176 size_t byte_offset, size_t length);
5183 Uint8ClampedArray();
5184 static void CheckCast(
Value* obj);
5193 size_t byte_offset, size_t length);
5195 size_t byte_offset, size_t length);
5200 static void CheckCast(
Value* obj);
5210 size_t byte_offset, size_t length);
5212 size_t byte_offset, size_t length);
5217 static void CheckCast(
Value* obj);
5227 size_t byte_offset, size_t length);
5229 size_t byte_offset, size_t length);
5234 static void CheckCast(
Value* obj);
5244 size_t byte_offset, size_t length);
5246 size_t byte_offset, size_t length);
5251 static void CheckCast(
Value* obj);
5261 size_t byte_offset, size_t length);
5263 size_t byte_offset, size_t length);
5268 static void CheckCast(
Value* obj);
5278 size_t byte_offset, size_t length);
5280 size_t byte_offset, size_t length);
5285 static void CheckCast(
Value* obj);
5295 size_t byte_offset, size_t length);
5297 size_t byte_offset, size_t length);
5302 static void CheckCast(
Value* obj);
5311 size_t byte_offset, size_t length);
5313 size_t byte_offset, size_t length);
5318 static void CheckCast(
Value* obj);
5327 size_t byte_offset, size_t length);
5329 size_t byte_offset, size_t length);
5334 static void CheckCast(
Value* obj);
5343 size_t byte_offset, size_t length);
5345 size_t byte_offset, size_t length);
5350 static void CheckCast(
Value* obj);
5374 using DeleterCallback =
void (*)(
void* buffer, size_t length,
void* info);
5379 allocation_base_(
nullptr),
5380 allocation_length_(0),
5383 deleter_data_(
nullptr) {}
5388 return allocation_mode_;
5391 void*
Data()
const {
return data_; }
5393 DeleterCallback
Deleter()
const {
return deleter_; }
5397 Contents(
void* data, size_t byte_length,
void* allocation_base,
5398 size_t allocation_length,
5399 Allocator::
AllocationMode allocation_mode, DeleterCallback deleter,
5400 void* deleter_data);
5403 size_t byte_length_;
5404 void* allocation_base_;
5405 size_t allocation_length_;
5407 DeleterCallback deleter_;
5408 void* deleter_data_;
5433 Isolate* isolate,
void* data, size_t byte_length,
5455 V8_DEPRECATED(
"Use New method with data, and byte_length instead.")
5518 SharedArrayBuffer();
5519 static void CheckCast(
Value* obj);
5520 Contents GetContents(
bool externalize);
5541 static void CheckCast(
Value* obj);
5557 static void CheckCast(
Value* obj);
5572 static void CheckCast(
Value* obj);
5587 static void CheckCast(
Value* obj);
5603 static void CheckCast(
Value* obj);
5619 static void CheckCast(
Value* obj);
5672 static void CheckCast(
Value* obj);
5712 static void CheckCast(
v8::
Value* obj);
5715 #define V8_INTRINSICS_LIST(F)
5716 F(ArrayProto_entries, array_entries_iterator)
5717 F(ArrayProto_forEach, array_for_each_iterator)
5718 F(ArrayProto_keys, array_keys_iterator)
5719 F(ArrayProto_values, array_values_iterator)
5720 F(ErrorPrototype, initial_error_prototype)
5721 F(IteratorPrototype, initial_iterator_prototype)
5724 #define V8_DECL_INTRINSIC(name, iname) k##name,
5726 #undef V8_DECL_INTRINSIC
6276 static void CheckCast(
Data* that);
6559 deleter
, enumerator
, data
));
6645 static void CheckCast(
Data* that);
6668 static void CheckCast(
Data* that);
6685 AccessorSignature();
6687 static void CheckCast(
Data* that);
6700 Extension(
const char* name,
const char* source =
nullptr,
int dep_count = 0,
6701 const char** deps =
nullptr,
int source_length = -1);
6708 const char*
name()
const {
return name_; }
6724 size_t source_length_;
6775 size_t maximum_heap_size_in_bytes);
6787 uint64_t virtual_memory_limit);
6810 return max_old_generation_size_;
6813 max_old_generation_size_ = limit;
6822 return max_young_generation_size_;
6825 max_young_generation_size_ = limit;
6829 return initial_old_generation_size_;
6832 initial_old_generation_size_ = initial_size;
6836 return initial_young_generation_size_;
6839 initial_young_generation_size_ = initial_size;
6849 code_range_size_ = limit_in_mb * kMB;
6859 max_old_generation_size_ = limit_in_mb * kMB;
6867 static constexpr size_t kMB = 1048576u;
6868 size_t code_range_size_ = 0;
6869 size_t max_old_generation_size_ = 0;
6870 size_t max_young_generation_size_ = 0;
6871 size_t max_zone_pool_size_ = 0;
6872 size_t initial_old_generation_size_ = 0;
6873 size_t initial_young_generation_size_ = 0;
6874 uint32_t* stack_limit_ =
nullptr;
6886 const char* message);
7043 : promise_(promise), event_(event), value_(value) {}
7109 void* data =
nullptr) = 0;
7153 MicrotaskQueue() =
default;
7194 internal::MicrotaskQueue*
const microtask_queue_;
7288 typedef size_t (*NearHeapLimitCallback)(
void* data, size_t current_heap_limit,
7289 size_t initial_heap_limit);
7319 size_t total_heap_size_;
7320 size_t total_heap_size_executable_;
7321 size_t total_physical_size_;
7322 size_t total_available_size_;
7323 size_t used_heap_size_;
7324 size_t heap_size_limit_;
7325 size_t malloced_memory_;
7326 size_t external_memory_;
7327 size_t peak_malloced_memory_;
7328 bool does_zap_garbage_;
7329 size_t number_of_native_contexts_;
7330 size_t number_of_detached_contexts_;
7347 const char* space_name_;
7349 size_t space_used_size_;
7350 size_t space_available_size_;
7351 size_t physical_space_size_;
7366 const char* object_type_;
7367 const char* object_sub_type_;
7368 size_t object_count_;
7369 size_t object_size_;
7382 size_t code_and_metadata_size_;
7383 size_t bytecode_and_metadata_size_;
7384 size_t external_script_source_size_;
7506 #if defined(V8_OS_WIN)
7528 uint16_t class_id) {}
7605 const std::vector<std::pair<
void*,
void*> >& embedder_fields) = 0;
7694 "Use TracedReference version when not requiring destructors.")
7695 virtual void ResetHandleInNonTracingGC(
7738 void* data_arg =
nullptr)
7755 void* data_arg =
nullptr)
7907 void* internal_throws_;
7908 void* internal_assert_;
7909 void* internal_dump_;
7930 internal::MicrotaskQueue*
const microtask_queue_;
8309 size_t frames_limit,
SampleInfo* sample_info);
8484 size_t offset_in_bytes, int64_t value,
8485 double timeout_in_ms,
8516 void* data =
nullptr);
8519 typedef size_t (*GetExternallyAllocatedMemoryInBytesCallback)();
8528 GetExternallyAllocatedMemoryInBytesCallback callback);
8957 bool capture,
int frame_limit = 10,
9044 template <
class K,
class V,
class Traits>
9048 void ReportExternalAllocationLimitReached();
9049 void CheckMemoryPressure();
9085 typedef uintptr_t (*ReturnAddressLocationResolver)(
9086 uintptr_t return_addr_location);
9109 V8_DEPRECATED(
"The natives blob is deprecated (https://crbug.com/v8/7624).")
9150 ReturnAddressLocationResolver return_address_resolver);
9185 const char* icu_data_file =
nullptr);
9204 V8_DEPRECATED(
"The natives blob is deprecated (https://crbug.com/v8/7624).")
9206 const char* snapshot_blob);
9242 static bool TryHandleSignal(
int signal_number,
void* info,
void* context);
9253 #if defined(V8_OS_WIN)
9275 bool has_destructor);
9280 static void CopyTracedGlobalReference(
const internal::
Address*
const* from,
9290 static void SetFinalizationCallbackTraced(
9297 template <
class K,
class V,
class T>
9300 static void FromJustIsNothing();
9301 static void ToLocalEmpty();
9302 static void InternalFieldOutOfBounds(
int index);
9340 const intptr_t* external_references =
nullptr,
9481 return has_value_ ? value_ : default_value;
9485 return (
IsJust() == other.IsJust()) &&
9494 Maybe() : has_value_(
false) {}
9495 explicit Maybe(
const T& t) : has_value_(
true), value_(t) {}
9534 Maybe() : is_valid_(
false) {}
9535 explicit Maybe(JustTag) : is_valid_(
true) {}
9671 if (handler ==
nullptr)
return nullptr;
9672 return handler->js_stack_comparable_address_;
9681 void* operator
new(size_t size);
9682 void* operator
new[](size_t size);
9683 void operator
delete(
void*, size_t);
9684 void operator
delete[](
void*, size_t);
9686 void ResetInternal();
9692 void* js_stack_comparable_address_;
9693 bool is_verbose_ : 1;
9694 bool can_continue_ : 1;
9695 bool capture_message_ : 1;
9697 bool has_terminated_ : 1;
9713 : name_count_(name_count), names_(names) { }
9715 const char**
begin()
const {
return &names_[0]; }
9716 const char**
end()
const {
return &names_[name_count_]; }
9719 const int name_count_;
9720 const char** names_;
9794 Isolate* isolate, size_t context_snapshot_index,
9978 return js_stack_comparable_address_;
9985 uintptr_t js_stack_comparable_address_ = 0;
9986 const BackupIncumbentScope* prev_ =
nullptr;
9997 void* SlowGetAlignedPointerFromEmbedderData(
int index);
10086 void Initialize(
Isolate* isolate);
10117 void Initialize(
Isolate* isolate);
10161 const void* stack_base);
10178 return New(isolate, that.val_);
10183 return New(isolate, that.val_);
10188 return New(isolate, that.val_);
10193 if (that ==
nullptr)
return Local<T>();
10194 T* that_ptr = that;
10197 reinterpret_cast<
internal::Isolate*>(isolate)
, *p
)));
10205 val_ =
reinterpret_cast<T*>(
10206 V8::Eternalize(isolate,
reinterpret_cast<
Value*>(*handle)));
10213 return Local<T>(val_);
10220 return Local<T>(val_);
10226 #ifdef V8_ENABLE_CHECKS
10227 if (index < 0 || index >= kEmbedderFieldsInWeakCallback) {
10228 V8::InternalFieldOutOfBounds(index);
10231 return embedder_fields_[index];
10237 if (that ==
nullptr)
return nullptr;
10239 return reinterpret_cast<T*>(
10240 V8::GlobalizeReference(
reinterpret_cast<
internal::Isolate*>(isolate),
10245 template <
class T,
class M>
10246 template <
class S,
class M2>
10250 if (that.IsEmpty())
return;
10252 this->val_ =
reinterpret_cast<T*>(
V8::CopyGlobalReference(p));
10253 M::Copy(that,
this);
10259 if (
this->IsEmpty())
return false;
10267 if (
this->IsEmpty())
return;
10278 if (other.IsEmpty())
return;
10279 this->val_ = New(isolate, other.val_);
10289 if (other.IsEmpty())
return;
10290 this->val_ = New(isolate, other.val_);
10295 template <
typename P>
10301 reinterpret_cast<Callback>(callback), type);
10310 template <
typename P>
10312 return reinterpret_cast<P*>(
10325 if (
this->IsEmpty())
return;
10328 *
reinterpret_cast<uint16_t*>(addr) = class_id;
10335 if (
this->IsEmpty())
return 0;
10338 return *
reinterpret_cast<uint16_t*>(addr);
10343 if (other.val_ !=
nullptr) {
10346 other.val_ =
nullptr;
10354 if (
this != &rhs) {
10356 if (rhs.val_ !=
nullptr) {
10357 this->val_ = rhs.val_;
10358 V8::MoveGlobalReference(
10361 rhs.val_ =
nullptr;
10369 DestructionMode destruction_mode) {
10370 if (that ==
nullptr)
return nullptr;
10372 return reinterpret_cast<T*>(
V8::GlobalizeTracedReference(
10373 reinterpret_cast<
internal::Isolate*>(isolate), p,
10375 destruction_mode == kWithDestructor));
10390 if (other.IsEmpty())
return;
10391 this->val_ =
this->New(isolate, other.val_, &
this->val_,
10399 *
this = std::move(rhs.
template As<T>());
10407 *
this = rhs.
template As<T>();
10413 if (
this != &rhs) {
10415 if (rhs.val_ !=
nullptr) {
10416 this->val_ = rhs.val_;
10417 V8::MoveTracedGlobalReference(
10420 rhs.val_ =
nullptr;
10428 if (
this != &rhs) {
10430 if (rhs.val_ !=
nullptr) {
10431 V8::CopyTracedGlobalReference(
10444 if (other.IsEmpty())
return;
10445 this->val_ =
this->New(isolate, other.val_, &
this->val_,
10453 *
this = std::move(rhs.
template As<T>());
10462 *
this = rhs.
template As<T>();
10468 if (
this != &rhs) {
10470 if (rhs.val_ !=
nullptr) {
10471 this->val_ = rhs.val_;
10472 V8::MoveTracedGlobalReference(
10475 rhs.val_ =
nullptr;
10483 if (
this != &rhs) {
10485 if (rhs.val_ !=
nullptr) {
10486 V8::CopyTracedGlobalReference(
10500 *
reinterpret_cast<uint16_t*>(addr) = class_id;
10509 return *
reinterpret_cast<uint16_t*>(addr);
10516 parameter, callback);
10519 template <
typename T>
10522 template <
typename T>
10523 template <
typename S>
10527 *value_ = GetDefaultValue();
10533 template <
typename T>
10534 template <
typename S>
10538 *value_ = GetDefaultValue();
10544 template <
typename T>
10545 template <
typename S>
10549 *value_ = GetDefaultValue();
10555 template<
typename T>
10561 template<
typename T>
10572 template<
typename T>
10576 bool fits_into_int32_t = (i & (1U << 31)) == 0;
10578 Set(
static_cast<int32_t>(i));
10584 template<
typename T>
10597 template<
typename T>
10604 template<
typename T>
10611 template<
typename T>
10618 template <
typename T>
10621 return *
reinterpret_cast<
Isolate**>(&value_[-2]);
10624 template <
typename T>
10632 template <
typename T>
10633 template <
typename S>
10639 template <
typename T>
10645 template <
typename T>
10651 template<
typename T>
10658 template<
typename T>
10664 template<
typename T>
10670 template <
typename T>
10676 template <
typename T>
10682 template<
typename T>
10688 template<
typename T>
10694 template<
typename T>
10700 template<
typename T>
10714 : resource_name_(resource_name),
10715 resource_line_offset_(resource_line_offset),
10716 resource_column_offset_(resource_column_offset),
10717 options_
(!resource_is_shared_cross_origin
.IsEmpty() &&
10722 script_id_(script_id),
10723 source_map_url_(source_map_url),
10724 host_defined_options_(host_defined_options) {}
10729 return host_defined_options_;
10733 return resource_line_offset_;
10738 return resource_column_offset_;
10749 : source_string(string),
10756 cached_data(data) {}
10760 : source_string(string), cached_data(data) {}
10764 delete cached_data;
10770 return cached_data;
10774 return resource_options;
10788 #ifdef V8_ENABLE_CHECKS
10795 #ifdef V8_ENABLE_CHECKS
10802 #ifdef V8_ENABLE_CHECKS
10805 return reinterpret_cast<
Signature*>(data);
10809 #ifdef V8_ENABLE_CHECKS
10816 #ifndef V8_ENABLE_CHECKS
10819 A obj = *
reinterpret_cast<A*>(
this);
10828 #ifdef V8_COMPRESS_POINTERS
10831 value = I::DecompressTaggedAnyField(obj,
static_cast<int32_t>(value));
10839 return SlowGetInternalField(index);
10844 #ifndef V8_ENABLE_CHECKS
10847 A obj = *
reinterpret_cast<A*>(
this);
10858 return SlowGetAlignedPointerFromInternalField(index);
10862 #ifdef V8_ENABLE_CHECKS
10865 return static_cast<
String*>(value);
10881 A obj = *
reinterpret_cast<
const A*>(
this);
10888 result = GetExternalStringResourceSlow();
10890 #ifdef V8_ENABLE_CHECKS
10891 VerifyExternalStringResource(result);
10901 A obj = *
reinterpret_cast<
const A*>(
this);
10910 resource = GetExternalStringResourceBaseSlow(encoding_out);
10912 #ifdef V8_ENABLE_CHECKS
10913 VerifyExternalStringResourceBase(resource, *encoding_out);
10920 #ifdef V8_ENABLE_CHECKS
10921 return FullIsUndefined();
10923 return QuickIsUndefined();
10927 bool Value::QuickIsUndefined()
const {
10930 A obj = *
reinterpret_cast<
const A*>(
this);
10938 #ifdef V8_ENABLE_CHECKS
10939 return FullIsNull();
10941 return QuickIsNull();
10945 bool Value::QuickIsNull()
const {
10948 A obj = *
reinterpret_cast<
const A*>(
this);
10955 #ifdef V8_ENABLE_CHECKS
10956 return FullIsNull() || FullIsUndefined();
10958 return QuickIsNullOrUndefined();
10962 bool Value::QuickIsNullOrUndefined()
const {
10965 A obj = *
reinterpret_cast<
const A*>(
this);
10973 #ifdef V8_ENABLE_CHECKS
10974 return FullIsString();
10976 return QuickIsString();
10980 bool Value::QuickIsString()
const {
10983 A obj = *
reinterpret_cast<
const A*>(
this);
10990 return static_cast<
Value*>(value);
10995 #ifdef V8_ENABLE_CHECKS
10998 return static_cast<
Boolean*>(value);
11003 #ifdef V8_ENABLE_CHECKS
11006 return static_cast<
Name*>(value);
11011 #ifdef V8_ENABLE_CHECKS
11014 return static_cast<
Symbol*>(value);
11019 #ifdef V8_ENABLE_CHECKS
11022 return reinterpret_cast<
Private*>(data);
11027 #ifdef V8_ENABLE_CHECKS
11030 return static_cast<
Number*>(value);
11035 #ifdef V8_ENABLE_CHECKS
11038 return static_cast<
Integer*>(value);
11043 #ifdef V8_ENABLE_CHECKS
11046 return static_cast<
Int32*>(value);
11051 #ifdef V8_ENABLE_CHECKS
11054 return static_cast<
Uint32*>(value);
11058 #ifdef V8_ENABLE_CHECKS
11061 return static_cast<
BigInt*>(value);
11065 #ifdef V8_ENABLE_CHECKS
11068 return static_cast<
Date*>(value);
11073 #ifdef V8_ENABLE_CHECKS
11081 #ifdef V8_ENABLE_CHECKS
11089 #ifdef V8_ENABLE_CHECKS
11096 #ifdef V8_ENABLE_CHECKS
11103 #ifdef V8_ENABLE_CHECKS
11111 #ifdef V8_ENABLE_CHECKS
11114 return static_cast<
RegExp*>(value);
11119 #ifdef V8_ENABLE_CHECKS
11122 return static_cast<
Object*>(value);
11127 #ifdef V8_ENABLE_CHECKS
11130 return static_cast<
Array*>(value);
11135 #ifdef V8_ENABLE_CHECKS
11138 return static_cast<
Map*>(value);
11143 #ifdef V8_ENABLE_CHECKS
11146 return static_cast<
Set*>(value);
11151 #ifdef V8_ENABLE_CHECKS
11154 return static_cast<
Promise*>(value);
11159 #ifdef V8_ENABLE_CHECKS
11162 return static_cast<
Proxy*>(value);
11166 #ifdef V8_ENABLE_CHECKS
11173 #ifdef V8_ENABLE_CHECKS
11181 #ifdef V8_ENABLE_CHECKS
11189 #ifdef V8_ENABLE_CHECKS
11197 #ifdef V8_ENABLE_CHECKS
11205 #ifdef V8_ENABLE_CHECKS
11213 #ifdef V8_ENABLE_CHECKS
11221 #ifdef V8_ENABLE_CHECKS
11229 #ifdef V8_ENABLE_CHECKS
11237 #ifdef V8_ENABLE_CHECKS
11245 #ifdef V8_ENABLE_CHECKS
11253 #ifdef V8_ENABLE_CHECKS
11261 #ifdef V8_ENABLE_CHECKS
11268 #ifdef V8_ENABLE_CHECKS
11275 #ifdef V8_ENABLE_CHECKS
11282 #ifdef V8_ENABLE_CHECKS
11290 #ifdef V8_ENABLE_CHECKS
11293 return static_cast<
DataView*>(value);
11298 #ifdef V8_ENABLE_CHECKS
11306 #ifdef V8_ENABLE_CHECKS
11309 return static_cast<
Function*>(value);
11314 #ifdef V8_ENABLE_CHECKS
11317 return static_cast<
External*>(value);
11321 template<
typename T>
11327 template<
typename T>
11333 template<
typename T>
11339 template<
typename T>
11345 template<
typename T>
11350 template <
typename T>
11416 T* data =
reinterpret_cast<T*>(GetDataFromSnapshotOnce(index));
11417 if (data)
internal::PerformCastCheck(data);
11418 return Local<T>(data);
11422 int64_t change_in_bytes) {
11424 constexpr int64_t kMemoryReducerActivationLimit = 32 * 1024 * 1024;
11425 int64_t* external_memory =
reinterpret_cast<int64_t*>(
11427 int64_t* external_memory_limit =
reinterpret_cast<int64_t*>(
11429 int64_t* external_memory_at_last_mc =
11430 reinterpret_cast<int64_t*>(
reinterpret_cast<uint8_t*>(
this) +
11435 const int64_t amount =
11436 static_cast<int64_t>(
static_cast<uint64_t>(change_in_bytes) +
11437 static_cast<uint64_t>(*external_memory));
11438 *external_memory = amount;
11440 int64_t allocation_diff_since_last_mc =
11441 static_cast<int64_t>(
static_cast<uint64_t>(*external_memory) -
11442 static_cast<uint64_t>(*external_memory_at_last_mc));
11445 if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
11446 CheckMemoryPressure();
11449 if (change_in_bytes < 0) {
11450 const int64_t lower_limit =
11451 static_cast<int64_t>(
static_cast<uint64_t>(*external_memory_limit) +
11452 static_cast<uint64_t>(change_in_bytes));
11454 *external_memory_limit = lower_limit;
11456 }
else if (change_in_bytes > 0 && amount > *external_memory_limit) {
11457 ReportExternalAllocationLimitReached();
11459 return *external_memory;
11463 #ifndef V8_ENABLE_CHECKS
11466 A ctx = *
reinterpret_cast<
const A*>(
this);
11472 #ifdef V8_COMPRESS_POINTERS
11476 I::DecompressTaggedAnyField(embedder_data,
static_cast<int32_t>(value));
11479 *
reinterpret_cast<A*>(
this)
);
11483 return SlowGetEmbedderData(index);
11489 #ifndef V8_ENABLE_CHECKS
11492 A ctx = *
reinterpret_cast<
const A*>(
this);
11499 return SlowGetAlignedPointerFromEmbedderData(index);
11505 T* data =
reinterpret_cast<T*>(GetDataFromSnapshotOnce(index));
11506 if (data)
internal::PerformCastCheck(data);
11507 return Local<T>(data);
11512 T* object_ptr = *object;
11514 return AddData(context, *p);
11519 T* object_ptr = *object;
11521 return AddData(*p);