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
) && defined(V8_SHARED)
67 #ifdef BUILDING_V8_SHARED
68 #define V8EXPORT __attribute__ ((visibility("default")))
101 class ImplementationUtilities;
104 template <
class T>
class Handle;
105 template <
class T>
class Local;
143 #define TYPE_CHECK(T, S)
145 *(static_cast<T* volatile*>(0
)) = static_cast<S*>(0
);
183 inline explicit Handle(T* val) : val_(val) {}
196 : val_(
reinterpret_cast<T*>(*that)) {
208 inline bool IsEmpty()
const {
return val_ == 0; }
228 if (a == 0)
return b == 0;
229 if (b == 0)
return false;
240 return !operator==(that);
244 #ifdef V8_ENABLE_CHECKS
247 if (that.IsEmpty())
return Handle<T>();
249 return Handle<T>(T::Cast(*that));
253 return Handle<S>::Cast(*
this);
272 :
Handle<T>(
reinterpret_cast<T*>(*that)) {
282 #ifdef V8_ENABLE_CHECKS
285 if (that.IsEmpty())
return Local<T>();
287 return Local<T>(T::Cast(*that));
291 return Local<S>::Cast(*
this);
339 :
Handle<T>(
reinterpret_cast<T*>(*that)) {
358 #ifdef V8_ENABLE_CHECKS
361 if (that.IsEmpty())
return Persistent<T>();
412 inline bool IsWeak()
const;
421 friend class ImplementationUtilities;
469 void* operator
new(size_t size);
470 void operator
delete(
void*, size_t);
479 inline void Initialize() {
496 friend class ImplementationUtilities;
558 virtual const char*
Data() = 0;
576 : resource_name_(resource_name),
577 resource_line_offset_(resource_line_offset),
578 resource_column_offset_(resource_column_offset) { }
875 inline bool IsNull()
const;
989 inline bool QuickIsUndefined()
const;
990 inline bool QuickIsNull()
const;
991 inline bool QuickIsString()
const;
992 V8EXPORT bool FullIsUndefined()
const;
1083 int* nchars_ref = NULL,
1143 virtual const uint16_t*
data()
const = 0;
1174 virtual const char*
data()
const = 0;
1339 Value(
const Value&);
1340 void operator=(
const Value&);
1665 int number_of_elements);
1701 V8EXPORT void* SlowGetPointerFromInternalField(
int index);
1707 inline Local<
Value> UncheckedGetInternalField(
int index);
1972 inline int Length()
const;
1982 static const int kIsolateIndex = 0;
1983 static const int kDataIndex = -1;
1984 static const int kCalleeIndex = -2;
1985 static const int kHolderIndex = -3;
1987 friend class ImplementationUtilities;
1988 inline Arguments(
internal::Object** implicit_args,
1991 bool is_construct_call);
1995 bool is_construct_call_;
2447 bool turned_on_by_default =
true);
2492 AccessorSignature();
2517 : data_(data), length_(length) {}
2518 const char*
data()
const {
return data_; }
2534 const char* source = 0,
2536 const char** deps = 0,
2537 int source_length = -1);
2544 const char*
name()
const {
return name_; }
2555 size_t source_length_;
2617 int max_young_space_size_;
2618 int max_old_space_size_;
2619 int max_executable_size_;
2620 uint32_t* stack_limit_;
2750 void set_total_heap_size(size_t size) { total_heap_size_ = size; }
2751 void set_total_heap_size_executable(size_t size) {
2752 total_heap_size_executable_ = size;
2754 void set_used_heap_size(size_t size) { used_heap_size_ = size; }
2755 void set_heap_size_limit(size_t size) { heap_size_limit_ = size; }
2757 size_t total_heap_size_;
2758 size_t total_heap_size_executable_;
2759 size_t used_heap_size_;
2760 size_t heap_size_limit_;
2795 Scope(
const Scope&);
2844 inline void SetData(
void* data);
2857 void* operator
new(size_t size);
2858 void operator
delete(
void*, size_t);
2892 const char* compressed_data,
2893 int compressed_data_size) = 0;
2917 typedef uintptr_t (*ReturnAddressLocationResolver)(
2918 uintptr_t return_addr_location);
3010 int frame_limit = 10,
3179 ReturnAddressLocationResolver return_address_resolver);
3196 intptr_t change_in_bytes);
3333 static void DisposeGlobal(
internal::Object** global_handle);
3334 static void MakeWeak(
internal::Object** global_handle,
3337 static void ClearWeak(
internal::Object** global_handle);
3338 static void MarkIndependent(
internal::Object** global_handle);
3339 static bool IsGlobalNearDeath(
internal::Object** global_handle);
3340 static bool IsGlobalWeak(
internal::Object** global_handle);
3341 static void SetWrapperClassId(
internal::Object** global_handle,
3451 bool is_verbose_ : 1;
3452 bool can_continue_ : 1;
3453 bool capture_message_ : 1;
3469 : name_count_(name_count), names_(names) { }
3471 friend class ImplementationUtilities;
3473 const char** names_;
3770 static bool active_;
3774 void operator=(
const Locker&);
3857 template <size_t ptr_size>
struct SmiTagging;
3860 template <>
struct SmiTagging<4> {
3866 return static_cast<
int>(
reinterpret_cast<intptr_t>(value)) >> shift_bits;
3876 template <>
struct SmiTagging<8> {
3882 return static_cast<
int>(
reinterpret_cast<intptr_t>(value) >> shift_bits);
3966 const uintptr_t address =
reinterpret_cast<uintptr_t>(value);
3987 return *
reinterpret_cast<
int*>(addr) == 1;
3991 uint8_t* addr =
reinterpret_cast<uint8_t*>(isolate) +
3993 *
reinterpret_cast<
void**>(addr) = data;
3997 uint8_t* addr =
reinterpret_cast<uint8_t*>(isolate) +
3999 return *
reinterpret_cast<
void**>(addr);
4007 template <
typename T>
4009 uint8_t* addr =
reinterpret_cast<uint8_t*>(ptr) + offset -
kHeapObjectTag;
4010 return *
reinterpret_cast<T*>(addr);
4031 if (that.IsEmpty())
return Local<T>();
4032 T* that_ptr = *that;
4036 reinterpret_cast<
internal::HeapObject*>(*p)
)));
4046 return Persistent<T>(
reinterpret_cast<T*>(
V8::GlobalizeReference(p)));
4052 if (
this->IsEmpty())
return false;
4053 return V8::IsGlobalNearDeath(
reinterpret_cast<
internal::Object**>(**
this));
4059 if (
this->IsEmpty())
return false;
4060 return V8::IsGlobalWeak(
reinterpret_cast<
internal::Object**>(**
this));
4066 if (
this->IsEmpty())
return;
4067 V8::DisposeGlobal(
reinterpret_cast<
internal::Object**>(**
this));
4076 V8::MakeWeak(
reinterpret_cast<
internal::Object**>(**
this),
4083 V8::ClearWeak(
reinterpret_cast<
internal::Object**>(**
this));
4088 V8::MarkIndependent(
reinterpret_cast<
internal::Object**>(**
this));
4093 V8::SetWrapperClassId(
reinterpret_cast<
internal::Object**>(**
this), class_id);
4097 internal::Object** values,
int length,
4098 bool is_construct_call)
4099 : implicit_args_(implicit_args),
4102 is_construct_call_(is_construct_call) { }
4113 &implicit_args_[kCalleeIndex]));
4124 &implicit_args_[kHolderIndex]));
4129 return Local<
Value>(
reinterpret_cast<
Value*>(&implicit_args_[kDataIndex]));
4134 return *
reinterpret_cast<
Isolate**>(&implicit_args_[kIsolateIndex]);
4139 return is_construct_call_;
4151 internal::Object** after = RawClose(before);
4152 return Local<T>(
reinterpret_cast<T*>(after));
4156 return resource_name_;
4161 return resource_line_offset_;
4166 return resource_column_offset_;
4181 #ifndef V8_ENABLE_CHECKS
4182 Local<
Value> quick_result = UncheckedGetInternalField(index);
4183 if (!quick_result
.IsEmpty())
return quick_result;
4185 return CheckedGetInternalField(index);
4192 O* obj = *
reinterpret_cast<O**>(
this);
4208 #ifdef V8_ENABLE_CHECKS
4209 return FullUnwrap(obj);
4211 return QuickUnwrap(obj);
4218 O* obj = *
reinterpret_cast<O**>(
const_cast<
v8::
Value*>(
*wrapper));
4227 O* obj = *
reinterpret_cast<O**>(
this);
4238 return SlowGetPointerFromInternalField(index);
4243 #ifdef V8_ENABLE_CHECKS
4246 return static_cast<
String*>(value);
4262 O* obj = *
reinterpret_cast<O**>(
const_cast<
String*>(
this));
4270 #ifdef V8_ENABLE_CHECKS
4271 VerifyExternalStringResource(result);
4278 #ifdef V8_ENABLE_CHECKS
4279 return FullIsUndefined();
4281 return QuickIsUndefined();
4285 bool Value::QuickIsUndefined()
const {
4288 O* obj = *
reinterpret_cast<O**>(
const_cast<
Value*>(
this));
4296 #ifdef V8_ENABLE_CHECKS
4297 return FullIsNull();
4299 return QuickIsNull();
4303 bool Value::QuickIsNull()
const {
4306 O* obj = *
reinterpret_cast<O**>(
const_cast<
Value*>(
this));
4314 #ifdef V8_ENABLE_CHECKS
4315 return FullIsString();
4317 return QuickIsString();
4321 bool Value::QuickIsString()
const {
4324 O* obj = *
reinterpret_cast<O**>(
const_cast<
Value*>(
this));
4331 #ifdef V8_ENABLE_CHECKS
4334 return static_cast<
Number*>(value);
4339 #ifdef V8_ENABLE_CHECKS
4342 return static_cast<
Integer*>(value);
4347 #ifdef V8_ENABLE_CHECKS
4350 return static_cast<
Date*>(value);
4355 #ifdef V8_ENABLE_CHECKS
4363 #ifdef V8_ENABLE_CHECKS
4371 #ifdef V8_ENABLE_CHECKS
4379 #ifdef V8_ENABLE_CHECKS
4382 return static_cast<
RegExp*>(value);
4387 #ifdef V8_ENABLE_CHECKS
4390 return static_cast<
Object*>(value);
4395 #ifdef V8_ENABLE_CHECKS
4398 return static_cast<
Array*>(value);
4403 #ifdef V8_ENABLE_CHECKS
4406 return static_cast<
Function*>(value);
4411 #ifdef V8_ENABLE_CHECKS
4414 return static_cast<
External*>(value);
4419 return *
reinterpret_cast<
Isolate**>(&args_[-3]);