OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. |
3 * Copyright (C) 2007-2009 Torch Mobile, Inc. | 3 * Copyright (C) 2007-2009 Torch Mobile, Inc. |
4 * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved. | 4 * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved. |
5 * | 5 * |
6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
8 * are met: | 8 * are met: |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 15 matching lines...) Expand all Loading... |
26 */ | 26 */ |
27 | 27 |
28 #ifndef WTF_Platform_h | 28 #ifndef WTF_Platform_h |
29 #define WTF_Platform_h | 29 #define WTF_Platform_h |
30 | 30 |
31 /* Include compiler specific macros */ | 31 /* Include compiler specific macros */ |
32 #include <wtf/Compiler.h> | 32 #include <wtf/Compiler.h> |
33 | 33 |
34 /* ==== Platform adaptation macros: these describe properties of the target envi
ronment. ==== */ | 34 /* ==== Platform adaptation macros: these describe properties of the target envi
ronment. ==== */ |
35 | 35 |
36 /* CPU() - the target CPU architecture */ | |
37 #define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATUR
E) | |
38 /* HAVE() - specific system features (headers, functions or similar) that are pr
esent or not */ | 36 /* HAVE() - specific system features (headers, functions or similar) that are pr
esent or not */ |
39 #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE) | 37 #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE) |
40 /* OS() - underlying operating system; only to be used for mandated low-level se
rvices like | 38 /* OS() - underlying operating system; only to be used for mandated low-level se
rvices like |
41 virtual memory, not to choose a GUI toolkit */ | 39 virtual memory, not to choose a GUI toolkit */ |
42 #define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE) | 40 #define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE) |
43 | 41 |
44 | |
45 /* ==== Policy decision macros: these define policy choices for a particular por
t. ==== */ | 42 /* ==== Policy decision macros: these define policy choices for a particular por
t. ==== */ |
46 | 43 |
47 /* USE() - use a particular third-party library or optional OS service */ | 44 /* USE() - use a particular third-party library or optional OS service */ |
48 #define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATUR
E) | 45 #define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATUR
E) |
49 /* ENABLE() - turn on a specific feature of WebKit */ | 46 /* ENABLE() - turn on a specific feature of WebKit */ |
50 #define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATU
RE) | 47 #define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATU
RE) |
51 | 48 |
52 | |
53 /* ==== CPU() - the target CPU architecture ==== */ | |
54 | |
55 /* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as approp
riate. */ | |
56 | |
57 /* CPU(ALPHA) - DEC Alpha */ | |
58 #if defined(__alpha__) | |
59 #define WTF_CPU_ALPHA 1 | |
60 #endif | |
61 | |
62 /* CPU(IA64) - Itanium / IA-64 */ | |
63 #if defined(__ia64__) | |
64 #define WTF_CPU_IA64 1 | |
65 #endif | |
66 | |
67 /* CPU(MIPS) - MIPS 32-bit */ | |
68 /* Note: Only O32 ABI is tested, so we enable it for O32 ABI for now. */ | |
69 #if (defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_)) \ | |
70 && defined(_ABIO32) | |
71 #define WTF_CPU_MIPS 1 | |
72 #if defined(__MIPSEB__) | |
73 #define WTF_CPU_BIG_ENDIAN 1 | |
74 #endif | |
75 /* MIPS requires allocators to use aligned memory */ | |
76 #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1 | |
77 #endif /* MIPS */ | |
78 | |
79 /* CPU(PPC) - PowerPC 32-bit */ | |
80 #if defined(__ppc__) \ | |
81 || defined(__PPC__) \ | |
82 || defined(__powerpc__) \ | |
83 || defined(__powerpc) \ | |
84 || defined(__POWERPC__) \ | |
85 || defined(_M_PPC) \ | |
86 || defined(__PPC) | |
87 #define WTF_CPU_PPC 1 | |
88 #define WTF_CPU_BIG_ENDIAN 1 | |
89 #endif | |
90 | |
91 /* CPU(PPC64) - PowerPC 64-bit */ | |
92 #if defined(__ppc64__) \ | |
93 || defined(__PPC64__) | |
94 #define WTF_CPU_PPC64 1 | |
95 #define WTF_CPU_BIG_ENDIAN 1 | |
96 #endif | |
97 | |
98 /* CPU(SH4) - SuperH SH-4 */ | |
99 #if defined(__SH4__) | |
100 #define WTF_CPU_SH4 1 | |
101 #endif | |
102 | |
103 /* CPU(SPARC32) - SPARC 32-bit */ | |
104 #if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8) | |
105 #define WTF_CPU_SPARC32 1 | |
106 #define WTF_CPU_BIG_ENDIAN 1 | |
107 #endif | |
108 | |
109 /* CPU(SPARC64) - SPARC 64-bit */ | |
110 #if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9) | |
111 #define WTF_CPU_SPARC64 1 | |
112 #define WTF_CPU_BIG_ENDIAN 1 | |
113 #endif | |
114 | |
115 /* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */ | |
116 #if CPU(SPARC32) || CPU(SPARC64) | |
117 #define WTF_CPU_SPARC 1 | |
118 #endif | |
119 | |
120 /* CPU(S390X) - S390 64-bit */ | |
121 #if defined(__s390x__) | |
122 #define WTF_CPU_S390X 1 | |
123 #define WTF_CPU_BIG_ENDIAN 1 | |
124 #endif | |
125 | |
126 /* CPU(S390) - S390 32-bit */ | |
127 #if defined(__s390__) | |
128 #define WTF_CPU_S390 1 | |
129 #define WTF_CPU_BIG_ENDIAN 1 | |
130 #endif | |
131 | |
132 /* CPU(X86) - i386 / x86 32-bit */ | |
133 #if defined(__i386__) \ | |
134 || defined(i386) \ | |
135 || defined(_M_IX86) \ | |
136 || defined(_X86_) \ | |
137 || defined(__THW_INTEL) | |
138 #define WTF_CPU_X86 1 | |
139 #endif | |
140 | |
141 /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */ | |
142 #if defined(__x86_64__) \ | |
143 || defined(_M_X64) | |
144 #define WTF_CPU_X86_64 1 | |
145 #endif | |
146 | |
147 /* CPU(ARM) - ARM, any version*/ | |
148 #define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && defined(WTF_ARM_ARCH_VERSION) && W
TF_ARM_ARCH_VERSION >= N) | |
149 | |
150 #if defined(arm) \ | |
151 || defined(__arm__) \ | |
152 || defined(ARM) \ | |
153 || defined(_ARM_) | |
154 #define WTF_CPU_ARM 1 | |
155 | |
156 #if defined(__ARMEB__) | |
157 #define WTF_CPU_BIG_ENDIAN 1 | |
158 | |
159 #elif !defined(__ARM_EABI__) \ | |
160 && !defined(__EABI__) \ | |
161 && !defined(__VFP_FP__) \ | |
162 && !defined(_WIN32_WCE) \ | |
163 && !defined(ANDROID) | |
164 #define WTF_CPU_MIDDLE_ENDIAN 1 | |
165 | |
166 #endif | |
167 | |
168 /* Set WTF_ARM_ARCH_VERSION */ | |
169 #if defined(__ARM_ARCH_4__) \ | |
170 || defined(__ARM_ARCH_4T__) \ | |
171 || defined(__MARM_ARMV4__) | |
172 #define WTF_ARM_ARCH_VERSION 4 | |
173 | |
174 #elif defined(__ARM_ARCH_5__) \ | |
175 || defined(__ARM_ARCH_5T__) \ | |
176 || defined(__MARM_ARMV5__) | |
177 #define WTF_ARM_ARCH_VERSION 5 | |
178 | |
179 #elif defined(__ARM_ARCH_5E__) \ | |
180 || defined(__ARM_ARCH_5TE__) \ | |
181 || defined(__ARM_ARCH_5TEJ__) | |
182 #define WTF_ARM_ARCH_VERSION 5 | |
183 /*ARMv5TE requires allocators to use aligned memory*/ | |
184 #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1 | |
185 | |
186 #elif defined(__ARM_ARCH_6__) \ | |
187 || defined(__ARM_ARCH_6J__) \ | |
188 || defined(__ARM_ARCH_6K__) \ | |
189 || defined(__ARM_ARCH_6Z__) \ | |
190 || defined(__ARM_ARCH_6ZK__) \ | |
191 || defined(__ARM_ARCH_6T2__) \ | |
192 || defined(__ARMV6__) | |
193 #define WTF_ARM_ARCH_VERSION 6 | |
194 | |
195 #elif defined(__ARM_ARCH_7A__) \ | |
196 || defined(__ARM_ARCH_7R__) \ | |
197 || defined(__ARM_ARCH_7S__) | |
198 #define WTF_ARM_ARCH_VERSION 7 | |
199 | |
200 /* MSVC sets _M_ARM */ | |
201 #elif defined(_M_ARM) | |
202 #define WTF_ARM_ARCH_VERSION _M_ARM | |
203 #else | |
204 #define WTF_ARM_ARCH_VERSION 0 | |
205 | |
206 #endif | |
207 | |
208 /* Set WTF_THUMB_ARCH_VERSION */ | |
209 #if defined(__ARM_ARCH_4T__) | |
210 #define WTF_THUMB_ARCH_VERSION 1 | |
211 | |
212 #elif defined(__ARM_ARCH_5T__) \ | |
213 || defined(__ARM_ARCH_5TE__) \ | |
214 || defined(__ARM_ARCH_5TEJ__) | |
215 #define WTF_THUMB_ARCH_VERSION 2 | |
216 | |
217 #elif defined(__ARM_ARCH_6J__) \ | |
218 || defined(__ARM_ARCH_6K__) \ | |
219 || defined(__ARM_ARCH_6Z__) \ | |
220 || defined(__ARM_ARCH_6ZK__) \ | |
221 || defined(__ARM_ARCH_6M__) | |
222 #define WTF_THUMB_ARCH_VERSION 3 | |
223 | |
224 #elif defined(__ARM_ARCH_6T2__) \ | |
225 || defined(__ARM_ARCH_7__) \ | |
226 || defined(__ARM_ARCH_7A__) \ | |
227 || defined(__ARM_ARCH_7M__) \ | |
228 || defined(__ARM_ARCH_7R__) \ | |
229 || defined(__ARM_ARCH_7S__) | |
230 #define WTF_THUMB_ARCH_VERSION 4 | |
231 | |
232 #else | |
233 #define WTF_THUMB_ARCH_VERSION 0 | |
234 #endif | |
235 | |
236 | |
237 /* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or g
reater) */ | |
238 /* CPU(ARM_THUMB2) - Thumb2 instruction set is available */ | |
239 /* Only one of these will be defined. */ | |
240 #if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) | |
241 # if defined(thumb2) || defined(__thumb2__) \ | |
242 || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4) | |
243 # define WTF_CPU_ARM_TRADITIONAL 0 | |
244 # define WTF_CPU_ARM_THUMB2 1 | |
245 # elif WTF_ARM_ARCH_AT_LEAST(4) | |
246 # define WTF_CPU_ARM_TRADITIONAL 1 | |
247 # define WTF_CPU_ARM_THUMB2 0 | |
248 # else | |
249 # error "Not supported ARM architecture" | |
250 # endif | |
251 #elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */ | |
252 # error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 plat
forms" | |
253 #endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */ | |
254 | |
255 #if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON) | |
256 #define WTF_CPU_ARM_NEON 1 | |
257 #endif | |
258 | |
259 #if CPU(ARM_NEON) && (!COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 7, 0)) | |
260 // All NEON intrinsics usage can be disabled by this macro. | |
261 #define HAVE_ARM_NEON_INTRINSICS 1 | |
262 #endif | |
263 | |
264 #if defined(__ARM_ARCH_7S__) | |
265 #define WTF_CPU_APPLE_ARMV7S 1 | |
266 #endif | |
267 | |
268 #endif /* ARM */ | |
269 | |
270 /* ==== OS() - underlying operating system; only to be used for mandated low-lev
el services like | 49 /* ==== OS() - underlying operating system; only to be used for mandated low-lev
el services like |
271 virtual memory, not to choose a GUI toolkit ==== */ | 50 virtual memory, not to choose a GUI toolkit ==== */ |
272 | 51 |
273 /* OS(ANDROID) - Android */ | 52 /* OS(ANDROID) - Android */ |
274 #ifdef ANDROID | 53 #ifdef ANDROID |
275 #define WTF_OS_ANDROID 1 | 54 #define WTF_OS_ANDROID 1 |
276 #endif | 55 #endif |
277 | 56 |
278 /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */ | 57 /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */ |
279 #ifdef __APPLE__ | 58 #ifdef __APPLE__ |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
406 #endif /* OS(DARWIN) */ | 185 #endif /* OS(DARWIN) */ |
407 | 186 |
408 #if OS(WINDOWS) | 187 #if OS(WINDOWS) |
409 #define HAVE_SYS_TIMEB_H 1 | 188 #define HAVE_SYS_TIMEB_H 1 |
410 #define HAVE_ALIGNED_MALLOC 1 | 189 #define HAVE_ALIGNED_MALLOC 1 |
411 #define HAVE_ISDEBUGGERPRESENT 1 | 190 #define HAVE_ISDEBUGGERPRESENT 1 |
412 #define HAVE_VIRTUALALLOC 1 | 191 #define HAVE_VIRTUALALLOC 1 |
413 #endif | 192 #endif |
414 | 193 |
415 #endif /* WTF_Platform_h */ | 194 #endif /* WTF_Platform_h */ |
OLD | NEW |