AArch64 support
[platform/upstream/js.git] / js / src / assembler / wtf / Platform.h
1 /*
2  * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc.  All rights reserved.
3  * Copyright (C) 2007-2009 Torch Mobile, Inc.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25  */
26
27 #ifndef WTF_Platform_h
28 #define WTF_Platform_h
29
30 /* Either XX(YY) --> WTF_XX_YY  or  XX(YY) --> XX_YY, depending on XX
31
32    PLATFORM(YY) --> WTF_PLATFORM_YY
33    COMPILER(YY) --> WTF_COMPILER_YY
34    CPU(YY)      --> WTF_CPU_YY
35    OS(YY)       --> WTF_OS_YY
36    USE(YY)      --> WTF_USE_YY
37
38    HAVE(YY)     --> HAVE_YY
39    ENABLE(YY)   --> ENABLE_YY
40 */
41
42 /* ==== PLATFORM handles OS, operating environment, graphics API, and
43    CPU. This macro will be phased out in favor of platform adaptation
44    macros, policy decision macros, and top-level port definitions. ==== */
45 //#define PLATFORM(WTF_FEATURE) (defined(WTF_PLATFORM_##WTF_FEATURE)  && WTF_PLATFORM_##WTF_FEATURE)
46
47
48 /* ==== Platform adaptation macros: these describe properties of the target environment. ==== */
49
50 /* COMPILER() - the compiler being used to build the project */
51 //#define COMPILER(WTF_FEATURE) (defined(WTF_COMPILER_##WTF_FEATURE)  && WTF_COMPILER_##WTF_FEATURE)
52 /* CPU() - the target CPU architecture */
53 //#define CPU(WTF_FEATURE) (defined(WTF_CPU_##WTF_FEATURE)  && WTF_CPU_##WTF_FEATURE)
54 /* HAVE() - specific system features (headers, functions or similar) that are present or not */
55 //#define HAVE(WTF_FEATURE) (defined(HAVE_##WTF_FEATURE)  && HAVE_##WTF_FEATURE)
56 /* OS() - underlying operating system; only to be used for mandated low-level services like 
57    virtual memory, not to choose a GUI toolkit */
58 //#define OS(WTF_FEATURE) (defined(WTF_OS_##WTF_FEATURE)  && WTF_OS_##WTF_FEATURE)
59
60
61 /* ==== Policy decision macros: these define policy choices for a particular port. ==== */
62
63 /* USE() - use a particular third-party library or optional OS service */
64 //#define USE(WTF_FEATURE) (defined(WTF_USE_##WTF_FEATURE)  && WTF_USE_##WTF_FEATURE)
65 /* ENABLE() - turn on a specific feature of WebKit */
66 //#define ENABLE(WTF_FEATURE) (defined(ENABLE_##WTF_FEATURE)  && ENABLE_##WTF_FEATURE)
67
68
69
70 /* ==== COMPILER() - the compiler being used to build the project ==== */
71
72 /* COMPILER(MSVC) Microsoft Visual C++ */
73 /* COMPILER(MSVC7) Microsoft Visual C++ v7 or lower*/
74 #if defined(_MSC_VER)
75 #define WTF_COMPILER_MSVC 1
76 #if _MSC_VER < 1400
77 #define WTF_COMPILER_MSVC7 1
78 #endif
79 #endif
80
81 /* COMPILER(RVCT)  - ARM RealView Compilation Tools */
82 #if defined(__CC_ARM) || defined(__ARMCC__)
83 #define WTF_COMPILER_RVCT 1
84 #endif
85
86 /* COMPILER(GCC) - GNU Compiler Collection */
87 /* --gnu option of the RVCT compiler also defines __GNUC__ */
88 #if defined(__GNUC__) && !WTF_COMPILER_RVCT
89 #define WTF_COMPILER_GCC 1
90 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 + __GNUC_PATCHLEVEL__)
91 #endif
92
93 /* COMPILER(MINGW) - MinGW GCC */
94 #if defined(MINGW) || defined(__MINGW32__)
95 #define WTF_COMPILER_MINGW 1
96 #endif
97
98 /* COMPILER(WINSCW) - CodeWarrior for Symbian emulator */
99 #if defined(__WINSCW__)
100 #define WTF_COMPILER_WINSCW 1
101 #endif
102
103 /* COMPILER(SUNPRO) - Sun Studio for Solaris */
104 #if defined(__SUNPRO_C) || defined(__SUNPRO_CC)
105 #define WTF_COMPILER_SUNPRO 1
106 #endif
107
108
109 /* ==== CPU() - the target CPU architecture ==== */
110
111 /* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */
112
113
114 /* CPU(ALPHA) - DEC Alpha */
115 #if defined(__alpha__)
116 #define WTF_CPU_ALPHA 1
117 #endif
118
119 /* CPU(IA64) - Itanium / IA-64 */
120 #if defined(__ia64__)
121 #define WTF_CPU_IA64 1
122 #endif
123
124 /* CPU(PPC) - PowerPC 32-bit */
125 #if   defined(__ppc__)     \
126    || defined(__PPC__)     \
127    || defined(__powerpc__) \
128    || defined(__powerpc)   \
129    || defined(__POWERPC__) \
130    || defined(_M_PPC)      \
131    || defined(__PPC)
132 #define WTF_CPU_PPC 1
133 #define WTF_CPU_BIG_ENDIAN 1
134 #endif
135
136 /* CPU(PPC64) - PowerPC 64-bit */
137 #if   defined(__ppc64__) \
138    || defined(__PPC64__)
139 #define WTF_CPU_PPC64 1
140 #define WTF_CPU_BIG_ENDIAN 1
141 #endif
142
143 /* CPU(SH4) - SuperH SH-4 */
144 #if defined(__SH4__)
145 #define WTF_CPU_SH4 1
146 #endif
147
148 /* CPU(SPARC32) - SPARC 32-bit */
149 #if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8)
150 #define WTF_CPU_SPARC32 1
151 #define WTF_CPU_BIG_ENDIAN 1
152 #endif
153
154 /* CPU(SPARC64) - SPARC 64-bit */
155 #if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9)
156 #define WTF_CPU_SPARC64 1
157 #define WTF_CPU_BIG_ENDIAN 1
158 #endif
159
160 /* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */
161 #if WTF_CPU_SPARC32 || WTF_CPU_SPARC64
162 #define WTF_CPU_SPARC
163 #endif
164
165 /* CPU(X86) - i386 / x86 32-bit */
166 #if   defined(__i386__) \
167    || defined(i386)     \
168    || defined(_M_IX86)  \
169    || defined(_X86_)    \
170    || defined(__THW_INTEL)
171 #define WTF_CPU_X86 1
172 #endif
173
174 /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */
175 #if   defined(__x86_64__) \
176    || defined(_M_X64)
177 #define WTF_CPU_X86_64 1
178 #endif
179
180 /* CPU(ARM) - ARM, any version*/
181 #if   defined(arm) \
182    || defined(__arm__)
183 #define WTF_CPU_ARM 1
184
185 #if defined(__ARMEB__)
186 #define WTF_CPU_BIG_ENDIAN 1
187
188 #elif !defined(__ARM_EABI__) \
189    && !defined(__EABI__) \
190    && !defined(__VFP_FP__) \
191    && !defined(ANDROID)
192 #define WTF_CPU_MIDDLE_ENDIAN 1
193
194 #endif
195
196 #define WTF_ARM_ARCH_AT_LEAST(N) (WTF_CPU_ARM && WTF_ARM_ARCH_VERSION >= N)
197
198 /* Set WTF_ARM_ARCH_VERSION */
199 #if   defined(__ARM_ARCH_4__) \
200    || defined(__ARM_ARCH_4T__) \
201    || defined(__MARM_ARMV4__) \
202    || defined(_ARMV4I_)
203 #define WTF_ARM_ARCH_VERSION 4
204
205 #elif defined(__ARM_ARCH_5__) \
206    || defined(__ARM_ARCH_5T__) \
207    || defined(__ARM_ARCH_5E__) \
208    || defined(__ARM_ARCH_5TE__) \
209    || defined(__ARM_ARCH_5TEJ__) \
210    || defined(__MARM_ARMV5__)
211 #define WTF_ARM_ARCH_VERSION 5
212
213 #elif defined(__ARM_ARCH_6__) \
214    || defined(__ARM_ARCH_6J__) \
215    || defined(__ARM_ARCH_6K__) \
216    || defined(__ARM_ARCH_6Z__) \
217    || defined(__ARM_ARCH_6ZK__) \
218    || defined(__ARM_ARCH_6T2__) \
219    || defined(__ARMV6__)
220 #define WTF_ARM_ARCH_VERSION 6
221
222 #elif defined(__ARM_ARCH_7A__) \
223    || defined(__ARM_ARCH_7R__)
224 #define WTF_ARM_ARCH_VERSION 7
225
226 /* RVCT sets _TARGET_ARCH_ARM */
227 #elif defined(__TARGET_ARCH_ARM)
228 #define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM
229
230 #else
231 #define WTF_ARM_ARCH_VERSION 0
232
233 #endif
234
235 /* Set WTF_THUMB_ARCH_VERSION */
236 #if   defined(__ARM_ARCH_4T__)
237 #define WTF_THUMB_ARCH_VERSION 1
238
239 #elif defined(__ARM_ARCH_5T__) \
240    || defined(__ARM_ARCH_5TE__) \
241    || defined(__ARM_ARCH_5TEJ__)
242 #define WTF_THUMB_ARCH_VERSION 2
243
244 #elif defined(__ARM_ARCH_6J__) \
245    || defined(__ARM_ARCH_6K__) \
246    || defined(__ARM_ARCH_6Z__) \
247    || defined(__ARM_ARCH_6ZK__) \
248    || defined(__ARM_ARCH_6M__)
249 #define WTF_THUMB_ARCH_VERSION 3
250
251 #elif defined(__ARM_ARCH_6T2__) \
252    || defined(__ARM_ARCH_7__) \
253    || defined(__ARM_ARCH_7A__) \
254    || defined(__ARM_ARCH_7R__) \
255    || defined(__ARM_ARCH_7M__)
256 #define WTF_THUMB_ARCH_VERSION 4
257
258 /* RVCT sets __TARGET_ARCH_THUMB */
259 #elif defined(__TARGET_ARCH_THUMB)
260 #define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB
261
262 #else
263 #define WTF_THUMB_ARCH_VERSION 0
264 #endif
265
266
267 /* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */
268 /* On ARMv5 and below the natural alignment is required. 
269    And there are some other differences for v5 or earlier. */
270 #if !defined(ARMV5_OR_LOWER) /* && !CPU_ARM_ARCH_AT_LEAST(6) */
271 #define WTF_CPU_ARMV5_OR_LOWER 1
272 #endif
273
274
275 /* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */
276 /* CPU(ARM_THUMB2) - Thumb2 instruction set is available */
277 /* Only one of these will be defined. */
278 #if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2)
279 #  if defined(thumb2) || defined(__thumb2__) \
280   || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4)
281 #    define WTF_CPU_ARM_TRADITIONAL 1
282 #    define WTF_CPU_ARM_THUMB2 0
283 #  elif WTF_ARM_ARCH_AT_LEAST(4)
284 #    define WTF_CPU_ARM_TRADITIONAL 1
285 #    define WTF_CPU_ARM_THUMB2 0
286 #  else
287 #    error "Not supported ARM architecture"
288 #  endif
289 #elif WTF_CPU_ARM_TRADITIONAL && WTF_CPU_ARM_THUMB2 /* Sanity Check */
290 #  error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms"
291 #endif // !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2)
292
293 #endif /* ARM */
294
295 /* CPU(AArch64) - 64-bit ARM */
296 #if defined(__aarch64__)
297 #define WTF_CPU_AARCH64 1
298 #endif
299
300
301 /* Operating systems - low-level dependencies */
302
303 /* PLATFORM(DARWIN) */
304 /* Operating system level dependencies for Mac OS X / Darwin that should */
305 /* be used regardless of operating environment */
306 #ifdef __APPLE__
307 #define WTF_PLATFORM_DARWIN 1
308 #include <AvailabilityMacros.h>
309 #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_5
310 #define BUILDING_ON_TIGER 1
311 #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_6
312 #define BUILDING_ON_LEOPARD 1
313 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_7
314 #define BUILDING_ON_SNOW_LEOPARD 1
315 #endif
316 #if !defined(MAC_OS_X_VERSION_10_5) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5
317 #define TARGETING_TIGER 1
318 #elif !defined(MAC_OS_X_VERSION_10_6) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_6
319 #define TARGETING_LEOPARD 1
320 #elif !defined(MAC_OS_X_VERSION_10_7) || MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_7
321 #define TARGETING_SNOW_LEOPARD 1
322 #endif
323 #include <TargetConditionals.h>
324 #endif
325
326 /* PLATFORM(WIN_OS) */
327 /* Operating system level dependencies for Windows that should be used */
328 /* regardless of operating environment */
329 #if defined(WIN32) || defined(_WIN32)
330 #define WTF_PLATFORM_WIN_OS 1
331 #endif
332
333 /* PLATFORM(WINCE) */
334 /* Operating system level dependencies for Windows CE that should be used */
335 /* regardless of operating environment */
336 /* Note that for this platform PLATFORM(WIN_OS) is also defined. */
337 #if defined(_WIN32_WCE)
338 #define WTF_PLATFORM_WINCE 1
339 #endif
340
341 /* PLATFORM(LINUX) */
342 /* Operating system level dependencies for Linux-like systems that */
343 /* should be used regardless of operating environment */
344 #ifdef __linux__
345 #define WTF_PLATFORM_LINUX 1
346 #endif
347
348 /* PLATFORM(FREEBSD) */
349 /* Operating system level dependencies for FreeBSD-like systems that */
350 /* should be used regardless of operating environment */
351 #ifdef __FreeBSD__
352 #define WTF_PLATFORM_FREEBSD 1
353 #endif
354
355 /* PLATFORM(OPENBSD) */
356 /* Operating system level dependencies for OpenBSD systems that */
357 /* should be used regardless of operating environment */
358 #ifdef __OpenBSD__
359 #define WTF_PLATFORM_OPENBSD 1
360 #endif
361
362 /* PLATFORM(SOLARIS) */
363 /* Operating system level dependencies for Solaris that should be used */
364 /* regardless of operating environment */
365 #if defined(sun) || defined(__sun)
366 #define WTF_PLATFORM_SOLARIS 1
367 #endif
368
369 /* PLATFORM(OS2) */
370 /* Operating system level dependencies for OS/2 that should be used */
371 /* regardless of operating environment */
372 #if defined(OS2) || defined(__OS2__)
373 #define WTF_PLATFORM_OS2 1
374 #endif
375
376 #if defined (__SYMBIAN32__)
377 /* we are cross-compiling, it is not really windows */
378 #undef WTF_PLATFORM_WIN_OS
379 #undef WTF_PLATFORM_WIN
380 #define WTF_PLATFORM_SYMBIAN 1
381 #endif
382
383
384 /* PLATFORM(NETBSD) */
385 /* Operating system level dependencies for NetBSD that should be used */
386 /* regardless of operating environment */
387 #if defined(__NetBSD__)
388 #define WTF_PLATFORM_NETBSD 1
389 #endif
390
391 /* PLATFORM(QNX) */
392 /* Operating system level dependencies for QNX that should be used */
393 /* regardless of operating environment */
394 #if defined(__QNXNTO__)
395 #define WTF_PLATFORM_QNX 1
396 #endif
397
398 /* PLATFORM(UNIX) */
399 /* Operating system level dependencies for Unix-like systems that */
400 /* should be used regardless of operating environment */
401 #if   WTF_PLATFORM_DARWIN     \
402    || WTF_PLATFORM_FREEBSD    \
403    || WTF_PLATFORM_SYMBIAN    \
404    || WTF_PLATFORM_NETBSD     \
405    || defined(unix)        \
406    || defined(__unix)      \
407    || defined(__unix__)    \
408    || defined(_AIX)        \
409    || defined(__HAIKU__)   \
410    || defined(__QNXNTO__)  \
411    || defined(ANDROID)
412 #define WTF_PLATFORM_UNIX 1
413 #endif
414
415 /* Operating environments */
416
417 /* PLATFORM(CHROMIUM) */
418 /* PLATFORM(QT) */
419 /* PLATFORM(WX) */
420 /* PLATFORM(GTK) */
421 /* PLATFORM(HAIKU) */
422 /* PLATFORM(MAC) */
423 /* PLATFORM(WIN) */
424 #if defined(BUILDING_CHROMIUM__)
425 #define WTF_PLATFORM_CHROMIUM 1
426 #elif defined(BUILDING_QT__)
427 #define WTF_PLATFORM_QT 1
428 #elif defined(BUILDING_WX__)
429 #define WTF_PLATFORM_WX 1
430 #elif defined(BUILDING_GTK__)
431 #define WTF_PLATFORM_GTK 1
432 #elif defined(BUILDING_HAIKU__)
433 #define WTF_PLATFORM_HAIKU 1
434 #elif WTF_PLATFORM_DARWIN
435 #define WTF_PLATFORM_MAC 1
436 #elif WTF_PLATFORM_WIN_OS
437 #define WTF_PLATFORM_WIN 1
438 #endif
439
440 /* PLATFORM(IPHONE) */
441 #if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE)
442 #define WTF_PLATFORM_IPHONE 1
443 #endif
444
445 /* PLATFORM(IPHONE_SIMULATOR) */
446 #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR
447 #define WTF_PLATFORM_IPHONE 1
448 #define WTF_PLATFORM_IPHONE_SIMULATOR 1
449 #else
450 #define WTF_PLATFORM_IPHONE_SIMULATOR 0
451 #endif
452
453 #if !defined(WTF_PLATFORM_IPHONE)
454 #define WTF_PLATFORM_IPHONE 0
455 #endif
456
457 /* PLATFORM(ANDROID) */
458 #if defined(ANDROID)
459 #define WTF_PLATFORM_ANDROID 1
460 #endif
461
462 /* Graphics engines */
463
464 /* PLATFORM(CG) and PLATFORM(CI) */
465 #if WTF_PLATFORM_MAC || WTF_PLATFORM_IPHONE
466 #define WTF_PLATFORM_CG 1
467 #endif
468 #if WTF_PLATFORM_MAC && !WTF_PLATFORM_IPHONE
469 #define WTF_PLATFORM_CI 1
470 #endif
471
472 /* PLATFORM(SKIA) for Win/Linux, CG/CI for Mac */
473 #if WTF_PLATFORM_CHROMIUM
474 #if WTF_PLATFORM_DARWIN
475 #define WTF_PLATFORM_CG 1
476 #define WTF_PLATFORM_CI 1
477 #define WTF_USE_ATSUI 1
478 #define WTF_USE_CORE_TEXT 1
479 #else
480 #define WTF_PLATFORM_SKIA 1
481 #endif
482 #endif
483
484 #if WTF_PLATFORM_GTK
485 #define WTF_PLATFORM_CAIRO 1
486 #endif
487
488
489 /* PLATFORM(WINCE) && PLATFORM(QT)
490    We can not determine the endianess at compile time. For
491    Qt for Windows CE the endianess is specified in the
492    device specific makespec
493 */
494 #if WTF_PLATFORM_WINCE && WTF_PLATFORM_QT
495 #   include <QtGlobal>
496 #   undef WTF_PLATFORM_BIG_ENDIAN
497 #   undef WTF_PLATFORM_MIDDLE_ENDIAN
498 #   if Q_BYTE_ORDER == Q_BIG_EDIAN
499 #       define WTF_PLATFORM_BIG_ENDIAN 1
500 #   endif
501
502 #   include <ce_time.h>
503 #endif
504
505 #if (WTF_PLATFORM_IPHONE || WTF_PLATFORM_MAC || WTF_PLATFORM_WIN || WTF_PLATFORM_OS2 || (WTF_PLATFORM_QT && WTF_PLATFORM_DARWIN && !ENABLE_SINGLE_THREADED)) && !defined(ENABLE_JSC_MULTIPLE_THREADS)
506 #define ENABLE_JSC_MULTIPLE_THREADS 1
507 #endif
508
509 /* On Windows, use QueryPerformanceCounter by default */
510 #if WTF_PLATFORM_WIN_OS
511 #define WTF_USE_QUERY_PERFORMANCE_COUNTER  1
512 #endif
513
514 #if WTF_PLATFORM_WINCE && !WTF_PLATFORM_QT
515 #undef ENABLE_JSC_MULTIPLE_THREADS
516 #define ENABLE_JSC_MULTIPLE_THREADS        0
517 #define USE_SYSTEM_MALLOC                  0
518 #define ENABLE_ICONDATABASE                0
519 #define ENABLE_JAVASCRIPT_DEBUGGER         0
520 #define ENABLE_FTPDIR                      0
521 #define ENABLE_PAN_SCROLLING               0
522 #define ENABLE_WML                         1
523 #define HAVE_ACCESSIBILITY                 0
524
525 #define NOMINMAX       // Windows min and max conflict with standard macros
526 #define NOSHLWAPI      // shlwapi.h not available on WinCe
527
528 // MSDN documentation says these functions are provided with uspce.lib.  But we cannot find this file.
529 #define __usp10__      // disable "usp10.h"
530
531 #define _INC_ASSERT    // disable "assert.h"
532 #define assert(x)
533
534 // _countof is only included in CE6; for CE5 we need to define it ourself
535 #ifndef _countof
536 #define _countof(x) (sizeof(x) / sizeof((x)[0]))
537 #endif
538
539 #endif  /* PLATFORM(WINCE) && !PLATFORM(QT) */
540
541 #if WTF_PLATFORM_QT
542 #define WTF_USE_QT4_UNICODE 1
543 #elif WTF_PLATFORM_WINCE
544 #define WTF_USE_WINCE_UNICODE 1
545 #elif WTF_PLATFORM_GTK
546 /* The GTK+ Unicode backend is configurable */
547 #else
548 #define WTF_USE_ICU_UNICODE 1
549 #endif
550
551 #if WTF_PLATFORM_MAC && !WTF_PLATFORM_IPHONE
552 #define WTF_PLATFORM_CF 1
553 #define WTF_USE_PTHREADS 1
554 #define HAVE_PTHREAD_RWLOCK 1
555 #if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_TIGER) && WTF_CPU_X86_64
556 #define WTF_USE_PLUGIN_HOST_PROCESS 1
557 #endif
558 #if !defined(ENABLE_MAC_JAVA_BRIDGE)
559 #define ENABLE_MAC_JAVA_BRIDGE 1
560 #endif
561 #if !defined(ENABLE_DASHBOARD_SUPPORT)
562 #define ENABLE_DASHBOARD_SUPPORT 1
563 #endif
564 #define HAVE_READLINE 1
565 #define HAVE_RUNLOOP_TIMER 1
566 #endif /* PLATFORM(MAC) && !PLATFORM(IPHONE) */
567
568 #if WTF_PLATFORM_CHROMIUM && WTF_PLATFORM_DARWIN
569 #define WTF_PLATFORM_CF 1
570 #define WTF_USE_PTHREADS 1
571 #define HAVE_PTHREAD_RWLOCK 1
572 #endif
573
574 #if WTF_PLATFORM_QT && WTF_PLATFORM_DARWIN
575 #define WTF_PLATFORM_CF 1
576 #endif
577
578 #if WTF_PLATFORM_IPHONE
579 #define ENABLE_CONTEXT_MENUS 0
580 #define ENABLE_DRAG_SUPPORT 0
581 #define ENABLE_FTPDIR 1
582 #define ENABLE_GEOLOCATION 1
583 #define ENABLE_ICONDATABASE 0
584 #define ENABLE_INSPECTOR 0
585 #define ENABLE_MAC_JAVA_BRIDGE 0
586 #define ENABLE_NETSCAPE_PLUGIN_API 0
587 #define ENABLE_ORIENTATION_EVENTS 1
588 #define ENABLE_REPAINT_THROTTLING 1
589 #define HAVE_READLINE 1
590 #define WTF_PLATFORM_CF 1
591 #define WTF_USE_PTHREADS 1
592 #define HAVE_PTHREAD_RWLOCK 1
593 #endif
594
595 #if WTF_PLATFORM_ANDROID
596 #define WTF_USE_PTHREADS 1
597 #define WTF_PLATFORM_SGL 1
598 #define USE_SYSTEM_MALLOC 1
599 #define ENABLE_MAC_JAVA_BRIDGE 1
600 #define LOG_DISABLED 1
601 // Prevents Webkit from drawing the caret in textfields and textareas
602 // This prevents unnecessary invals.
603 #define ENABLE_TEXT_CARET 1
604 #define ENABLE_JAVASCRIPT_DEBUGGER 0
605 #endif
606
607 #if WTF_PLATFORM_WIN
608 #define WTF_USE_WININET 1
609 #endif
610
611 #if WTF_PLATFORM_WX
612 #define ENABLE_ASSEMBLER 1
613 #if WTF_PLATFORM_DARWIN
614 #define WTF_PLATFORM_CF 1
615 #endif
616 #endif
617
618 #if WTF_PLATFORM_GTK
619 #if HAVE_PTHREAD_H
620 #define WTF_USE_PTHREADS 1
621 #define HAVE_PTHREAD_RWLOCK 1
622 #endif
623 #endif
624
625 #if WTF_PLATFORM_HAIKU
626 #define HAVE_POSIX_MEMALIGN 1
627 #define WTF_USE_CURL 1
628 #define WTF_USE_PTHREADS 1
629 #define HAVE_PTHREAD_RWLOCK 1
630 #define USE_SYSTEM_MALLOC 1
631 #define ENABLE_NETSCAPE_PLUGIN_API 0
632 #endif
633
634 #if !defined(HAVE_ACCESSIBILITY)
635 #if WTF_PLATFORM_IPHONE || WTF_PLATFORM_MAC || WTF_PLATFORM_WIN || WTF_PLATFORM_GTK || WTF_PLATFORM_CHROMIUM
636 #define HAVE_ACCESSIBILITY 1
637 #endif
638 #endif /* !defined(HAVE_ACCESSIBILITY) */
639
640 #if WTF_PLATFORM_UNIX && !WTF_PLATFORM_SYMBIAN
641 #define HAVE_SIGNAL_H 1
642 #endif
643
644 #if !WTF_PLATFORM_WIN_OS && !WTF_PLATFORM_SOLARIS && !WTF_PLATFORM_QNX \
645     && !WTF_PLATFORM_SYMBIAN && !WTF_PLATFORM_HAIKU && !WTF_COMPILER_RVCT \
646     && !WTF_PLATFORM_ANDROID && !WTF_PLATFORM_OS2
647 #define HAVE_TM_GMTOFF 1
648 #define HAVE_TM_ZONE 1
649 #define HAVE_TIMEGM 1
650 #endif     
651
652 #if WTF_PLATFORM_DARWIN
653
654 #define HAVE_ERRNO_H 1
655 #define HAVE_LANGINFO_H 1
656 #define HAVE_MMAP 1
657 #define HAVE_MERGESORT 1
658 #define HAVE_SBRK 1
659 #define HAVE_STRINGS_H 1
660 #define HAVE_SYS_PARAM_H 1
661 #define HAVE_SYS_TIME_H 1
662 #define HAVE_SYS_TIMEB_H 1
663
664 #if !defined(BUILDING_ON_TIGER) && !defined(BUILDING_ON_LEOPARD) && !WTF_PLATFORM_IPHONE && !WTF_PLATFORM_QT
665 #define HAVE_MADV_FREE_REUSE 1
666 #define HAVE_MADV_FREE 1
667 #define HAVE_PTHREAD_SETNAME_NP 1
668 #endif
669
670 #if WTF_PLATFORM_IPHONE
671 #define HAVE_MADV_FREE 1
672 #endif
673
674 #elif WTF_PLATFORM_WIN_OS
675
676 #if WTF_PLATFORM_WINCE
677 #define HAVE_ERRNO_H 0
678 #else
679 #define HAVE_SYS_TIMEB_H 1
680 #endif
681 #define HAVE_VIRTUALALLOC 1
682
683 #elif WTF_PLATFORM_SYMBIAN
684
685 #define HAVE_ERRNO_H 1
686 #define HAVE_MMAP 0
687 #define HAVE_SBRK 1
688
689 #define HAVE_SYS_TIME_H 1
690 #define HAVE_STRINGS_H 1
691
692 #if !WTF_COMPILER_RVCT
693 #define HAVE_SYS_PARAM_H 1
694 #endif
695
696 #elif WTF_PLATFORM_QNX
697
698 #define HAVE_ERRNO_H 1
699 #define HAVE_MMAP 1
700 #define HAVE_SBRK 1
701 #define HAVE_STRINGS_H 1
702 #define HAVE_SYS_PARAM_H 1
703 #define HAVE_SYS_TIME_H 1
704
705 #elif WTF_PLATFORM_ANDROID
706
707 #define HAVE_ERRNO_H 1
708 #define HAVE_LANGINFO_H 0
709 #define HAVE_MMAP 1
710 #define HAVE_SBRK 1
711 #define HAVE_STRINGS_H 1
712 #define HAVE_SYS_PARAM_H 1
713 #define HAVE_SYS_TIME_H 1
714
715 #elif WTF_PLATFORM_OS2
716
717 #define HAVE_MMAP 1
718 #define ENABLE_ASSEMBLER 1
719 #define HAVE_ERRNO_H 1
720 #define HAVE_STRINGS_H 1
721 #define HAVE_SYS_PARAM_H 1
722 #define HAVE_SYS_TIME_H 1
723 #define HAVE_SYS_TIMEB_H 1
724
725 #else
726
727 /* FIXME: is this actually used or do other platforms generate their own config.h? */
728
729 #define HAVE_ERRNO_H 1
730 /* As long as Haiku doesn't have a complete support of locale this will be disabled. */
731 #if !WTF_PLATFORM_HAIKU
732 #define HAVE_LANGINFO_H 1
733 #endif
734 #define HAVE_MMAP 1
735 #define HAVE_SBRK 1
736 #define HAVE_STRINGS_H 1
737 #define HAVE_SYS_PARAM_H 1
738 #define HAVE_SYS_TIME_H 1
739
740 #endif
741
742 /* ENABLE macro defaults */
743
744 /* fastMalloc match validation allows for runtime verification that
745    new is matched by delete, fastMalloc is matched by fastFree, etc. */
746 #if !defined(ENABLE_FAST_MALLOC_MATCH_VALIDATION)
747 #define ENABLE_FAST_MALLOC_MATCH_VALIDATION 0
748 #endif
749
750 #if !defined(ENABLE_ICONDATABASE)
751 #define ENABLE_ICONDATABASE 1
752 #endif
753
754 #if !defined(ENABLE_DATABASE)
755 #define ENABLE_DATABASE 1
756 #endif
757
758 #if !defined(ENABLE_JAVASCRIPT_DEBUGGER)
759 #define ENABLE_JAVASCRIPT_DEBUGGER 1
760 #endif
761
762 #if !defined(ENABLE_FTPDIR)
763 #define ENABLE_FTPDIR 1
764 #endif
765
766 #if !defined(ENABLE_CONTEXT_MENUS)
767 #define ENABLE_CONTEXT_MENUS 1
768 #endif
769
770 #if !defined(ENABLE_DRAG_SUPPORT)
771 #define ENABLE_DRAG_SUPPORT 1
772 #endif
773
774 #if !defined(ENABLE_DASHBOARD_SUPPORT)
775 #define ENABLE_DASHBOARD_SUPPORT 0
776 #endif
777
778 #if !defined(ENABLE_INSPECTOR)
779 #define ENABLE_INSPECTOR 1
780 #endif
781
782 #if !defined(ENABLE_MAC_JAVA_BRIDGE)
783 #define ENABLE_MAC_JAVA_BRIDGE 0
784 #endif
785
786 #if !defined(ENABLE_NETSCAPE_PLUGIN_API)
787 #define ENABLE_NETSCAPE_PLUGIN_API 1
788 #endif
789
790 #if !defined(WTF_USE_PLUGIN_HOST_PROCESS)
791 #define WTF_USE_PLUGIN_HOST_PROCESS 0
792 #endif
793
794 #if !defined(ENABLE_ORIENTATION_EVENTS)
795 #define ENABLE_ORIENTATION_EVENTS 0
796 #endif
797
798 #if !defined(ENABLE_OPCODE_STATS)
799 #define ENABLE_OPCODE_STATS 0
800 #endif
801
802 #define ENABLE_SAMPLING_COUNTERS 0
803 #define ENABLE_SAMPLING_FLAGS 0
804 #define ENABLE_OPCODE_SAMPLING 0
805 #define ENABLE_CODEBLOCK_SAMPLING 0
806 #if ENABLE_CODEBLOCK_SAMPLING && !ENABLE_OPCODE_SAMPLING
807 #error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING"
808 #endif
809 #if ENABLE_OPCODE_SAMPLING || ENABLE_SAMPLING_FLAGS
810 #define ENABLE_SAMPLING_THREAD 1
811 #endif
812
813 #if !defined(ENABLE_GEOLOCATION)
814 #define ENABLE_GEOLOCATION 0
815 #endif
816
817 #if !defined(ENABLE_NOTIFICATIONS)
818 #define ENABLE_NOTIFICATIONS 0
819 #endif
820
821 #if !defined(ENABLE_TEXT_CARET)
822 #define ENABLE_TEXT_CARET 1
823 #endif
824
825 #if !defined(ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL)
826 #define ENABLE_ON_FIRST_TEXTAREA_FOCUS_SELECT_ALL 0
827 #endif
828
829 #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64)
830 #if (WTF_CPU_X86_64 && (WTF_PLATFORM_UNIX || WTF_PLATFORM_WIN_OS)) || WTF_CPU_IA64 || WTF_CPU_ALPHA
831 #define WTF_USE_JSVALUE64 1
832 #elif WTF_CPU_ARM || WTF_CPU_PPC64
833 #define WTF_USE_JSVALUE32 1
834 #elif WTF_PLATFORM_WIN_OS && WTF_COMPILER_MINGW
835 /* Using JSVALUE32_64 causes padding/alignement issues for JITStubArg
836 on MinGW. See https://bugs.webkit.org/show_bug.cgi?id=29268 */
837 #define WTF_USE_JSVALUE32 1
838 #else
839 #define WTF_USE_JSVALUE32_64 1
840 #endif
841 #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32) && !defined(WTF_USE_JSVALUE32_64) */
842
843 #if !defined(ENABLE_REPAINT_THROTTLING)
844 #define ENABLE_REPAINT_THROTTLING 0
845 #endif
846
847 #if !defined(ENABLE_JIT)
848
849 /* The JIT is tested & working on x86_64 Mac */
850 #if WTF_CPU_X86_64 && WTF_PLATFORM_MAC
851     #define ENABLE_JIT 1
852 /* The JIT is tested & working on x86 Mac */
853 #elif WTF_CPU_X86 && WTF_PLATFORM_MAC
854     #define ENABLE_JIT 1
855     #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
856 #elif WTF_CPU_ARM_THUMB2 && WTF_PLATFORM_IPHONE
857     #define ENABLE_JIT 1
858 /* The JIT is tested & working on x86 OS/2 */
859 #elif WTF_CPU_X86 && WTF_PLATFORM_OS2
860     #define ENABLE_JIT 1
861 /* The JIT is tested & working on x86 Windows */
862 #elif WTF_CPU_X86 && WTF_PLATFORM_WIN
863     #define ENABLE_JIT 1
864 #endif
865
866 #if WTF_PLATFORM_QT
867 #if WTF_CPU_X86_64 && WTF_PLATFORM_DARWIN
868     #define ENABLE_JIT 1
869 #elif WTF_CPU_X86 && WTF_PLATFORM_DARWIN
870     #define ENABLE_JIT 1
871     #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
872 #elif WTF_CPU_X86 && WTF_PLATFORM_WIN_OS && WTF_COMPILER_MINGW && GCC_VERSION >= 40100
873     #define ENABLE_JIT 1
874     #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
875 #elif WTF_CPU_X86 && WTF_PLATFORM_WIN_OS && WTF_COMPILER_MSVC
876     #define ENABLE_JIT 1
877     #define WTF_USE_JIT_STUB_ARGUMENT_REGISTER 1
878 #elif WTF_CPU_X86 && WTF_PLATFORM_LINUX && GCC_VERSION >= 40100
879     #define ENABLE_JIT 1
880     #define WTF_USE_JIT_STUB_ARGUMENT_VA_LIST 1
881 #elif WTF_CPU_ARM_TRADITIONAL && WTF_PLATFORM_LINUX
882     #define ENABLE_JIT 1
883 #endif
884 #endif /* PLATFORM(QT) */
885
886 #endif /* !defined(ENABLE_JIT) */
887
888 #if ENABLE_JIT
889 #ifndef ENABLE_JIT_OPTIMIZE_CALL
890 #define ENABLE_JIT_OPTIMIZE_CALL 1
891 #endif
892 #ifndef ENABLE_JIT_OPTIMIZE_NATIVE_CALL
893 #define ENABLE_JIT_OPTIMIZE_NATIVE_CALL 1
894 #endif
895 #ifndef ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS
896 #define ENABLE_JIT_OPTIMIZE_PROPERTY_ACCESS 1
897 #endif
898 #ifndef ENABLE_JIT_OPTIMIZE_METHOD_CALLS
899 #define ENABLE_JIT_OPTIMIZE_METHOD_CALLS 1
900 #endif
901 #endif
902
903 #if WTF_CPU_X86 && WTF_COMPILER_MSVC
904 #define JSC_HOST_CALL __fastcall
905 #elif WTF_CPU_X86 && WTF_COMPILER_GCC
906 #define JSC_HOST_CALL __attribute__ ((fastcall))
907 #else
908 #define JSC_HOST_CALL
909 #endif
910
911 #if WTF_COMPILER_GCC && !ENABLE_JIT
912 #define HAVE_COMPUTED_GOTO 1
913 #endif
914
915 #if ENABLE_JIT && defined(COVERAGE)
916     #define WTF_USE_INTERPRETER 0
917 #else
918     #define WTF_USE_INTERPRETER 1
919 #endif
920
921 /* Yet Another Regex Runtime. */
922 #if !defined(ENABLE_YARR_JIT)
923
924 /* YARR supports x86 & x86-64, and has been tested on Mac and Windows. */
925 #if (WTF_CPU_X86 \
926  || WTF_CPU_X86_64 \
927  || WTF_CPU_ARM_TRADITIONAL \
928  || WTF_CPU_ARM_THUMB2 \
929  || WTF_CPU_X86)
930 #define ENABLE_YARR_JIT 1
931 #else
932 #define ENABLE_YARR_JIT 0
933 #endif
934
935 #endif /* !defined(ENABLE_YARR_JIT) */
936
937 #if (ENABLE_JIT || ENABLE_YARR_JIT)
938 #define ENABLE_ASSEMBLER 1
939 #endif
940 /* Setting this flag prevents the assembler from using RWX memory; this may improve
941    security but currectly comes at a significant performance cost. */
942 #if WTF_PLATFORM_IPHONE
943 #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 1
944 #else
945 #define ENABLE_ASSEMBLER_WX_EXCLUSIVE 0
946 #endif
947
948 #if !defined(ENABLE_PAN_SCROLLING) && WTF_PLATFORM_WIN_OS
949 #define ENABLE_PAN_SCROLLING 1
950 #endif
951
952 /* Use the QXmlStreamReader implementation for XMLTokenizer */
953 /* Use the QXmlQuery implementation for XSLTProcessor */
954 #if WTF_PLATFORM_QT
955 #define WTF_USE_QXMLSTREAM 1
956 #define WTF_USE_QXMLQUERY 1
957 #endif
958
959 #if !WTF_PLATFORM_QT
960 #define WTF_USE_FONT_FAST_PATH 1
961 #endif
962
963 /* Accelerated compositing */
964 #if WTF_PLATFORM_MAC
965 #if !defined(BUILDING_ON_TIGER)
966 #define WTF_USE_ACCELERATED_COMPOSITING 1
967 #endif
968 #endif
969
970 #if WTF_PLATFORM_IPHONE
971 #define WTF_USE_ACCELERATED_COMPOSITING 1
972 #endif
973
974 /* FIXME: Defining ENABLE_3D_RENDERING here isn't really right, but it's always used with
975    with WTF_USE_ACCELERATED_COMPOSITING, and it allows the feature to be turned on and
976    off in one place. */
977 //#if WTF_PLATFORM_WIN
978 //#include "QuartzCorePresent.h"
979 //#if QUARTZCORE_PRESENT
980 //#define WTF_USE_ACCELERATED_COMPOSITING 1
981 //#define ENABLE_3D_RENDERING 1
982 //#endif
983 //#endif
984
985 #if WTF_COMPILER_GCC
986 #define WARN_UNUSED_RETURN __attribute__ ((warn_unused_result))
987 #else
988 #define WARN_UNUSED_RETURN
989 #endif
990
991 #if !ENABLE_NETSCAPE_PLUGIN_API || (ENABLE_NETSCAPE_PLUGIN_API && ((WTF_PLATFORM_UNIX && (WTF_PLATFORM_QT || WTF_PLATFORM_WX)) || WTF_PLATFORM_GTK))
992 #define ENABLE_PLUGIN_PACKAGE_SIMPLE_HASH 1
993 #endif
994
995 /* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */
996 #define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK
997
998 #define ENABLE_JSC_ZOMBIES 0
999
1000 #endif /* WTF_Platform_h */