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,