31 #include "../include/v8stdint.h"
38 #if V8_CC_GNU && V8_GNUC_PREREQ(2, 96, 0) && !V8_GNUC_PREREQ(4, 1, 0)
40 # define V8_INFINITY std::numeric_limits<double>::infinity()
42 # define V8_INFINITY HUGE_VAL
44 # define V8_INFINITY INFINITY
54 #if defined(_M_X64) || defined(__x86_64__)
55 #if defined(__native_client__)
62 #define V8_HOST_ARCH_IA32 1
63 #define V8_HOST_ARCH_32_BIT 1
64 #define V8_HOST_CAN_READ_UNALIGNED 1
66 #define V8_HOST_ARCH_X64 1
67 #define V8_HOST_ARCH_64_BIT 1
68 #define V8_HOST_CAN_READ_UNALIGNED 1
69 #endif // __native_client__
70 #elif defined(_M_IX86) || defined(__i386__)
71 #define V8_HOST_ARCH_IA32 1
72 #define V8_HOST_ARCH_32_BIT 1
73 #define V8_HOST_CAN_READ_UNALIGNED 1
74 #elif defined(__AARCH64EL__)
75 #define V8_HOST_ARCH_ARM64 1
76 #define V8_HOST_ARCH_64_BIT 1
77 #define V8_HOST_CAN_READ_UNALIGNED 1
78 #elif defined(__ARMEL__)
79 #define V8_HOST_ARCH_ARM 1
80 #define V8_HOST_ARCH_32_BIT 1
81 #elif defined(__MIPSEL__)
82 #define V8_HOST_ARCH_MIPS 1
83 #define V8_HOST_ARCH_32_BIT 1
85 #error "Host architecture was not detected as supported by v8"
88 #if defined(__ARM_ARCH_7A__) || \
89 defined(__ARM_ARCH_7R__) || \
90 defined(__ARM_ARCH_7__)
91 # define CAN_USE_ARMV7_INSTRUCTIONS 1
92 # ifndef CAN_USE_VFP3_INSTRUCTIONS
93 # define CAN_USE_VFP3_INSTRUCTIONS
101 #if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && \
102 !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_ARM64 && !V8_TARGET_ARCH_MIPS
103 #if defined(_M_X64) || defined(__x86_64__)
104 #define V8_TARGET_ARCH_X64 1
105 #elif defined(_M_IX86) || defined(__i386__)
106 #define V8_TARGET_ARCH_IA32 1
107 #elif defined(__AARCH64EL__)
108 #define V8_TARGET_ARCH_ARM64 1
109 #elif defined(__ARMEL__)
110 #define V8_TARGET_ARCH_ARM 1
111 #elif defined(__MIPSEL__)
112 #define V8_TARGET_ARCH_MIPS 1
114 #error Target architecture was not detected as supported by v8
119 #if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32
120 #error Target architecture ia32 is only supported on ia32 host
122 #if V8_TARGET_ARCH_X64 && !V8_HOST_ARCH_X64
123 #error Target architecture x64 is only supported on x64 host
125 #if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM))
126 #error Target architecture arm is only supported on arm and ia32 host
128 #if (V8_TARGET_ARCH_ARM64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_ARM64))
129 #error Target architecture arm64 is only supported on arm64 and x64 host
131 #if (V8_TARGET_ARCH_MIPS && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_MIPS))
132 #error Target architecture mips is only supported on mips and ia32 host
138 #if !defined(USE_SIMULATOR)
139 #if (V8_TARGET_ARCH_ARM64 && !V8_HOST_ARCH_ARM64)
140 #define USE_SIMULATOR 1
142 #if (V8_TARGET_ARCH_ARM && !V8_HOST_ARCH_ARM)
143 #define USE_SIMULATOR 1
145 #if (V8_TARGET_ARCH_MIPS && !V8_HOST_ARCH_MIPS)
146 #define USE_SIMULATOR 1
151 #if V8_TARGET_ARCH_IA32
152 #define V8_TARGET_LITTLE_ENDIAN 1
153 #elif V8_TARGET_ARCH_X64
154 #define V8_TARGET_LITTLE_ENDIAN 1
155 #elif V8_TARGET_ARCH_ARM
156 #define V8_TARGET_LITTLE_ENDIAN 1
157 #elif V8_TARGET_ARCH_ARM64
158 #define V8_TARGET_LITTLE_ENDIAN 1
159 #elif V8_TARGET_ARCH_MIPS
160 #define V8_TARGET_LITTLE_ENDIAN 1
162 #error Unknown target architecture endiannes
166 #define V8_OOL_CONSTANT_POOL 0
181 typedef unsigned int __my_bool__;
182 #define bool __my_bool__ // use 'indirection' to avoid name clashes
192 # define V8_UINT64_C(x) (x ## UI64)
193 # define V8_INT64_C(x) (x ## I64)
194 # if V8_HOST_ARCH_64_BIT
195 # define V8_INTPTR_C(x) (x ## I64)
196 # define V8_PTR_PREFIX "ll"
198 # define V8_INTPTR_C(x) (x)
199 # define V8_PTR_PREFIX ""
200 # endif // V8_HOST_ARCH_64_BIT
202 # define V8_UINT64_C(x) (x ## ULL)
203 # define V8_INT64_C(x) (x ## LL)
204 # define V8_INTPTR_C(x) (x ## LL)
205 # define V8_PTR_PREFIX "I64"
206 #elif V8_HOST_ARCH_64_BIT
208 # define V8_UINT64_C(x) (x ## ULL)
209 # define V8_INT64_C(x) (x ## LL)
211 # define V8_UINT64_C(x) (x ## UL)
212 # define V8_INT64_C(x) (x ## L)
214 # define V8_INTPTR_C(x) (x ## L)
215 # define V8_PTR_PREFIX "l"
217 # define V8_UINT64_C(x) (x ## ULL)
218 # define V8_INT64_C(x) (x ## LL)
219 # define V8_INTPTR_C(x) (x)
220 # define V8_PTR_PREFIX ""
226 #define V8_2PART_UINT64_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u))
228 #define V8PRIxPTR V8_PTR_PREFIX "x"
229 #define V8PRIdPTR V8_PTR_PREFIX "d"
230 #define V8PRIuPTR V8_PTR_PREFIX "u"
235 #define V8PRIxPTR "lx"
238 #if V8_OS_MACOSX || defined(__FreeBSD__) || defined(__OpenBSD__)
239 #define USING_BSD_ABI
275 #if V8_HOST_ARCH_64_BIT
316 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1))
325 #define OFFSET_OF(type, field) \
326 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4)
333 #define ARRAY_SIZE(a) \
334 ((sizeof(a) / sizeof(*(a))) / \
335 static_cast<size_t>(!(sizeof(a) % sizeof(*(a)))))
340 template <
typename T>
345 #define FUNCTION_ADDR(f) \
346 (reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(f)))
351 template <
typename F>
353 return reinterpret_cast<F>(
reinterpret_cast<intptr_t
>(addr));
359 #define DISALLOW_COPY_AND_ASSIGN(TypeName) \
360 TypeName(const TypeName&) V8_DELETE; \
361 void operator=(const TypeName&) V8_DELETE
370 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
371 TypeName() V8_DELETE; \
372 DISALLOW_COPY_AND_ASSIGN(TypeName)
376 #define INLINE(declarator) V8_INLINE declarator
377 #define NO_INLINE(declarator) V8_NOINLINE declarator
381 #define MUST_USE_RESULT V8_WARN_UNUSED_RESULT
385 #if defined(__has_feature)
386 #if __has_feature(address_sanitizer)
387 #define DISABLE_ASAN __attribute__((no_sanitize_address))
397 #define V8_IMMEDIATE_CRASH() __builtin_trap()
399 #define V8_IMMEDIATE_CRASH() ((void(*)())0)()
407 class FreeStoreAllocationPolicy;
408 template <
typename T,
class P = FreeStoreAllocationPolicy>
class List;
420 #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 int kBitsPerByteLog2
const int kPointerSizeLog2
const uintptr_t kUintptrAllBitsSet
const int kBinary32MinExponent
const int kBinary32ExponentBias
#define T(name, string, precedence)
const uint32_t kBinary32ExponentMask
const uint32_t kBinary32SignMask
const uint32_t kMaxUInt32
F FUNCTION_CAST(Address addr)