38 #ifdef BUILDING_V8_SHARED
39 # define V8_EXPORT __declspec(dllexport)
41 # define V8_EXPORT __declspec(dllimport)
49 #if V8_HAS_ATTRIBUTE_VISIBILITY
50 # ifdef BUILDING_V8_SHARED
51 # define V8_EXPORT __attribute__ ((visibility("default")))
81 class ImplementationUtilities;
91 class ObjectOperationDescriptor;
98 class RawOperationDescriptor;
115 template <
class T>
class Local;
118 template <
class T>
class Eternal;
119 template<
class T>
class NonCopyablePersistentTraits;
121 template <
class T,
class M = NonCopyablePersistentTraits<T> >
126 template <
class K,
class V,
class T>
128 template <
class K,
class V,
class T>
131 template<
class T,
class P>
class WeakCallbackObject;
139 class CallHandlerHelper;
145 class DeferredHandles;
150 struct ScriptStreamingData;
152 class PropertyCallbackArguments;
153 class FunctionCallbackArguments;
157 class StreamingDecoder;
179 template <size_t ptr_size>
182 template <
int kSmiShiftSize>
185 uintptr_t tagged_value =
186 (
static_cast<uintptr_t>(value) << smi_shift_bits) |
kSmiTag;
187 return reinterpret_cast<
internal::Object*>(tagged_value);
192 struct SmiTagging<4> {
199 return static_cast<
int>(
reinterpret_cast<intptr_t>(value)) >> shift_bits;
216 return static_cast<uintptr_t>(value) + 0x40000000U < 0x80000000U;
222 struct SmiTagging<8> {
229 return static_cast<
int>(
reinterpret_cast<intptr_t>(value) >> shift_bits);
236 return (value ==
static_cast<int32_t>(value));
251 class ConsoleCallArguments;
256 #define TYPE_CHECK(T, S)
258 *(static_cast<T* volatile*>(0
)) = static_cast<S*>(0
);
298 : val_(
reinterpret_cast<T*>(*that)) {
331 if (a == 0)
return b == 0;
332 if (b == 0)
return false;
340 if (a == 0)
return b == 0;
341 if (b == 0)
return false;
353 return !operator==(that);
358 return !operator==(that);
367 #ifdef V8_ENABLE_CHECKS
370 if (that.IsEmpty())
return Local<T>();
372 return Local<T>(T::Cast(*that));
382 return Local<S>::Cast(*
this);
399 template<
class F>
friend class Local;
416 template <
class F1,
class F2,
class F3>
422 explicit V8_INLINE Local(T* that) : val_(that) {}
428 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
451 : val_(
reinterpret_cast<T*>(*that)) {
463 out->val_ =
IsEmpty() ?
nullptr :
this->val_;
495 Set(isolate, handle);
507 static const int kInternalFieldsInWeakCallback = 2;
508 static const int kEmbedderFieldsInWeakCallback = 2;
510 template <
typename T>
516 void* embedder_fields[kEmbedderFieldsInWeakCallback],
518 : isolate_(isolate), parameter_(parameter), callback_(callback) {
519 for (
int i = 0; i < kEmbedderFieldsInWeakCallback; ++i) {
520 embedder_fields_[i] = embedder_fields[i];
540 void* embedder_fields_[kEmbedderFieldsInWeakCallback];
589 return Local<T>::New(isolate, *
this);
596 if (a == NULL)
return b == NULL;
597 if (b == NULL)
return false;
605 if (a == NULL)
return b == NULL;
606 if (b == NULL)
return false;
612 return !operator==(that);
617 return !operator==(that);
627 template <
typename P>
669 "Objects are always considered independent. "
670 "Use MarkActive to avoid collecting otherwise dead weak handles.",
709 template<
class F>
friend class Local;
715 template <
class F1,
class F2,
class F3>
720 explicit V8_INLINE PersistentBase(T* val) : val_(val) {}
734 class NonCopyablePersistentTraits {
738 template<
class S,
class M>
758 template<
class S,
class M>
795 template <
class S,
class M2>
809 template <
class S,
class M2>
817 template <
class S,
class M2>
828 if (M::kResetInDestructor)
this->Reset();
834 #ifdef V8_ENABLE_CHECKS
837 if (!that.IsEmpty()) T::Cast(*that);
851 template<
class F>
friend class Local;
856 V8_INLINE T* operator*()
const {
return this->val_; }
857 template<
class S,
class M2>
898 other.val_ =
nullptr;
909 this->val_ = rhs.val_;
930 V8_INLINE T* operator*()
const {
return this->val_; }
965 return reinterpret_cast<
Isolate*>(isolate_);
982 void* operator
new(size_t size);
983 void* operator
new[](size_t size);
984 void operator
delete(
void*, size_t);
985 void operator
delete[](
void*, size_t);
996 template<
class F>
friend class Local;
1021 Escape(
reinterpret_cast<
internal::Object**>(*value));
1022 return Local<T>(
reinterpret_cast<T*>(slot));
1031 void* operator
new(size_t size);
1032 void* operator
new[](size_t size);
1033 void operator
delete(
void*, size_t);
1034 void operator
delete[](
void*, size_t);
1056 void* operator
new(size_t size);
1057 void* operator
new[](size_t size);
1058 void operator
delete(
void*, size_t);
1059 void operator
delete[](
void*, size_t);
1063 int prev_sealed_level_;
1121 bool is_opaque =
false,
bool is_wasm =
false,
1122 bool is_module =
false)
1123 : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
1124 (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) |
1125 (is_module ? kIsModule : 0)) {}
1128 (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {}
1131 return (flags_ & kIsSharedCrossOrigin) != 0;
1133 bool IsOpaque()
const {
return (flags_ & kIsOpaque) != 0; }
1134 bool IsWasm()
const {
return (flags_ & kIsWasm) != 0; }
1135 bool IsModule()
const {
return (flags_ & kIsModule) != 0; }
1141 kIsSharedCrossOrigin = 1,
1231 : line_number_(line_number), column_number_(column_number) {}
1522 internal::ScriptStreamingData* impl_;
1671 size_t context_extension_count,
1675 Local<
String> arguments[], size_t context_extension_count,
1708 static CachedData* CreateCodeCacheForFunction(
2032 size_t* actual_size);
2083 void TransferSharedArrayBuffer(
2084 uint32_t transfer_id,
2111 PrivateData* private_;
2140 Isolate* isolate, uint32_t transfer_id);
2147 Isolate* isolate, uint32_t clone_id);
2217 PrivateData* private_;
2581 V8_INLINE bool QuickIsUndefined()
const;
2583 V8_INLINE bool QuickIsNullOrUndefined()
const;
2585 bool FullIsUndefined()
const;
2586 bool FullIsNull()
const;
2587 bool FullIsString()
const;
2608 static void CheckCast(
v8::
Value* obj);
2629 static void CheckCast(
Value* obj);
2741 int* nchars_ref = NULL,
2803 virtual const uint16_t*
data()
const = 0;
2833 virtual const char*
data()
const = 0;
2870 "Use maybe version",
2889 "Use maybe version",
2937 "Use maybe version",
3013 static void CheckCast(
v8::
Value* obj);
3064 static void CheckCast(
Value* obj);
3102 static void CheckCast(
Data* that);
3116 static void CheckCast(
v8::
Value* obj);
3131 static void CheckCast(
v8::
Value* obj);
3145 static void CheckCast(
v8::
Value* obj);
3159 static void CheckCast(
v8::
Value* obj);
3172 static void CheckCast(
v8::
Value* obj);
3286 bool Set(uint32_t index,
Local<
Value> value));
3568 bool HasRealIndexedProperty(uint32_t index));
3572 bool HasRealNamedCallbackProperty(
Local<
String> key));
3692 static void CheckCast(
Value* obj);
3693 Local<
Value> SlowGetInternalField(
int index);
3694 void* SlowGetAlignedPointerFromInternalField(
int index);
3714 static void CheckCast(
Value* obj);
3750 static void CheckCast(
Value* obj);
3782 static void CheckCast(
Value* obj);
3786 template<
typename T>
3790 : value_(that.value_) {
3794 template <
typename S>
3797 template <
typename S>
3799 template <
typename S>
3814 template <
typename S>
3826 template <
class F,
class G,
class H>
3841 template<
typename T>
3877 friend class debug::ConsoleCallArguments;
3886 internal::Object** values,
int length);
3897 template<
typename T>
3989 friend class MacroAssembler;
4024 "Use maybe version",
4103 static void CheckCast(
Value* obj);
4106 #ifndef V8_PROMISE_INTERNAL_FIELD_COUNT
4108 #define V8_PROMISE_INTERNAL_FIELD_COUNT 0
4153 static void CheckCast(
Value* obj);
4191 static void CheckCast(
Value* obj);
4264 PrivateData* private_;
4289 static void CheckCast(
Value* obj);
4306 class TransferrableModule
final {
4311 TransferrableModule&
operator=(TransferrableModule&& src) =
default;
4312 TransferrableModule&
operator=(
const TransferrableModule& src) =
delete;
4315 typedef std::pair<std::unique_ptr<
const uint8_t[]>, size_t> OwnedBuffer;
4317 TransferrableModule(OwnedBuffer&& code, OwnedBuffer&& bytes)
4318 : compiled_code(std::move(code)), wire_bytes(std::move(bytes)) {}
4320 OwnedBuffer compiled_code = {
nullptr, 0};
4321 OwnedBuffer wire_bytes = {
nullptr, 0};
4336 Isolate* isolate,
const TransferrableModule&);
4363 const uint8_t* start,
4366 const TransferrableModule::OwnedBuffer& buff) {
4367 return {buff.first.get(), buff.second};
4370 WasmCompiledModule();
4371 static void CheckCast(
Value* obj);
4395 WasmModuleObjectBuilderStreaming(
const WasmModuleObjectBuilderStreaming&) =
4397 WasmModuleObjectBuilderStreaming(WasmModuleObjectBuilderStreaming&&) =
4399 WasmModuleObjectBuilderStreaming& operator=(
4400 const WasmModuleObjectBuilderStreaming&) =
delete;
4401 WasmModuleObjectBuilderStreaming& operator=(
4402 WasmModuleObjectBuilderStreaming&&) =
default;
4413 Persistent<Promise, CopyablePersistentTraits<Promise>> promise_;
4417 std::shared_ptr<
internal::
wasm::StreamingDecoder> streaming_decoder_;
4420 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
4422 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
4469 virtual void Free(
void* data, size_t length) = 0;
4500 allocation_base_(
nullptr),
4501 allocation_length_(0),
4507 return allocation_mode_;
4510 void*
Data()
const {
return data_; }
4515 size_t byte_length_;
4516 void* allocation_base_;
4517 size_t allocation_length_;
4547 Isolate* isolate,
void* data, size_t byte_length,
4599 static void CheckCast(
Value* obj);
4603 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
4605 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
4654 static void CheckCast(
Value* obj);
4679 static void CheckCast(
Value* obj);
4689 size_t byte_offset, size_t length);
4691 size_t byte_offset, size_t length);
4696 static void CheckCast(
Value* obj);
4706 size_t byte_offset, size_t length);
4713 Uint8ClampedArray();
4714 static void CheckCast(
Value* obj);
4723 size_t byte_offset, size_t length);
4725 size_t byte_offset, size_t length);
4730 static void CheckCast(
Value* obj);
4740 size_t byte_offset, size_t length);
4742 size_t byte_offset, size_t length);
4747 static void CheckCast(
Value* obj);
4757 size_t byte_offset, size_t length);
4759 size_t byte_offset, size_t length);
4764 static void CheckCast(
Value* obj);
4774 size_t byte_offset, size_t length);
4776 size_t byte_offset, size_t length);
4781 static void CheckCast(
Value* obj);
4791 size_t byte_offset, size_t length);
4793 size_t byte_offset, size_t length);
4798 static void CheckCast(
Value* obj);
4808 size_t byte_offset, size_t length);
4810 size_t byte_offset, size_t length);
4815 static void CheckCast(
Value* obj);
4825 size_t byte_offset, size_t length);
4827 size_t byte_offset, size_t length);
4832 static void CheckCast(
Value* obj);
4841 size_t byte_offset, size_t length);
4843 size_t byte_offset, size_t length);
4848 static void CheckCast(
Value* obj);
4857 size_t byte_offset, size_t length);
4859 size_t byte_offset, size_t length);
4864 static void CheckCast(
Value* obj);
4873 size_t byte_offset, size_t length);
4875 size_t byte_offset, size_t length);
4880 static void CheckCast(
Value* obj);
4906 allocation_base_(
nullptr),
4907 allocation_length_(0),
4913 return allocation_mode_;
4916 void*
Data()
const {
return data_; }
4921 size_t byte_length_;
4922 void* allocation_base_;
4923 size_t allocation_length_;
4950 Isolate* isolate,
void* data, size_t byte_length,
4992 SharedArrayBuffer();
4993 static void CheckCast(
Value* obj);
5030 static void CheckCast(
Value* obj);
5046 static void CheckCast(
Value* obj);
5061 static void CheckCast(
Value* obj);
5076 static void CheckCast(
Value* obj);
5092 static void CheckCast(
Value* obj);
5108 static void CheckCast(
Value* obj);
5161 static void CheckCast(
Value* obj);
5175 static void CheckCast(
v8::
Value* obj);
5178 #define V8_INTRINSICS_LIST(F)
5179 F(ArrayProto_entries, array_entries_iterator)
5180 F(ArrayProto_forEach, array_for_each_iterator)
5181 F(ArrayProto_keys, array_keys_iterator)
5182 F(ArrayProto_values, array_values_iterator)
5183 F(ErrorPrototype, initial_error_prototype)
5184 F(IteratorPrototype, initial_iterator_prototype)
5187 #define V8_DECL_INTRINSIC(name, iname) k##name,
5189 #undef V8_DECL_INTRINSIC
5800 static void CheckCast(
Data* that);
6026 "Use SetHandler(const NamedPropertyHandlerConfiguration) "
6027 "with the kOnlyInterceptStrings flag set.",
6028 void SetNamedPropertyHandler(
6074 deleter
, enumerator
, data
));
6160 static void CheckCast(
Data* that);
6183 static void CheckCast(
Data* that);
6200 AccessorSignature();
6202 static void CheckCast(
Data* that);
6213 : data_(data), length_(length) {}
6214 const char*
data()
const {
return data_; }
6230 const char* source = 0,
6232 const char** deps = 0,
6233 int source_length = -1);
6240 const char*
name()
const {
return name_; }
6255 size_t source_length_;
6301 uint64_t virtual_memory_limit);
6305 size_t max_semi_space_size()) {
6306 return max_semi_space_size_in_kb_ / 1024;
6311 void set_max_semi_space_size(size_t limit_in_mb)) {
6312 max_semi_space_size_in_kb_ = limit_in_mb * 1024;
6317 return max_semi_space_size_in_kb_;
6322 max_semi_space_size_in_kb_ = limit_in_kb;
6327 max_old_space_size_ = limit_in_mb;
6330 size_t max_executable_size()
const) {
6331 return max_executable_size_;
6334 void set_max_executable_size(size_t limit_in_mb)) {
6335 max_executable_size_ = limit_in_mb;
6342 code_range_size_ = limit_in_mb;
6349 size_t max_semi_space_size_in_kb_;
6352 size_t max_old_space_size_;
6353 size_t max_executable_size_;
6354 uint32_t* stack_limit_;
6355 size_t code_range_size_;
6356 size_t max_zone_pool_size_;
6368 const char* message);
6488 : promise_(promise),
6491 stack_trace_(stack_trace) {}
6639 typedef size_t (*NearHeapLimitCallback)(
void* data, size_t current_heap_limit,
6640 size_t initial_heap_limit);
6669 size_t total_heap_size_;
6670 size_t total_heap_size_executable_;
6671 size_t total_physical_size_;
6672 size_t total_available_size_;
6673 size_t used_heap_size_;
6674 size_t heap_size_limit_;
6675 size_t malloced_memory_;
6676 size_t peak_malloced_memory_;
6677 bool does_zap_garbage_;
6678 size_t number_of_native_contexts_;
6679 size_t number_of_detached_contexts_;
6696 const char* space_name_;
6698 size_t space_used_size_;
6699 size_t space_available_size_;
6700 size_t physical_space_size_;
6715 const char* object_type_;
6716 const char* object_sub_type_;
6717 size_t object_count_;
6718 size_t object_size_;
6731 size_t code_and_metadata_size_;
6732 size_t bytecode_and_metadata_size_;
6733 size_t external_script_source_size_;
6753 uintptr_t return_addr_location);
6885 uint16_t class_id) {}
6927 const std::vector<std::pair<
void*,
void*> >& embedder_fields) = 0;
6985 void* data_arg =
nullptr)
7002 void* data_arg =
nullptr)
7163 void* internal_throws_;
7164 void* internal_assert_;
7492 size_t frames_limit,
SampleInfo* sample_info);
7550 "Calling context concept is not compatible with tail calls, and will be "
7629 void* data =
nullptr);
7632 typedef size_t (*GetExternallyAllocatedMemoryInBytesCallback)();
7641 GetExternallyAllocatedMemoryInBytesCallback callback);
7727 "Use callback with parameter",
7735 void RemoveCallCompletedCallback(
7771 void SetAutorunMicrotasks(
bool autorun));
8032 bool capture,
int frame_limit = 10,
8089 template <
class K,
class V,
class Traits>
8092 internal::Object** GetDataFromSnapshotOnce(size_t index);
8093 void ReportExternalAllocationLimitReached();
8094 void CheckMemoryPressure();
8123 typedef uintptr_t (*ReturnAddressLocationResolver)(
8124 uintptr_t return_addr_location);
8158 const char* embedded_source = NULL));
8170 StartupData cold_startup_blob,
const char* warmup_source));
8208 ReturnAddressLocationResolver return_address_resolver);
8243 const char* icu_data_file =
nullptr);
8263 const char* snapshot_blob);
8296 static bool TryHandleSignal(
int signal_number,
void* info,
void* context);
8304 static bool RegisterDefaultSignalHandler());
8320 static void DisposeGlobal(
internal::Object** global_handle);
8321 static void MakeWeak(
internal::Object** location,
void* data,
8324 static void MakeWeak(
internal::Object** location,
void* data,
8326 int internal_field_index1,
8328 int internal_field_index2,
8330 static void MakeWeak(
internal::Object*** location_addr);
8331 static void* ClearWeak(
internal::Object** location);
8332 static void AnnotateStrongRetainer(
internal::Object** location,
8336 static void RegisterExternallyReferencedObject(
internal::Object** object,
8339 template <
class K,
class V,
class T>
8342 static void FromJustIsNothing();
8343 static void ToLocalEmpty();
8344 static void InternalFieldOutOfBounds(
int index);
8374 const intptr_t* external_references =
nullptr,
8458 size_t AddData(
internal::Object* object);
8507 return has_value_ ? value_ : default_value;
8511 return (
IsJust() == other.IsJust()) &&
8520 Maybe() : has_value_(
false) {}
8521 explicit Maybe(
const T& t) : has_value_(
true), value_(t) {}
8560 Maybe() : is_valid_(
false) {}
8561 explicit Maybe(JustTag) : is_valid_(
true) {}
8698 if (handler == NULL)
return NULL;
8699 return handler->js_stack_comparable_address_;
8708 void* operator
new(size_t size);
8709 void* operator
new[](size_t size);
8710 void operator
delete(
void*, size_t);
8711 void operator
delete[](
void*, size_t);
8713 void ResetInternal();
8719 void* js_stack_comparable_address_;
8720 bool is_verbose_ : 1;
8721 bool can_continue_ : 1;
8722 bool capture_message_ : 1;
8724 bool has_terminated_ : 1;
8740 : name_count_(name_count), names_(names) { }
8742 const char**
begin()
const {
return &names_[0]; }
8743 const char**
end()
const {
return &names_[name_count_]; }
8746 const int name_count_;
8747 const char** names_;
8821 Isolate* isolate, size_t context_snapshot_index,
9002 internal::Object** GetDataFromSnapshotOnce(size_t index);
9004 void* SlowGetAlignedPointerFromEmbedderData(
int index);
9093 void Initialize(
Isolate* isolate);
9124 void Initialize(
Isolate* isolate);
9199 #ifdef V8_ENABLE_CHECKS
9200 CheckInitializedImpl(isolate);
9239 return *addr &
static_cast<uint8_t>(1U << shift);
9243 bool value,
int shift) {
9245 uint8_t mask =
static_cast<uint8_t>(1U << shift);
9246 *addr =
static_cast<uint8_t>((*addr & ~mask) | (value << shift));
9263 uint8_t* addr =
reinterpret_cast<uint8_t*>(isolate) +
9265 *
reinterpret_cast<
void**>(addr) = data;
9270 const uint8_t* addr =
reinterpret_cast<
const uint8_t*>(isolate) +
9272 return *
reinterpret_cast<
void*
const*>(addr);
9281 template <
typename T>
9283 const uint8_t* addr =
9285 return *
reinterpret_cast<
const T*>(addr);
9288 template <
typename T>
9292 O* ctx = *
reinterpret_cast<O*
const*>(context);
9298 return I::ReadField<T>(embedder_data, value_offset);
9304 template <
bool PerformCheck>
9330 return New(isolate, that.val_);
9335 return New(isolate, that.val_);
9341 if (that == NULL)
return Local<T>();
9345 reinterpret_cast<
internal::Isolate*>(isolate)
, *p
)));
9353 val_ =
reinterpret_cast<T*>(
9354 V8::Eternalize(isolate,
reinterpret_cast<
Value*>(*handle)));
9361 return Local<T>(val_);
9368 return Local<T>(val_);
9374 #ifdef V8_ENABLE_CHECKS
9375 if (index < 0 || index >= kEmbedderFieldsInWeakCallback) {
9376 V8::InternalFieldOutOfBounds(index);
9379 return embedder_fields_[index];
9385 if (that == NULL)
return NULL;
9387 return reinterpret_cast<T*>(
9388 V8::GlobalizeReference(
reinterpret_cast<
internal::Isolate*>(isolate),
9393 template <
class T,
class M>
9394 template <
class S,
class M2>
9398 if (that.IsEmpty())
return;
9400 this->val_ =
reinterpret_cast<T*>(
V8::CopyPersistent(p));
9401 M::Copy(that,
this);
9412 if (
this->IsEmpty())
return false;
9413 uint8_t node_state =
9423 if (
this->IsEmpty())
return false;
9431 if (
this->IsEmpty())
return;
9432 V8::DisposeGlobal(
reinterpret_cast<
internal::Object**>(
this->val_));
9442 if (other.IsEmpty())
return;
9443 this->val_ = New(isolate, other.val_);
9453 if (other.IsEmpty())
return;
9454 this->val_ = New(isolate, other.val_);
9459 template <
typename P>
9464 V8::MakeWeak(
reinterpret_cast<
internal::Object**>(
this->val_), parameter,
9465 reinterpret_cast<Callback>(callback), type);
9470 V8::MakeWeak(
reinterpret_cast<
internal::Object***>(&
this->val_));
9474 template <
typename P>
9476 return reinterpret_cast<P*>(
9477 V8::ClearWeak(
reinterpret_cast<
internal::Object**>(
this->val_)));
9482 V8::AnnotateStrongRetainer(
reinterpret_cast<
internal::Object**>(
this->val_),
9489 V8::RegisterExternallyReferencedObject(
9490 reinterpret_cast<
internal::Object**>(
this->val_),
9491 reinterpret_cast<
internal::Isolate*>(isolate));
9500 if (
this->IsEmpty())
return;
9509 if (
this->IsEmpty())
return;
9512 *
reinterpret_cast<uint16_t*>(addr) = class_id;
9519 if (
this->IsEmpty())
return 0;
9522 return *
reinterpret_cast<uint16_t*>(addr);
9526 template<
typename T>
9529 template<
typename T>
9530 template<
typename S>
9534 *value_ = GetDefaultValue();
9536 *value_ = *
reinterpret_cast<
internal::Object**>(*handle);
9540 template <
typename T>
9541 template <
typename S>
9545 *value_ = GetDefaultValue();
9547 *value_ = *
reinterpret_cast<
internal::Object**>(*handle);
9551 template <
typename T>
9552 template <
typename S>
9556 *value_ = GetDefaultValue();
9558 *value_ = *
reinterpret_cast<
internal::Object**>(*handle);
9562 template<
typename T>
9568 template<
typename T>
9579 template<
typename T>
9583 bool fits_into_int32_t = (i & (1U << 31)) == 0;
9585 Set(
static_cast<int32_t>(i));
9591 template<
typename T>
9604 template<
typename T>
9611 template<
typename T>
9618 template<
typename T>
9625 template <
typename T>
9628 return *
reinterpret_cast<
Isolate**>(&value_[-2]);
9631 template <
typename T>
9639 template <
typename T>
9640 template <
typename S>
9646 template<
typename T>
9652 template <
typename T>
9658 template<
typename T>
9665 template<
typename T>
9671 template<
typename T>
9677 template <
typename T>
9683 template <
typename T>
9689 template<
typename T>
9695 template<
typename T>
9701 template<
typename T>
9707 template<
typename T>
9721 : resource_name_(resource_name),
9722 resource_line_offset_(resource_line_offset),
9723 resource_column_offset_(resource_column_offset),
9724 options_
(!resource_is_shared_cross_origin
.IsEmpty() &&
9729 script_id_(script_id),
9730 source_map_url_(source_map_url),
9731 host_defined_options_(host_defined_options) {}
9736 return host_defined_options_;
9740 return resource_line_offset_;
9745 return resource_column_offset_;
9756 : source_string(string),
9763 cached_data(data) {}
9767 : source_string(string), cached_data(data) {}
9781 return resource_options;
9795 #ifdef V8_ENABLE_CHECKS
9802 #ifdef V8_ENABLE_CHECKS
9809 #ifdef V8_ENABLE_CHECKS
9812 return reinterpret_cast<
Signature*>(data);
9816 #ifdef V8_ENABLE_CHECKS
9823 #ifndef V8_ENABLE_CHECKS
9827 O* obj = *
reinterpret_cast<O**>(
this);
9836 O** result =
HandleScope::CreateHandle(
reinterpret_cast<HO*>(obj), value);
9840 return SlowGetInternalField(index);
9845 #ifndef V8_ENABLE_CHECKS
9848 O* obj = *
reinterpret_cast<O**>(
this);
9859 return SlowGetAlignedPointerFromInternalField(index);
9863 #ifdef V8_ENABLE_CHECKS
9866 return static_cast<
String*>(value);
9882 O* obj = *
reinterpret_cast<O*
const*>(
this);
9890 #ifdef V8_ENABLE_CHECKS
9891 VerifyExternalStringResource(result);
9901 O* obj = *
reinterpret_cast<O*
const*>(
this);
9910 #ifdef V8_ENABLE_CHECKS
9911 VerifyExternalStringResourceBase(resource, *encoding_out);
9918 #ifdef V8_ENABLE_CHECKS
9919 return FullIsUndefined();
9921 return QuickIsUndefined();
9925 bool Value::QuickIsUndefined()
const {
9928 O* obj = *
reinterpret_cast<O*
const*>(
this);
9936 #ifdef V8_ENABLE_CHECKS
9937 return FullIsNull();
9939 return QuickIsNull();
9943 bool Value::QuickIsNull()
const {
9946 O* obj = *
reinterpret_cast<O*
const*>(
this);
9953 #ifdef V8_ENABLE_CHECKS
9954 return FullIsNull() || FullIsUndefined();
9956 return QuickIsNullOrUndefined();
9960 bool Value::QuickIsNullOrUndefined()
const {
9963 O* obj = *
reinterpret_cast<O*
const*>(
this);
9971 #ifdef V8_ENABLE_CHECKS
9972 return FullIsString();
9974 return QuickIsString();
9978 bool Value::QuickIsString()
const {
9981 O* obj = *
reinterpret_cast<O*
const*>(
this);
9988 return static_cast<
Value*>(value);
10017 #ifdef V8_ENABLE_CHECKS
10020 return static_cast<
Boolean*>(value);
10025 #ifdef V8_ENABLE_CHECKS
10028 return static_cast<
Name*>(value);
10033 #ifdef V8_ENABLE_CHECKS
10036 return static_cast<
Symbol*>(value);
10041 #ifdef V8_ENABLE_CHECKS
10044 return reinterpret_cast<
Private*>(data);
10049 #ifdef V8_ENABLE_CHECKS
10052 return static_cast<
Number*>(value);
10057 #ifdef V8_ENABLE_CHECKS
10060 return static_cast<
Integer*>(value);
10065 #ifdef V8_ENABLE_CHECKS
10068 return static_cast<
Int32*>(value);
10073 #ifdef V8_ENABLE_CHECKS
10076 return static_cast<
Uint32*>(value);
10080 #ifdef V8_ENABLE_CHECKS
10083 return static_cast<
BigInt*>(value);
10087 #ifdef V8_ENABLE_CHECKS
10090 return static_cast<
Date*>(value);
10095 #ifdef V8_ENABLE_CHECKS
10103 #ifdef V8_ENABLE_CHECKS
10111 #ifdef V8_ENABLE_CHECKS
10118 #ifdef V8_ENABLE_CHECKS
10125 #ifdef V8_ENABLE_CHECKS
10133 #ifdef V8_ENABLE_CHECKS
10136 return static_cast<
RegExp*>(value);
10141 #ifdef V8_ENABLE_CHECKS
10144 return static_cast<
Object*>(value);
10149 #ifdef V8_ENABLE_CHECKS
10152 return static_cast<
Array*>(value);
10157 #ifdef V8_ENABLE_CHECKS
10160 return static_cast<
Map*>(value);
10165 #ifdef V8_ENABLE_CHECKS
10168 return static_cast<
Set*>(value);
10173 #ifdef V8_ENABLE_CHECKS
10176 return static_cast<
Promise*>(value);
10181 #ifdef V8_ENABLE_CHECKS
10184 return static_cast<
Proxy*>(value);
10188 #ifdef V8_ENABLE_CHECKS
10195 #ifdef V8_ENABLE_CHECKS
10203 #ifdef V8_ENABLE_CHECKS
10211 #ifdef V8_ENABLE_CHECKS
10219 #ifdef V8_ENABLE_CHECKS
10227 #ifdef V8_ENABLE_CHECKS
10235 #ifdef V8_ENABLE_CHECKS
10243 #ifdef V8_ENABLE_CHECKS
10251 #ifdef V8_ENABLE_CHECKS
10259 #ifdef V8_ENABLE_CHECKS
10267 #ifdef V8_ENABLE_CHECKS
10275 #ifdef V8_ENABLE_CHECKS
10283 #ifdef V8_ENABLE_CHECKS
10290 #ifdef V8_ENABLE_CHECKS
10297 #ifdef V8_ENABLE_CHECKS
10304 #ifdef V8_ENABLE_CHECKS
10312 #ifdef V8_ENABLE_CHECKS
10315 return static_cast<
DataView*>(value);
10320 #ifdef V8_ENABLE_CHECKS
10328 #ifdef V8_ENABLE_CHECKS
10331 return static_cast<
Function*>(value);
10336 #ifdef V8_ENABLE_CHECKS
10339 return static_cast<
External*>(value);
10343 template<
typename T>
10349 template<
typename T>
10355 template<
typename T>
10361 template<
typename T>
10367 template<
typename T>
10372 template <
typename T>
10434 T* data =
reinterpret_cast<T*>(GetDataFromSnapshotOnce(index));
10435 if (data)
internal::PerformCastCheck(data);
10436 return Local<T>(data);
10440 int64_t change_in_bytes) {
10442 const int64_t kMemoryReducerActivationLimit = 32 * 1024 * 1024;
10443 int64_t* external_memory =
reinterpret_cast<int64_t*>(
10445 int64_t* external_memory_limit =
reinterpret_cast<int64_t*>(
10447 int64_t* external_memory_at_last_mc =
10448 reinterpret_cast<int64_t*>(
reinterpret_cast<uint8_t*>(
this) +
10450 const int64_t amount = *external_memory + change_in_bytes;
10452 *external_memory = amount;
10454 int64_t allocation_diff_since_last_mc =
10455 *external_memory_at_last_mc - *external_memory;
10456 allocation_diff_since_last_mc = allocation_diff_since_last_mc < 0
10457 ? -allocation_diff_since_last_mc
10458 : allocation_diff_since_last_mc;
10459 if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
10460 CheckMemoryPressure();
10463 if (change_in_bytes < 0) {
10464 *external_memory_limit += change_in_bytes;
10467 if (change_in_bytes > 0 && amount > *external_memory_limit) {
10468 ReportExternalAllocationLimitReached();
10470 return *external_memory;
10474 #ifndef V8_ENABLE_CHECKS
10478 HO* context = *
reinterpret_cast<HO**>(
this);
10483 return SlowGetEmbedderData(index);
10489 #ifndef V8_ENABLE_CHECKS
10493 return SlowGetAlignedPointerFromEmbedderData(index);
10499 T* data =
reinterpret_cast<T*>(GetDataFromSnapshotOnce(index));
10500 if (data)
internal::PerformCastCheck(data);
10501 return Local<T>(data);
10506 T* object_ptr = *object;
10508 return AddData(context, *p);
10513 T* object_ptr = *object;
10515 return AddData(*p);