50 #if defined(BUILDING_V8_SHARED) && defined(USING_V8_SHARED)
51 #error both BUILDING_V8_SHARED and USING_V8_SHARED are set - please check the
52 build configuration to ensure that at most one of these is set
55 #ifdef BUILDING_V8_SHARED
56 #define V8EXPORT __declspec(dllexport)
58 #define V8EXPORT __declspec(dllimport)
66 #if defined(__GNUC__
) && ((__GNUC__
>= 4
) ||
67 (__GNUC__
== 3
&& __GNUC_MINOR__
>= 3
)) && defined(V8_SHARED)
68 #ifdef BUILDING_V8_SHARED
69 #define V8EXPORT __attribute__ ((visibility("default")))
102 class ImplementationUtilities;
105 template <
class T>
class Handle;
106 template <
class T>
class Local;
144 #define TYPE_CHECK(T, S)
146 *(static_cast<T* volatile*>(0
)) = static_cast<S*>(0
);
184 inline explicit Handle(T* val) : val_(val) {}
197 : val_(
reinterpret_cast<T*>(*that)) {
209 inline bool IsEmpty()
const {
return val_ == 0; }
229 if (a == 0)
return b == 0;
230 if (b == 0)
return false;
241 return !operator==(that);
245 #ifdef V8_ENABLE_CHECKS
248 if (that.IsEmpty())
return Handle<T>();
250 return Handle<T>(T::Cast(*that));
254 return Handle<S>::Cast(*
this);
273 :
Handle<T>(
reinterpret_cast<T*>(*that)) {
283 #ifdef V8_ENABLE_CHECKS
286 if (that.IsEmpty())
return Local<T>();
288 return Local<T>(T::Cast(*that));
292 return Local<S>::Cast(*
this);
340 :
Handle<T>(
reinterpret_cast<T*>(*that)) {
359 #ifdef V8_ENABLE_CHECKS
362 if (that.IsEmpty())
return Persistent<T>();
412 inline bool IsWeak()
const;
427 friend class ImplementationUtilities;
475 void* operator
new(size_t size);
476 void operator
delete(
void*, size_t);
485 inline void Initialize() {
502 friend class ImplementationUtilities;
564 virtual const char*
Data() = 0;
582 : resource_name_(resource_name),
583 resource_line_offset_(resource_line_offset),
584 resource_column_offset_(resource_column_offset) { }
881 inline bool IsNull()
const;
995 inline bool QuickIsUndefined()
const;
996 inline bool QuickIsNull()
const;
997 inline bool QuickIsString()
const;
998 V8EXPORT bool FullIsUndefined()
const;
1000 V8EXPORT bool FullIsString()
const;
1095 int* nchars_ref = NULL,
1155 virtual const uint16_t*
data()
const = 0;
1186 virtual const char*
data()
const = 0;
1359 Value(
const Value&);
1360 void operator=(
const Value&);
1695 int number_of_elements);
1731 V8EXPORT void* SlowGetPointerFromInternalField(
int index);
1737 inline Local<
Value> UncheckedGetInternalField(
int index);
2002 inline int Length()
const;
2012 static const int kIsolateIndex = 0;
2013 static const int kDataIndex = -1;
2014 static const int kCalleeIndex = -2;
2015 static const int kHolderIndex = -3;
2017 friend class ImplementationUtilities;
2018 inline Arguments(
internal::Object** implicit_args,
2021 bool is_construct_call);
2025 bool is_construct_call_;
2477 bool turned_on_by_default =
true);
2522 AccessorSignature();
2547 : data_(data), length_(length) {}
2548 const char*
data()
const {
return data_; }
2564 const char* source = 0,
2566 const char** deps = 0,
2567 int source_length = -1);
2574 const char*
name()
const {
return name_; }
2585 size_t source_length_;
2647 int max_young_space_size_;
2648 int max_old_space_size_;
2649 int max_executable_size_;
2650 uint32_t* stack_limit_;
2780 void set_total_heap_size(size_t size) { total_heap_size_ = size; }
2781 void set_total_heap_size_executable(size_t size) {
2782 total_heap_size_executable_ = size;
2784 void set_used_heap_size(size_t size) { used_heap_size_ = size; }
2785 void set_heap_size_limit(size_t size) { heap_size_limit_ = size; }
2787 size_t total_heap_size_;
2788 size_t total_heap_size_executable_;
2789 size_t used_heap_size_;
2790 size_t heap_size_limit_;
2825 Scope(
const Scope&);
2874 inline void SetData(
void* data);
2887 void* operator
new(size_t size);
2888 void operator
delete(
void*, size_t);
2922 const char* compressed_data,
2923 int compressed_data_size) = 0;
2950 typedef uintptr_t (*ReturnAddressLocationResolver)(
2951 uintptr_t return_addr_location);
2966 uintptr_t return_addr_location);
3037 uint16_t class_id) {}
3119 int frame_limit = 10,
3288 ReturnAddressLocationResolver return_address_resolver);
3342 intptr_t change_in_bytes);
3485 static void DisposeGlobal(
internal::Object** global_handle);
3486 static void MakeWeak(
internal::Object** global_handle,
3489 static void ClearWeak(
internal::Object** global_handle);
3490 static void MarkIndependent(
internal::Object** global_handle);
3491 static bool IsGlobalIndependent(
internal::Object** global_handle);
3492 static bool IsGlobalNearDeath(
internal::Object** global_handle);
3493 static bool IsGlobalWeak(
internal::Object** global_handle);
3494 static void SetWrapperClassId(
internal::Object** global_handle,
3496 static uint16_t GetWrapperClassId(
internal::Object** global_handle);
3605 bool is_verbose_ : 1;
3606 bool can_continue_ : 1;
3607 bool capture_message_ : 1;
3623 : name_count_(name_count), names_(names) { }
3625 friend class ImplementationUtilities;
3627 const char** names_;
3931 static bool active_;
3935 void operator=(
const Locker&);
4018 template <size_t ptr_size>
struct SmiTagging;
4021 template <>
struct SmiTagging<4> {
4027 return static_cast<
int>(
reinterpret_cast<intptr_t>(value)) >> shift_bits;
4037 template <>
struct SmiTagging<8> {
4043 return static_cast<
int>(
reinterpret_cast<intptr_t>(value) >> shift_bits);
4129 const uintptr_t address =
reinterpret_cast<uintptr_t>(value);
4150 return *
reinterpret_cast<
int*>(addr) == 1;
4154 uint8_t* addr =
reinterpret_cast<uint8_t*>(isolate) +
4156 *
reinterpret_cast<
void**>(addr) = data;
4160 uint8_t* addr =
reinterpret_cast<uint8_t*>(isolate) +
4162 return *
reinterpret_cast<
void**>(addr);
4170 template <
typename T>
4172 uint8_t* addr =
reinterpret_cast<uint8_t*>(ptr) + offset -
kHeapObjectTag;
4173 return *
reinterpret_cast<T*>(addr);
4194 if (that.IsEmpty())
return Local<T>();
4195 T* that_ptr = *that;
4199 reinterpret_cast<
internal::HeapObject*>(*p)
)));
4209 return Persistent<T>(
reinterpret_cast<T*>(
V8::GlobalizeReference(p)));
4215 if (
this->IsEmpty())
return false;
4216 return V8::IsGlobalIndependent(
reinterpret_cast<
internal::Object**>(**
this));
4222 if (
this->IsEmpty())
return false;
4223 return V8::IsGlobalNearDeath(
reinterpret_cast<
internal::Object**>(**
this));
4229 if (
this->IsEmpty())
return false;
4230 return V8::IsGlobalWeak(
reinterpret_cast<
internal::Object**>(**
this));
4236 if (
this->IsEmpty())
return;
4237 V8::DisposeGlobal(
reinterpret_cast<
internal::Object**>(**
this));
4246 V8::MakeWeak(
reinterpret_cast<
internal::Object**>(**
this),
4253 V8::ClearWeak(
reinterpret_cast<
internal::Object**>(**
this));
4258 V8::MarkIndependent(
reinterpret_cast<
internal::Object**>(**
this));
4263 V8::SetWrapperClassId(
reinterpret_cast<
internal::Object**>(**
this), class_id);
4268 return V8::GetWrapperClassId(
reinterpret_cast<
internal::Object**>(**
this));
4272 internal::Object** values,
int length,
4273 bool is_construct_call)
4274 : implicit_args_(implicit_args),
4277 is_construct_call_(is_construct_call) { }
4288 &implicit_args_[kCalleeIndex]));
4299 &implicit_args_[kHolderIndex]));
4304 return Local<
Value>(
reinterpret_cast<
Value*>(&implicit_args_[kDataIndex]));
4309 return *
reinterpret_cast<
Isolate**>(&implicit_args_[kIsolateIndex]);
4314 return is_construct_call_;
4326 internal::Object** after = RawClose(before);
4327 return Local<T>(
reinterpret_cast<T*>(after));
4331 return resource_name_;
4336 return resource_line_offset_;
4341 return resource_column_offset_;
4356 #ifndef V8_ENABLE_CHECKS
4357 Local<
Value> quick_result = UncheckedGetInternalField(index);
4358 if (!quick_result
.IsEmpty())
return quick_result;
4360 return CheckedGetInternalField(index);
4367 O* obj = *
reinterpret_cast<O**>(
this);
4383 #ifdef V8_ENABLE_CHECKS
4384 return FullUnwrap(obj);
4386 return QuickUnwrap(obj);
4393 O* obj = *
reinterpret_cast<O**>(
const_cast<
v8::
Value*>(
*wrapper));
4402 O* obj = *
reinterpret_cast<O**>(
this);
4413 return SlowGetPointerFromInternalField(index);
4418 #ifdef V8_ENABLE_CHECKS
4421 return static_cast<
String*>(value);
4437 O* obj = *
reinterpret_cast<O**>(
const_cast<
String*>(
this));
4445 #ifdef V8_ENABLE_CHECKS
4446 VerifyExternalStringResource(result);
4456 O* obj = *
reinterpret_cast<O**>(
const_cast<
String*>(
this));
4465 #ifdef V8_ENABLE_CHECKS
4466 VerifyExternalStringResourceBase(resource, *encoding_out);
4473 #ifdef V8_ENABLE_CHECKS
4474 return FullIsUndefined();
4476 return QuickIsUndefined();
4480 bool Value::QuickIsUndefined()
const {
4483 O* obj = *
reinterpret_cast<O**>(
const_cast<
Value*>(
this));
4491 #ifdef V8_ENABLE_CHECKS
4492 return FullIsNull();
4494 return QuickIsNull();
4498 bool Value::QuickIsNull()
const {
4501 O* obj = *
reinterpret_cast<O**>(
const_cast<
Value*>(
this));
4509 #ifdef V8_ENABLE_CHECKS
4510 return FullIsString();
4512 return QuickIsString();
4516 bool Value::QuickIsString()
const {
4519 O* obj = *
reinterpret_cast<O**>(
const_cast<
Value*>(
this));
4526 #ifdef V8_ENABLE_CHECKS
4529 return static_cast<
Number*>(value);
4534 #ifdef V8_ENABLE_CHECKS
4537 return static_cast<
Integer*>(value);
4542 #ifdef V8_ENABLE_CHECKS
4545 return static_cast<
Date*>(value);
4550 #ifdef V8_ENABLE_CHECKS
4558 #ifdef V8_ENABLE_CHECKS
4566 #ifdef V8_ENABLE_CHECKS
4574 #ifdef V8_ENABLE_CHECKS
4577 return static_cast<
RegExp*>(value);
4582 #ifdef V8_ENABLE_CHECKS
4585 return static_cast<
Object*>(value);
4590 #ifdef V8_ENABLE_CHECKS
4593 return static_cast<
Array*>(value);
4598 #ifdef V8_ENABLE_CHECKS
4601 return static_cast<
Function*>(value);
4606 #ifdef V8_ENABLE_CHECKS
4609 return static_cast<
External*>(value);
4614 return *
reinterpret_cast<
Isolate**>(&args_[-3]);