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")))
79 class ImplementationUtilities;
89 class ObjectOperationDescriptor;
96 class RawOperationDescriptor;
112 template <
class T>
class Local;
115 template <
class T>
class Eternal;
116 template<
class T>
class NonCopyablePersistentTraits;
118 template <
class T,
class M = NonCopyablePersistentTraits<T> >
123 template <
class K,
class V,
class T>
125 template <
class K,
class V,
class T>
128 template<
class T,
class P>
class WeakCallbackObject;
136 class CallHandlerHelper;
142 class DeferredHandles;
147 struct StreamedSource;
149 class PropertyCallbackArguments;
150 class FunctionCallbackArguments;
155 class ConsoleCallArguments;
160 #define TYPE_CHECK(T, S)
162 *(static_cast<T* volatile*>(0
)) = static_cast<S*>(0
);
202 : val_(
reinterpret_cast<T*>(*that)) {
235 if (a == 0)
return b == 0;
236 if (b == 0)
return false;
244 if (a == 0)
return b == 0;
245 if (b == 0)
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);
303 template<
class F>
friend class Local;
319 template <
class F1,
class F2,
class F3>
325 explicit V8_INLINE Local(T* that) : val_(that) {}
331 #if !defined(V8_IMMINENT_DEPRECATION_WARNINGS)
354 : val_(
reinterpret_cast<T*>(*that)) {
366 out->val_ =
IsEmpty() ?
nullptr :
this->val_;
398 Set(isolate, handle);
410 static const int kInternalFieldsInWeakCallback = 2;
411 static const int kEmbedderFieldsInWeakCallback = 2;
413 template <
typename T>
419 void* embedder_fields[kEmbedderFieldsInWeakCallback],
421 : isolate_(isolate), parameter_(parameter), callback_(callback) {
422 for (
int i = 0; i < kEmbedderFieldsInWeakCallback; ++i) {
423 embedder_fields_[i] = embedder_fields[i];
432 void* GetInternalField1()
const) {
433 return embedder_fields_[0];
436 void* GetInternalField2()
const) {
437 return embedder_fields_[1];
441 bool IsFirstPass()
const) {
442 return callback_ !=
nullptr;
457 void* embedder_fields_[kEmbedderFieldsInWeakCallback];
506 return Local<T>::New(isolate, *
this);
513 if (a == NULL)
return b == NULL;
514 if (b == NULL)
return false;
522 if (a == NULL)
return b == NULL;
523 if (b == NULL)
return false;
529 return !operator==(that);
534 return !operator==(that);
544 template <
typename P>
612 template<
class F>
friend class Local;
618 template <
class F1,
class F2,
class F3>
623 explicit V8_INLINE PersistentBase(T* val) : val_(val) {}
637 class NonCopyablePersistentTraits {
641 template<
class S,
class M>
661 template<
class S,
class M>
698 template <
class S,
class M2>
712 template <
class S,
class M2>
720 template <
class S,
class M2>
731 if (M::kResetInDestructor)
this->Reset();
737 #ifdef V8_ENABLE_CHECKS
740 if (!that.IsEmpty()) T::Cast(*that);
754 template<
class F>
friend class Local;
759 V8_INLINE T* operator*()
const {
return this->val_; }
760 template<
class S,
class M2>
801 other.val_ =
nullptr;
812 this->val_ = rhs.val_;
833 V8_INLINE T* operator*()
const {
return this->val_; }
868 return reinterpret_cast<
Isolate*>(isolate_);
885 void* operator
new(size_t size);
886 void* operator
new[](size_t size);
887 void operator
delete(
void*, size_t);
888 void operator
delete[](
void*, size_t);
899 template<
class F>
friend class Local;
924 Escape(
reinterpret_cast<
internal::Object**>(*value));
925 return Local<T>(
reinterpret_cast<T*>(slot));
934 void* operator
new(size_t size);
935 void* operator
new[](size_t size);
936 void operator
delete(
void*, size_t);
937 void operator
delete[](
void*, size_t);
959 void* operator
new(size_t size);
960 void* operator
new[](size_t size);
961 void operator
delete(
void*, size_t);
962 void operator
delete[](
void*, size_t);
966 int prev_sealed_level_;
988 bool is_opaque =
false,
bool is_wasm =
false,
989 bool is_module =
false)
990 : flags_((is_shared_cross_origin ? kIsSharedCrossOrigin : 0) |
991 (is_wasm ? kIsWasm : 0) | (is_opaque ? kIsOpaque : 0) |
992 (is_module ? kIsModule : 0)) {}
995 (kIsSharedCrossOrigin | kIsOpaque | kIsWasm | kIsModule)) {}
998 return (flags_ & kIsSharedCrossOrigin) != 0;
1000 bool IsOpaque()
const {
return (flags_ & kIsOpaque) != 0; }
1001 bool IsWasm()
const {
return (flags_ & kIsWasm) != 0; }
1002 bool IsModule()
const {
return (flags_ & kIsModule) != 0; }
1008 kIsSharedCrossOrigin = 1,
1088 : line_number_(line_number), column_number_(column_number) {}
1189 "Use maybe version",
1419 "Use maybe version",
1505 size_t context_extension_count,
1509 Local<
String> arguments[], size_t context_extension_count,
1837 size_t* actual_size);
1886 void TransferSharedArrayBuffer(
1887 uint32_t transfer_id,
1914 PrivateData* private_;
1943 Isolate* isolate, uint32_t transfer_id);
2013 PrivateData* private_;
2374 V8_INLINE bool QuickIsUndefined()
const;
2376 V8_INLINE bool QuickIsNullOrUndefined()
const;
2378 bool FullIsUndefined()
const;
2379 bool FullIsNull()
const;
2380 bool FullIsString()
const;
2401 static void CheckCast(
v8::
Value* obj);
2422 static void CheckCast(
Value* obj);
2451 sizeof(
void*) == 4 ? (1 << 28) - 16 : (1 << 30) - 1 - 24;
2533 int* nchars_ref = NULL,
2595 virtual const uint16_t*
data()
const = 0;
2625 virtual const char*
data()
const = 0;
2662 "Use maybe version",
2675 "Use maybe version",
2688 "Use maybe version",
2739 "Use maybe version",
2816 static void CheckCast(
v8::
Value* obj);
2867 static void CheckCast(
Value* obj);
2915 static void CheckCast(
v8::
Value* obj);
2930 static void CheckCast(
v8::
Value* obj);
2944 static void CheckCast(
v8::
Value* obj);
2958 static void CheckCast(
v8::
Value* obj);
3057 bool Set(uint32_t index,
Local<
Value> value));
3359 bool HasRealIndexedProperty(uint32_t index));
3363 bool HasRealNamedCallbackProperty(
Local<
String> key));
3372 "Use maybe version",
3383 "Use maybe version",
3489 static void CheckCast(
Value* obj);
3490 Local<
Value> SlowGetInternalField(
int index);
3491 void* SlowGetAlignedPointerFromInternalField(
int index);
3521 static void CheckCast(
Value* obj);
3557 static void CheckCast(
Value* obj);
3589 static void CheckCast(
Value* obj);
3593 template<
typename T>
3597 : value_(that.value_) {
3601 template <
typename S>
3604 template <
typename S>
3606 template <
typename S>
3621 template <
typename S>
3633 template <
class F,
class G,
class H>
3648 template<
typename T>
3686 friend class debug::ConsoleCallArguments;
3697 internal::Object** values,
int length);
3708 template<
typename T>
3800 friend class MacroAssembler;
3834 "Use maybe version",
3912 static void CheckCast(
Value* obj);
3915 #ifndef V8_PROMISE_INTERNAL_FIELD_COUNT
3917 #define V8_PROMISE_INTERNAL_FIELD_COUNT 0
3962 static void CheckCast(
Value* obj);
4004 static void CheckCast(
Value* obj);
4077 PrivateData* private_;
4102 static void CheckCast(
Value* obj);
4115 class TransferrableModule
final {
4120 TransferrableModule&
operator=(TransferrableModule&& src) =
default;
4121 TransferrableModule&
operator=(
const TransferrableModule& src) =
delete;
4124 typedef std::pair<std::unique_ptr<
const uint8_t[]>, size_t> OwnedBuffer;
4126 TransferrableModule(OwnedBuffer&& code, OwnedBuffer&& bytes)
4127 : compiled_code(std::move(code)), wire_bytes(std::move(bytes)) {}
4129 OwnedBuffer compiled_code = {
nullptr, 0};
4130 OwnedBuffer wire_bytes = {
nullptr, 0};
4141 Isolate* isolate,
const TransferrableModule&);
4160 friend class WasmModuleObjectBuilder;
4166 const uint8_t* start,
4169 const TransferrableModule::OwnedBuffer& buff) {
4170 return {buff.first.get(), buff.second};
4173 WasmCompiledModule();
4174 static void CheckCast(
Value* obj);
4191 typedef std::pair<std::unique_ptr<
const uint8_t[]>, size_t> Buffer;
4193 WasmModuleObjectBuilderStreaming(
const WasmModuleObjectBuilderStreaming&) =
4195 WasmModuleObjectBuilderStreaming(WasmModuleObjectBuilderStreaming&&) =
4197 WasmModuleObjectBuilderStreaming& operator=(
4198 const WasmModuleObjectBuilderStreaming&) =
delete;
4199 WasmModuleObjectBuilderStreaming& operator=(
4200 WasmModuleObjectBuilderStreaming&&) =
default;
4209 Persistent<Promise, CopyablePersistentTraits<Promise>> promise_;
4213 std::vector<Buffer> received_buffers_;
4214 size_t total_size_ = 0;
4228 typedef std::pair<std::unique_ptr<
const uint8_t[]>, size_t> Buffer;
4232 WasmModuleObjectBuilder(
const WasmModuleObjectBuilder&) =
delete;
4233 WasmModuleObjectBuilder(WasmModuleObjectBuilder&&) =
default;
4234 WasmModuleObjectBuilder& operator=(
const WasmModuleObjectBuilder&) =
delete;
4235 WasmModuleObjectBuilder& operator=(WasmModuleObjectBuilder&&) =
default;
4237 std::vector<Buffer> received_buffers_;
4238 size_t total_size_ = 0;
4241 #ifndef V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT
4243 #define V8_ARRAY_BUFFER_INTERNAL_FIELD_COUNT 2
4297 virtual void Free(
void* data, size_t length) = 0;
4344 allocation_base_(
nullptr),
4345 allocation_length_(0),
4351 return allocation_mode_;
4354 void*
Data()
const {
return data_; }
4359 size_t byte_length_;
4360 void* allocation_base_;
4361 size_t allocation_length_;
4391 Isolate* isolate,
void* data, size_t byte_length,
4443 static void CheckCast(
Value* obj);
4447 #ifndef V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT
4449 #define V8_ARRAY_BUFFER_VIEW_INTERNAL_FIELD_COUNT 2
4498 static void CheckCast(
Value* obj);
4512 sizeof(
void*) == 4 ? (1u << 30) - 1 : (1u << 31) - 1;
4524 static void CheckCast(
Value* obj);
4534 size_t byte_offset, size_t length);
4536 size_t byte_offset, size_t length);
4541 static void CheckCast(
Value* obj);
4551 size_t byte_offset, size_t length);
4558 Uint8ClampedArray();
4559 static void CheckCast(
Value* obj);
4568 size_t byte_offset, size_t length);
4570 size_t byte_offset, size_t length);
4575 static void CheckCast(
Value* obj);
4585 size_t byte_offset, size_t length);
4587 size_t byte_offset, size_t length);
4592 static void CheckCast(
Value* obj);
4602 size_t byte_offset, size_t length);
4604 size_t byte_offset, size_t length);
4609 static void CheckCast(
Value* obj);
4619 size_t byte_offset, size_t length);
4621 size_t byte_offset, size_t length);
4626 static void CheckCast(
Value* obj);
4636 size_t byte_offset, size_t length);
4638 size_t byte_offset, size_t length);
4643 static void CheckCast(
Value* obj);
4653 size_t byte_offset, size_t length);
4655 size_t byte_offset, size_t length);
4660 static void CheckCast(
Value* obj);
4670 size_t byte_offset, size_t length);
4672 size_t byte_offset, size_t length);
4677 static void CheckCast(
Value* obj);
4687 size_t byte_offset, size_t length);
4689 size_t byte_offset, size_t length);
4694 static void CheckCast(
Value* obj);
4720 allocation_base_(
nullptr),
4721 allocation_length_(0),
4727 return allocation_mode_;
4730 void*
Data()
const {
return data_; }
4735 size_t byte_length_;
4736 void* allocation_base_;
4737 size_t allocation_length_;
4764 Isolate* isolate,
void* data, size_t byte_length,
4806 SharedArrayBuffer();
4807 static void CheckCast(
Value* obj);
4844 static void CheckCast(
Value* obj);
4860 static void CheckCast(
Value* obj);
4877 static void CheckCast(
Value* obj);
4893 static void CheckCast(
Value* obj);
4909 static void CheckCast(
Value* obj);
4963 static void CheckCast(
Value* obj);
4977 static void CheckCast(
v8::
Value* obj);
4980 #define V8_INTRINSICS_LIST(F)
4981 F(ArrayProto_entries, array_entries_iterator)
4982 F(ArrayProto_forEach, array_for_each_iterator)
4983 F(ArrayProto_keys, array_keys_iterator)
4984 F(ArrayProto_values, array_values_iterator)
4985 F(ErrorPrototype, initial_error_prototype)
4986 F(IteratorPrototype, initial_iterator_prototype)
4989 #define V8_DECL_INTRINSIC(name, iname) k##name,
4991 #undef V8_DECL_INTRINSIC
5849 deleter
, enumerator
, data
));
5966 AccessorSignature();
5977 : data_(data), length_(length) {}
5978 const char*
data()
const {
return data_; }
5994 const char* source = 0,
5996 const char** deps = 0,
5997 int source_length = -1);
6004 const char*
name()
const {
return name_; }
6019 size_t source_length_;
6065 uint64_t virtual_memory_limit);
6069 int max_semi_space_size()) {
6070 return static_cast<
int>(max_semi_space_size_in_kb_ / 1024);
6075 void set_max_semi_space_size(
int limit_in_mb)) {
6076 max_semi_space_size_in_kb_ = limit_in_mb * 1024;
6081 return max_semi_space_size_in_kb_;
6086 max_semi_space_size_in_kb_ = limit_in_kb;
6091 max_old_space_size_ = limit_in_mb;
6094 int max_executable_size()
const) {
6095 return max_executable_size_;
6098 void set_max_executable_size(
int limit_in_mb)) {
6099 max_executable_size_ = limit_in_mb;
6106 code_range_size_ = limit_in_mb;
6110 max_zone_pool_size_ = bytes;
6115 size_t max_semi_space_size_in_kb_;
6118 int max_old_space_size_;
6119 int max_executable_size_;
6120 uint32_t* stack_limit_;
6121 size_t code_range_size_;
6122 size_t max_zone_pool_size_;
6256 : promise_(promise),
6259 stack_trace_(stack_trace) {}
6267 return stack_trace_;
6428 size_t total_heap_size_;
6429 size_t total_heap_size_executable_;
6430 size_t total_physical_size_;
6431 size_t total_available_size_;
6432 size_t used_heap_size_;
6433 size_t heap_size_limit_;
6434 size_t malloced_memory_;
6435 size_t peak_malloced_memory_;
6436 bool does_zap_garbage_;
6453 const char* space_name_;
6455 size_t space_used_size_;
6456 size_t space_available_size_;
6457 size_t physical_space_size_;
6472 const char* object_type_;
6473 const char* object_sub_type_;
6474 size_t object_count_;
6475 size_t object_size_;
6487 size_t code_and_metadata_size_;
6488 size_t bytecode_and_metadata_size_;
6508 uintptr_t return_addr_location);
6631 uint16_t class_id) {}
6673 const std::vector<std::pair<
void*,
void*> >& embedder_fields) = 0;
6731 void* data_arg =
nullptr)
6748 void* data_arg =
nullptr)
6903 void* internal_throws_;
6904 void* internal_assert_;
7173 size_t frames_limit,
SampleInfo* sample_info);
7226 "Calling context concept is not compatible with tail calls, and will be "
7299 typedef size_t (*GetExternallyAllocatedMemoryInBytesCallback)();
7308 GetExternallyAllocatedMemoryInBytesCallback callback);
7394 "Use callback with parameter",
7402 "Use callback with parameter",
7403 void RemoveCallCompletedCallback(
7440 void SetAutorunMicrotasks(
bool autorun));
7447 bool WillAutorunMicrotasks()
const);
7505 bool IdleNotification(
int idle_time_in_ms));
7681 bool capture,
int frame_limit = 10,
7738 template <
class K,
class V,
class Traits>
7741 void ReportExternalAllocationLimitReached();
7742 void CheckMemoryPressure();
7771 typedef uintptr_t (*ReturnAddressLocationResolver)(
7772 uintptr_t return_addr_location);
7782 "Use isolate version",
7826 const char* warmup_source);
7838 "Use isolate version",
7846 "Use isolate version",
void RemoveMessageListeners(
MessageCallback that));
7853 "Use isolate version",
7854 void SetCaptureStackTraceForUncaughtExceptions(
7855 bool capture,
int frame_limit = 10,
7875 "Use isolate version",
7889 "Use isolate version",
7890 void AddGCPrologueCallback(
GCCallback callback,
7898 "Use isolate version",
7899 void RemoveGCPrologueCallback(
GCCallback callback));
7912 "Use isolate version",
7913 void AddGCEpilogueCallback(
GCCallback callback,
7921 "Use isolate version",
7922 void RemoveGCEpilogueCallback(
GCCallback callback));
7941 ReturnAddressLocationResolver return_address_resolver);
7953 void TerminateExecution(
Isolate* isolate));
7966 "Use isolate version",
7967 bool IsExecutionTerminating(
Isolate* isolate = NULL));
7986 "Use isolate version",
void CancelTerminateExecution(
Isolate* isolate));
8005 "Use isolate version",
8013 "Use isolate version",
8021 "Use isolate version",
8022 void VisitHandlesWithClassIds(
Isolate* isolate,
8033 "Use isolate version",
8034 void VisitHandlesForPartialDependence(
Isolate* isolate,
8045 "Use version with default location.",
8046 static bool InitializeICU(
const char* icu_data_file =
nullptr));
8061 const char* icu_data_file =
nullptr);
8081 const char* snapshot_blob);
8114 static bool TryHandleSignal(
int signal_number,
void* info,
void* context);
8129 static void DisposeGlobal(
internal::Object** global_handle);
8130 static void MakeWeak(
internal::Object** location,
void* data,
8133 static void MakeWeak(
internal::Object** location,
void* data,
8135 int internal_field_index1,
8137 int internal_field_index2,
8139 static void MakeWeak(
internal::Object*** location_addr);
8140 static void* ClearWeak(
internal::Object** location);
8143 static void RegisterExternallyReferencedObject(
internal::Object** object,
8146 template <
class K,
class V,
class T>
8149 static void FromJustIsNothing();
8150 static void ToLocalEmpty();
8151 static void InternalFieldOutOfBounds(
int index);
8281 return has_value_ ? value_ : default_value;
8285 return (
IsJust() == other.IsJust()) &&
8294 Maybe() : has_value_(
false) {}
8295 explicit Maybe(
const T& t) : has_value_(
true), value_(t) {}
8452 if (handler == NULL)
return NULL;
8453 return handler->js_stack_comparable_address_;
8462 void* operator
new(size_t size);
8463 void* operator
new[](size_t size);
8464 void operator
delete(
void*, size_t);
8465 void operator
delete[](
void*, size_t);
8467 void ResetInternal();
8473 void* js_stack_comparable_address_;
8474 bool is_verbose_ : 1;
8475 bool can_continue_ : 1;
8476 bool capture_message_ : 1;
8478 bool has_terminated_ : 1;
8494 : name_count_(name_count), names_(names) { }
8496 const char**
begin()
const {
return &names_[0]; }
8497 const char**
end()
const {
return &names_[name_count_]; }
8500 const int name_count_;
8501 const char** names_;
8575 Isolate* isolate, size_t context_snapshot_index,
8749 void* SlowGetAlignedPointerFromEmbedderData(
int index);
8838 void Initialize(
Isolate* isolate);
8869 void Initialize(
Isolate* isolate);
8896 template <size_t ptr_size>
struct SmiTagging;
8898 template<
int kSmiShiftSize>
8901 uintptr_t tagged_value =
8902 (
static_cast<uintptr_t>(value) << smi_shift_bits) |
kSmiTag;
8903 return reinterpret_cast<
internal::Object*>(tagged_value);
8907 template <>
struct SmiTagging<4> {
8914 return static_cast<
int>(
reinterpret_cast<intptr_t>(value)) >> shift_bits;
8931 return static_cast<uintptr_t>(value + 0x40000000U) < 0x80000000U;
8936 template <>
struct SmiTagging<8> {
8943 return static_cast<
int>(
reinterpret_cast<intptr_t>(value) >> shift_bits);
8950 return (value ==
static_cast<int32_t>(value));
9023 #ifdef V8_ENABLE_CHECKS
9024 CheckInitializedImpl(isolate);
9065 return *addr &
static_cast<uint8_t>(1U << shift);
9069 bool value,
int shift) {
9071 uint8_t mask =
static_cast<uint8_t>(1U << shift);
9072 *addr =
static_cast<uint8_t>((*addr & ~mask) | (value << shift));
9089 uint8_t* addr =
reinterpret_cast<uint8_t*>(isolate) +
9091 *
reinterpret_cast<
void**>(addr) = data;
9096 const uint8_t* addr =
reinterpret_cast<
const uint8_t*>(isolate) +
9098 return *
reinterpret_cast<
void*
const*>(addr);
9107 template <
typename T>
9109 const uint8_t* addr =
9111 return *
reinterpret_cast<
const T*>(addr);
9114 template <
typename T>
9118 O* ctx = *
reinterpret_cast<O*
const*>(context);
9124 return I::ReadField<T>(embedder_data, value_offset);
9133 return New(isolate, that.val_);
9138 return New(isolate, that.val_);
9144 if (that == NULL)
return Local<T>();
9148 reinterpret_cast<
internal::Isolate*>(isolate)
, *p
)));
9156 val_ =
reinterpret_cast<T*>(
9157 V8::Eternalize(isolate,
reinterpret_cast<
Value*>(*handle)));
9164 return Local<T>(val_);
9171 return Local<T>(val_);
9177 #ifdef V8_ENABLE_CHECKS
9178 if (index < 0 || index >= kEmbedderFieldsInWeakCallback) {
9179 V8::InternalFieldOutOfBounds(index);
9182 return embedder_fields_[index];
9188 if (that == NULL)
return NULL;
9190 return reinterpret_cast<T*>(
9191 V8::GlobalizeReference(
reinterpret_cast<
internal::Isolate*>(isolate),
9196 template <
class T,
class M>
9197 template <
class S,
class M2>
9201 if (that.IsEmpty())
return;
9203 this->val_ =
reinterpret_cast<T*>(
V8::CopyPersistent(p));
9204 M::Copy(that,
this);
9211 if (
this->IsEmpty())
return false;
9220 if (
this->IsEmpty())
return false;
9221 uint8_t node_state =
9231 if (
this->IsEmpty())
return false;
9239 if (
this->IsEmpty())
return;
9240 V8::DisposeGlobal(
reinterpret_cast<
internal::Object**>(
this->val_));
9250 if (other.IsEmpty())
return;
9251 this->val_ = New(isolate, other.val_);
9261 if (other.IsEmpty())
return;
9262 this->val_ = New(isolate, other.val_);
9267 template <
typename P>
9272 V8::MakeWeak(
reinterpret_cast<
internal::Object**>(
this->val_), parameter,
9273 reinterpret_cast<Callback>(callback), type);
9278 V8::MakeWeak(
reinterpret_cast<
internal::Object***>(&
this->val_));
9282 template <
typename P>
9284 return reinterpret_cast<P*>(
9285 V8::ClearWeak(
reinterpret_cast<
internal::Object**>(
this->val_)));
9291 V8::RegisterExternallyReferencedObject(
9292 reinterpret_cast<
internal::Object**>(
this->val_),
9293 reinterpret_cast<
internal::Isolate*>(isolate));
9299 if (
this->IsEmpty())
return;
9308 if (
this->IsEmpty())
return;
9317 if (
this->IsEmpty())
return;
9320 *
reinterpret_cast<uint16_t*>(addr) = class_id;
9327 if (
this->IsEmpty())
return 0;
9330 return *
reinterpret_cast<uint16_t*>(addr);
9334 template<
typename T>
9337 template<
typename T>
9338 template<
typename S>
9342 *value_ = GetDefaultValue();
9344 *value_ = *
reinterpret_cast<
internal::Object**>(*handle);
9348 template <
typename T>
9349 template <
typename S>
9353 *value_ = GetDefaultValue();
9355 *value_ = *
reinterpret_cast<
internal::Object**>(*handle);
9359 template <
typename T>
9360 template <
typename S>
9364 *value_ = GetDefaultValue();
9366 *value_ = *
reinterpret_cast<
internal::Object**>(*handle);
9370 template<
typename T>
9376 template<
typename T>
9387 template<
typename T>
9391 bool fits_into_int32_t = (i & (1U << 31)) == 0;
9393 Set(
static_cast<int32_t>(i));
9399 template<
typename T>
9412 template<
typename T>
9419 template<
typename T>
9426 template<
typename T>
9433 template <
typename T>
9436 return *
reinterpret_cast<
Isolate**>(&value_[-2]);
9439 template <
typename T>
9447 template <
typename T>
9448 template <
typename S>
9454 template<
typename T>
9460 template <
typename T>
9466 template<
typename T>
9473 template<
typename T>
9480 template<
typename T>
9486 template<
typename T>
9492 template <
typename T>
9498 template <
typename T>
9504 template<
typename T>
9510 template<
typename T>
9516 template<
typename T>
9522 template<
typename T>
9535 : resource_name_(resource_name),
9536 resource_line_offset_(resource_line_offset),
9537 resource_column_offset_(resource_column_offset),
9538 options_
(!resource_is_shared_cross_origin
.IsEmpty() &&
9543 script_id_(script_id),
9544 source_map_url_(source_map_url) {}
9550 return resource_line_offset_;
9555 return resource_column_offset_;
9567 : source_string(string),
9573 cached_data(data) {}
9578 : source_string(string), cached_data(data) {}
9592 return resource_options;
9607 #ifndef V8_ENABLE_CHECKS
9611 O* obj = *
reinterpret_cast<O**>(
this);
9619 O** result =
HandleScope::CreateHandle(
reinterpret_cast<HO*>(obj), value);
9623 return SlowGetInternalField(index);
9628 #ifndef V8_ENABLE_CHECKS
9631 O* obj = *
reinterpret_cast<O**>(
this);
9641 return SlowGetAlignedPointerFromInternalField(index);
9645 #ifdef V8_ENABLE_CHECKS
9648 return static_cast<
String*>(value);
9664 O* obj = *
reinterpret_cast<O*
const*>(
this);
9672 #ifdef V8_ENABLE_CHECKS
9673 VerifyExternalStringResource(result);
9683 O* obj = *
reinterpret_cast<O*
const*>(
this);
9692 #ifdef V8_ENABLE_CHECKS
9693 VerifyExternalStringResourceBase(resource, *encoding_out);
9700 #ifdef V8_ENABLE_CHECKS
9701 return FullIsUndefined();
9703 return QuickIsUndefined();
9707 bool Value::QuickIsUndefined()
const {
9710 O* obj = *
reinterpret_cast<O*
const*>(
this);
9718 #ifdef V8_ENABLE_CHECKS
9719 return FullIsNull();
9721 return QuickIsNull();
9725 bool Value::QuickIsNull()
const {
9728 O* obj = *
reinterpret_cast<O*
const*>(
this);
9735 #ifdef V8_ENABLE_CHECKS
9736 return FullIsNull() || FullIsUndefined();
9738 return QuickIsNullOrUndefined();
9742 bool Value::QuickIsNullOrUndefined()
const {
9745 O* obj = *
reinterpret_cast<O*
const*>(
this);
9753 #ifdef V8_ENABLE_CHECKS
9754 return FullIsString();
9756 return QuickIsString();
9760 bool Value::QuickIsString()
const {
9763 O* obj = *
reinterpret_cast<O*
const*>(
this);
9770 return static_cast<
Value*>(value);
9823 #ifdef V8_ENABLE_CHECKS
9826 return static_cast<
Boolean*>(value);
9831 #ifdef V8_ENABLE_CHECKS
9834 return static_cast<
Name*>(value);
9839 #ifdef V8_ENABLE_CHECKS
9842 return static_cast<
Symbol*>(value);
9847 #ifdef V8_ENABLE_CHECKS
9850 return static_cast<
Number*>(value);
9855 #ifdef V8_ENABLE_CHECKS
9858 return static_cast<
Integer*>(value);
9863 #ifdef V8_ENABLE_CHECKS
9866 return static_cast<
Int32*>(value);
9871 #ifdef V8_ENABLE_CHECKS
9874 return static_cast<
Uint32*>(value);
9879 #ifdef V8_ENABLE_CHECKS
9882 return static_cast<
Date*>(value);
9887 #ifdef V8_ENABLE_CHECKS
9895 #ifdef V8_ENABLE_CHECKS
9903 #ifdef V8_ENABLE_CHECKS
9911 #ifdef V8_ENABLE_CHECKS
9919 #ifdef V8_ENABLE_CHECKS
9922 return static_cast<
RegExp*>(value);
9927 #ifdef V8_ENABLE_CHECKS
9930 return static_cast<
Object*>(value);
9935 #ifdef V8_ENABLE_CHECKS
9938 return static_cast<
Array*>(value);
9943 #ifdef V8_ENABLE_CHECKS
9946 return static_cast<
Map*>(value);
9951 #ifdef V8_ENABLE_CHECKS
9954 return static_cast<
Set*>(value);
9959 #ifdef V8_ENABLE_CHECKS
9962 return static_cast<
Promise*>(value);
9967 #ifdef V8_ENABLE_CHECKS
9970 return static_cast<
Proxy*>(value);
9974 #ifdef V8_ENABLE_CHECKS
9981 #ifdef V8_ENABLE_CHECKS
9989 #ifdef V8_ENABLE_CHECKS
9997 #ifdef V8_ENABLE_CHECKS
10005 #ifdef V8_ENABLE_CHECKS
10013 #ifdef V8_ENABLE_CHECKS
10021 #ifdef V8_ENABLE_CHECKS
10029 #ifdef V8_ENABLE_CHECKS
10037 #ifdef V8_ENABLE_CHECKS
10045 #ifdef V8_ENABLE_CHECKS
10053 #ifdef V8_ENABLE_CHECKS
10061 #ifdef V8_ENABLE_CHECKS
10069 #ifdef V8_ENABLE_CHECKS
10077 #ifdef V8_ENABLE_CHECKS
10085 #ifdef V8_ENABLE_CHECKS
10088 return static_cast<
DataView*>(value);
10093 #ifdef V8_ENABLE_CHECKS
10101 #ifdef V8_ENABLE_CHECKS
10104 return static_cast<
Function*>(value);
10109 #ifdef V8_ENABLE_CHECKS
10112 return static_cast<
External*>(value);
10116 template<
typename T>
10122 template<
typename T>
10128 template<
typename T>
10134 template<
typename T>
10140 template<
typename T>
10145 template <
typename T>
10207 int64_t change_in_bytes) {
10209 const int64_t kMemoryReducerActivationLimit = 32 * 1024 * 1024;
10210 int64_t* external_memory =
reinterpret_cast<int64_t*>(
10212 int64_t* external_memory_limit =
reinterpret_cast<int64_t*>(
10214 int64_t* external_memory_at_last_mc =
10215 reinterpret_cast<int64_t*>(
reinterpret_cast<uint8_t*>(
this) +
10217 const int64_t amount = *external_memory + change_in_bytes;
10219 *external_memory = amount;
10221 int64_t allocation_diff_since_last_mc =
10222 *external_memory_at_last_mc - *external_memory;
10223 allocation_diff_since_last_mc = allocation_diff_since_last_mc < 0
10224 ? -allocation_diff_since_last_mc
10225 : allocation_diff_since_last_mc;
10226 if (allocation_diff_since_last_mc > kMemoryReducerActivationLimit) {
10227 CheckMemoryPressure();
10230 if (change_in_bytes < 0) {
10231 *external_memory_limit += change_in_bytes;
10234 if (change_in_bytes > 0 && amount > *external_memory_limit) {
10235 ReportExternalAllocationLimitReached();
10237 return *external_memory;
10241 #ifndef V8_ENABLE_CHECKS
10245 HO* context = *
reinterpret_cast<HO**>(
this);
10250 return SlowGetEmbedderData(index);
10256 #ifndef V8_ENABLE_CHECKS
10260 return SlowGetAlignedPointerFromEmbedderData(index);
10264 bool V8::IsDead() {
10282 void V8::SetFailedAccessCheckCallbackFunction(
10289 void V8::SetCaptureStackTraceForUncaughtExceptions(
10302 void V8::RemoveGCPrologueCallback(
GCCallback callback) {
10309 void V8::RemoveGCEpilogueCallback(
GCCallback callback) {
10318 bool V8::IsExecutionTerminating(
Isolate* isolate) {
10319 if (isolate == NULL) {
10326 void V8::CancelTerminateExecution(
Isolate* isolate) {
10343 void V8::VisitHandlesWithClassIds(
Isolate* isolate,
10349 void V8::VisitHandlesForPartialDependence(
Isolate* isolate,