32 #define V8_INFINITY INFINITY
37 #define __GNUC_VERSION_FOR_INFTY__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
45 #if __GNUC_VERSION_FOR_INFTY__ >= 29600 && __GNUC_VERSION_FOR_INFTY__ < 40100
48 #define V8_INFINITY std::numeric_limits<double>::infinity()
50 #undef __GNUC_VERSION_FOR_INFTY__
56 #define V8_INFINITY HUGE_VAL
60 #include "../include/v8stdint.h"
69 #if defined(_M_X64) || defined(__x86_64__)
70 #define V8_HOST_ARCH_X64 1
71 #define V8_HOST_ARCH_64_BIT 1
72 #define V8_HOST_CAN_READ_UNALIGNED 1
73 #elif defined(_M_IX86) || defined(__i386__)
74 #define V8_HOST_ARCH_IA32 1
75 #define V8_HOST_ARCH_32_BIT 1
76 #define V8_HOST_CAN_READ_UNALIGNED 1
77 #elif defined(__ARMEL__)
78 #define V8_HOST_ARCH_ARM 1
79 #define V8_HOST_ARCH_32_BIT 1
83 #if CAN_USE_UNALIGNED_ACCESSES
84 #define V8_HOST_CAN_READ_UNALIGNED 1
86 #elif defined(__MIPSEL__)
87 #define V8_HOST_ARCH_MIPS 1
88 #define V8_HOST_ARCH_32_BIT 1
90 #error Host architecture was not detected as supported by v8
96 #if !defined(V8_TARGET_ARCH_X64) && !defined(V8_TARGET_ARCH_IA32) && \
97 !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_MIPS)
98 #if defined(_M_X64) || defined(__x86_64__)
99 #define V8_TARGET_ARCH_X64 1
100 #elif defined(_M_IX86) || defined(__i386__)
101 #define V8_TARGET_ARCH_IA32 1
102 #elif defined(__ARMEL__)
103 #define V8_TARGET_ARCH_ARM 1
104 #elif defined(__MIPSEL__)
105 #define V8_TARGET_ARCH_MIPS 1
107 #error Target architecture was not detected as supported by v8
112 #if defined(V8_TARGET_ARCH_IA32) && !defined(V8_HOST_ARCH_IA32)
113 #error Target architecture ia32 is only supported on ia32 host
115 #if defined(V8_TARGET_ARCH_X64) && !defined(V8_HOST_ARCH_X64)
116 #error Target architecture x64 is only supported on x64 host
118 #if (defined(V8_TARGET_ARCH_ARM) && \
119 !(defined(V8_HOST_ARCH_IA32) || defined(V8_HOST_ARCH_ARM)))
120 #error Target architecture arm is only supported on arm and ia32 host
122 #if (defined(V8_TARGET_ARCH_MIPS) && \
123 !(defined(V8_HOST_ARCH_IA32) || defined(V8_HOST_ARCH_MIPS)))
124 #error Target architecture mips is only supported on mips and ia32 host
130 #if !defined(USE_SIMULATOR)
131 #if (defined(V8_TARGET_ARCH_ARM) && !defined(V8_HOST_ARCH_ARM))
132 #define USE_SIMULATOR 1
134 #if (defined(V8_TARGET_ARCH_MIPS) && !defined(V8_HOST_ARCH_MIPS))
135 #define USE_SIMULATOR 1
140 #if defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_IA32)
141 #define V8_TARGET_CAN_READ_UNALIGNED 1
142 #elif V8_TARGET_ARCH_ARM
146 #if CAN_USE_UNALIGNED_ACCESSES
147 #define V8_TARGET_CAN_READ_UNALIGNED 1
149 #elif V8_TARGET_ARCH_MIPS
151 #error Target architecture is not supported by v8
167 typedef unsigned int __my_bool__;
168 #define bool __my_bool__ // use 'indirection' to avoid name clashes
177 #if V8_HOST_ARCH_64_BIT
178 #if defined(_MSC_VER)
179 #define V8_UINT64_C(x) (x ## UI64)
180 #define V8_INT64_C(x) (x ## I64)
181 #define V8_INTPTR_C(x) (x ## I64)
182 #define V8_PTR_PREFIX "ll"
183 #elif defined(__MINGW64__)
184 #define V8_UINT64_C(x) (x ## ULL)
185 #define V8_INT64_C(x) (x ## LL)
186 #define V8_INTPTR_C(x) (x ## LL)
187 #define V8_PTR_PREFIX "I64"
189 #define V8_UINT64_C(x) (x ## UL)
190 #define V8_INT64_C(x) (x ## L)
191 #define V8_INTPTR_C(x) (x ## L)
192 #define V8_PTR_PREFIX "l"
194 #else // V8_HOST_ARCH_64_BIT
195 #define V8_INTPTR_C(x) (x)
196 #define V8_PTR_PREFIX ""
197 #endif // V8_HOST_ARCH_64_BIT
202 #define V8_2PART_UINT64_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u))
204 #define V8PRIxPTR V8_PTR_PREFIX "x"
205 #define V8PRIdPTR V8_PTR_PREFIX "d"
208 #if defined(__APPLE__) && defined(__MACH__)
210 #define V8PRIxPTR "lx"
213 #if (defined(__APPLE__) && defined(__MACH__)) || \
214 defined(__FreeBSD__) || defined(__OpenBSD__)
215 #define USING_BSD_ABI
241 #if V8_HOST_ARCH_64_BIT
287 #define OFFSET_OF(type, field) \
288 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4)
295 #define ARRAY_SIZE(a) \
296 ((sizeof(a) / sizeof(*(a))) / \
297 static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
302 template <
typename T>
307 #define FUNCTION_ADDR(f) \
308 (reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(f)))
313 template <
typename F>
315 return reinterpret_cast<F>(
reinterpret_cast<intptr_t
>(addr));
321 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
322 TypeName(const TypeName&); \
323 void operator=(const TypeName&)
332 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
334 DISALLOW_COPY_AND_ASSIGN(TypeName)
340 #if defined(__GNUC__) && !defined(DEBUG)
342 #define INLINE(header) inline header __attribute__((always_inline))
343 #define NO_INLINE(header) header __attribute__((noinline))
345 #define INLINE(header) inline __attribute__((always_inline)) header
346 #define NO_INLINE(header) __attribute__((noinline)) header
348 #elif defined(_MSC_VER) && !defined(DEBUG)
349 #define INLINE(header) __forceinline header
350 #define NO_INLINE(header) header
352 #define INLINE(header) inline header
353 #define NO_INLINE(header) header
357 #if defined(__GNUC__) && __GNUC__ >= 4
358 #define MUST_USE_RESULT __attribute__ ((warn_unused_result))
360 #define MUST_USE_RESULT
367 class FreeStoreAllocationPolicy;
368 template <
typename T,
class P = FreeStoreAllocationPolicy>
class List;
405 #endif // V8_GLOBALS_H_
const int kBinary32ExponentShift
const int kDoubleSizeLog2
const uint32_t kBinary32MantissaMask
const int kBinary32MaxExponent
const intptr_t kIntptrSignBit
const int kBitsPerPointer
const uint64_t kQuietNaNMask
const int kBinary32MantissaBits
const uint32_t kMaxAsciiCharCodeU
const int kBitsPerByteLog2
const int kPointerSizeLog2
const uintptr_t kUintptrAllBitsSet
const int kBinary32MinExponent
const int kBinary32ExponentBias
#define T(name, string, precedence)
const int kRandomStateSize
const uint32_t kBinary32ExponentMask
const uint32_t kBinary32SignMask
const uint32_t kMaxUInt32
const uc32 kMaxAsciiCharCode
F FUNCTION_CAST(Address addr)