| 1 | /* |
| 2 | * Copyright (C) 2006, 2007, 2008, 2009, 2013 Apple Inc. All rights reserved. |
| 3 | * Copyright (C) 2007-2009 Torch Mobile, Inc. |
| 4 | * Copyright (C) 2010, 2011 Research In Motion Limited. All rights reserved. |
| 5 | * Copyright (C) 2018 The Qt Company Ltd. |
| 6 | * |
| 7 | * Redistribution and use in source and binary forms, with or without |
| 8 | * modification, are permitted provided that the following conditions |
| 9 | * are met: |
| 10 | * 1. Redistributions of source code must retain the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer. |
| 12 | * 2. Redistributions in binary form must reproduce the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer in the |
| 14 | * documentation and/or other materials provided with the distribution. |
| 15 | * |
| 16 | * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY |
| 17 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 18 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 19 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR |
| 20 | * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, |
| 21 | * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, |
| 22 | * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR |
| 23 | * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY |
| 24 | * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 26 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | */ |
| 28 | |
| 29 | #ifndef WTF_Platform_h |
| 30 | #define WTF_Platform_h |
| 31 | |
| 32 | #if defined(__cplusplus) |
| 33 | #include <private/qv4global_p.h> |
| 34 | #endif |
| 35 | |
| 36 | /* Include compiler specific macros */ |
| 37 | #include <wtf/Compiler.h> |
| 38 | |
| 39 | /* ==== PLATFORM handles OS, operating environment, graphics API, and |
| 40 | CPU. This macro will be phased out in favor of platform adaptation |
| 41 | macros, policy decision macros, and top-level port definitions. ==== */ |
| 42 | #define PLATFORM(WTF_FEATURE) (defined WTF_PLATFORM_##WTF_FEATURE && WTF_PLATFORM_##WTF_FEATURE) |
| 43 | |
| 44 | |
| 45 | /* ==== Platform adaptation macros: these describe properties of the target environment. ==== */ |
| 46 | |
| 47 | /* CPU() - the target CPU architecture */ |
| 48 | #ifdef Q_OS_VXWORKS |
| 49 | #undef CPU |
| 50 | #endif // Q_OS_VXWORKS |
| 51 | #define CPU(WTF_FEATURE) (defined WTF_CPU_##WTF_FEATURE && WTF_CPU_##WTF_FEATURE) |
| 52 | /* HAVE() - specific system features (headers, functions or similar) that are present or not */ |
| 53 | #define HAVE(WTF_FEATURE) (defined HAVE_##WTF_FEATURE && HAVE_##WTF_FEATURE) |
| 54 | /* OS() - underlying operating system; only to be used for mandated low-level services like |
| 55 | virtual memory, not to choose a GUI toolkit */ |
| 56 | #define OS(WTF_FEATURE) (defined WTF_OS_##WTF_FEATURE && WTF_OS_##WTF_FEATURE) |
| 57 | |
| 58 | |
| 59 | /* ==== Policy decision macros: these define policy choices for a particular port. ==== */ |
| 60 | |
| 61 | /* USE() - use a particular third-party library or optional OS service */ |
| 62 | #define USE(WTF_FEATURE) (defined WTF_USE_##WTF_FEATURE && WTF_USE_##WTF_FEATURE) |
| 63 | /* ENABLE() - turn on a specific feature of WebKit */ |
| 64 | #define ENABLE(WTF_FEATURE) (defined ENABLE_##WTF_FEATURE && ENABLE_##WTF_FEATURE) |
| 65 | |
| 66 | |
| 67 | /* ==== CPU() - the target CPU architecture ==== */ |
| 68 | |
| 69 | /* This also defines CPU(BIG_ENDIAN) or CPU(MIDDLE_ENDIAN) or neither, as appropriate. */ |
| 70 | |
| 71 | /* CPU(ALPHA) - DEC Alpha */ |
| 72 | #if defined(__alpha__) |
| 73 | #define WTF_CPU_ALPHA 1 |
| 74 | #endif |
| 75 | |
| 76 | /* CPU(IA64) - Itanium / IA-64 */ |
| 77 | #if defined(__ia64__) |
| 78 | #define WTF_CPU_IA64 1 |
| 79 | /* 32-bit mode on Itanium */ |
| 80 | #if !defined(__LP64__) |
| 81 | #define WTF_CPU_IA64_32 1 |
| 82 | #endif |
| 83 | #endif |
| 84 | |
| 85 | /* CPU(MIPS) - MIPS 32-bit */ |
| 86 | /* Note: Only O32 ABI is tested, so we enable it for O32 ABI for now. */ |
| 87 | #if (defined(mips) || defined(__mips__) || defined(MIPS) || defined(_MIPS_)) \ |
| 88 | && defined(_ABIO32) |
| 89 | #define WTF_CPU_MIPS 1 |
| 90 | #if defined(__MIPSEB__) |
| 91 | #define WTF_CPU_BIG_ENDIAN 1 |
| 92 | #endif |
| 93 | #define WTF_MIPS_PIC (defined __PIC__) |
| 94 | #define WTF_MIPS_ARCH __mips |
| 95 | #define WTF_MIPS_ISA(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH == v) |
| 96 | #define WTF_MIPS_ISA_AT_LEAST(v) (defined WTF_MIPS_ARCH && WTF_MIPS_ARCH >= v) |
| 97 | #define WTF_MIPS_ARCH_REV __mips_isa_rev |
| 98 | #define WTF_MIPS_ISA_REV(v) (defined WTF_MIPS_ARCH_REV && WTF_MIPS_ARCH_REV == v) |
| 99 | #define WTF_MIPS_DOUBLE_FLOAT (defined __mips_hard_float && !defined __mips_single_float) |
| 100 | #define WTF_MIPS_FP64 (defined __mips_fpr && __mips_fpr == 64) |
| 101 | /* MIPS requires allocators to use aligned memory */ |
| 102 | #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1 |
| 103 | #endif /* MIPS */ |
| 104 | |
| 105 | /* CPU(PPC) - PowerPC 32-bit */ |
| 106 | #if defined(__ppc__) \ |
| 107 | || defined(__PPC__) \ |
| 108 | || defined(__powerpc__) \ |
| 109 | || defined(__powerpc) \ |
| 110 | || defined(__POWERPC__) \ |
| 111 | || defined(_M_PPC) \ |
| 112 | || defined(__PPC) |
| 113 | #define WTF_CPU_PPC 1 |
| 114 | #define WTF_CPU_BIG_ENDIAN 1 |
| 115 | #endif |
| 116 | |
| 117 | /* CPU(PPC64) - PowerPC 64-bit */ |
| 118 | #if defined(__ppc64__) \ |
| 119 | || defined(__PPC64__) |
| 120 | #define WTF_CPU_PPC64 1 |
| 121 | #define WTF_CPU_BIG_ENDIAN 1 |
| 122 | #endif |
| 123 | |
| 124 | /* CPU(SH4) - SuperH SH-4 */ |
| 125 | #if defined(__SH4__) |
| 126 | #define WTF_CPU_SH4 1 |
| 127 | #endif |
| 128 | |
| 129 | /* CPU(SPARC32) - SPARC 32-bit */ |
| 130 | #if defined(__sparc) && !defined(__arch64__) || defined(__sparcv8) |
| 131 | #define WTF_CPU_SPARC32 1 |
| 132 | #define WTF_CPU_BIG_ENDIAN 1 |
| 133 | #endif |
| 134 | |
| 135 | /* CPU(SPARC64) - SPARC 64-bit */ |
| 136 | #if defined(__sparc__) && defined(__arch64__) || defined (__sparcv9) |
| 137 | #define WTF_CPU_SPARC64 1 |
| 138 | #define WTF_CPU_BIG_ENDIAN 1 |
| 139 | #endif |
| 140 | |
| 141 | /* CPU(SPARC) - any SPARC, true for CPU(SPARC32) and CPU(SPARC64) */ |
| 142 | #if CPU(SPARC32) || CPU(SPARC64) |
| 143 | #define WTF_CPU_SPARC 1 |
| 144 | #endif |
| 145 | |
| 146 | /* CPU(S390X) - S390 64-bit */ |
| 147 | #if defined(__s390x__) |
| 148 | #define WTF_CPU_S390X 1 |
| 149 | #define WTF_CPU_BIG_ENDIAN 1 |
| 150 | #endif |
| 151 | |
| 152 | /* CPU(S390) - S390 32-bit */ |
| 153 | #if defined(__s390__) |
| 154 | #define WTF_CPU_S390 1 |
| 155 | #define WTF_CPU_BIG_ENDIAN 1 |
| 156 | #endif |
| 157 | |
| 158 | /* CPU(X86) - i386 / x86 32-bit */ |
| 159 | #if defined(__i386__) \ |
| 160 | || defined(i386) \ |
| 161 | || defined(_M_IX86) \ |
| 162 | || defined(_X86_) \ |
| 163 | || defined(__THW_INTEL) |
| 164 | #define WTF_CPU_X86 1 |
| 165 | #endif |
| 166 | |
| 167 | /* CPU(X86_64) - AMD64 / Intel64 / x86_64 64-bit */ |
| 168 | #if defined(__x86_64__) \ |
| 169 | || defined(_M_X64) |
| 170 | #define WTF_CPU_X86_64 1 |
| 171 | #endif |
| 172 | |
| 173 | /* CPU(ARM64) - Apple */ |
| 174 | #if (defined(__arm64__) && defined(__APPLE__)) || defined(__aarch64__) |
| 175 | #define WTF_CPU_ARM64 1 |
| 176 | #endif |
| 177 | |
| 178 | /* CPU(ARM64) - INTEGRITY */ |
| 179 | #if (defined(__ARM64__)) |
| 180 | #define WTF_CPU_ARM64 1 |
| 181 | #endif |
| 182 | |
| 183 | /* CPU(ARM) - ARM, any version*/ |
| 184 | #define WTF_ARM_ARCH_AT_LEAST(N) (CPU(ARM) && WTF_ARM_ARCH_VERSION >= N) |
| 185 | |
| 186 | #if defined(arm) \ |
| 187 | || defined(__arm__) \ |
| 188 | || defined(ARM) \ |
| 189 | || defined(_ARM_) |
| 190 | #define WTF_CPU_ARM 1 |
| 191 | |
| 192 | #if defined(__ARM_PCS_VFP) |
| 193 | #define WTF_CPU_ARM_HARDFP 1 |
| 194 | #endif |
| 195 | |
| 196 | #if defined(__ARMEB__) || (COMPILER(RVCT) && defined(__BIG_ENDIAN)) |
| 197 | #define WTF_CPU_BIG_ENDIAN 1 |
| 198 | |
| 199 | #elif !defined(__ARM_EABI__) \ |
| 200 | && !defined(__EABI__) \ |
| 201 | && !defined(__VFP_FP__) \ |
| 202 | && !defined(_WIN32_WCE) |
| 203 | #define WTF_CPU_MIDDLE_ENDIAN 1 |
| 204 | |
| 205 | #endif |
| 206 | |
| 207 | /* Set WTF_ARM_ARCH_VERSION */ |
| 208 | #if defined(__ARM_ARCH_4__) \ |
| 209 | || defined(__ARM_ARCH_4T__) \ |
| 210 | || defined(__MARM_ARMV4__) |
| 211 | #define WTF_ARM_ARCH_VERSION 4 |
| 212 | |
| 213 | #elif defined(__ARM_ARCH_5__) \ |
| 214 | || defined(__ARM_ARCH_5T__) \ |
| 215 | || defined(__MARM_ARMV5__) |
| 216 | #define WTF_ARM_ARCH_VERSION 5 |
| 217 | |
| 218 | #elif defined(__ARM_ARCH_5E__) \ |
| 219 | || defined(__ARM_ARCH_5TE__) \ |
| 220 | || defined(__ARM_ARCH_5TEJ__) |
| 221 | #define WTF_ARM_ARCH_VERSION 5 |
| 222 | /*ARMv5TE requires allocators to use aligned memory*/ |
| 223 | #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1 |
| 224 | |
| 225 | #elif defined(__ARM_ARCH_6__) \ |
| 226 | || defined(__ARM_ARCH_6J__) \ |
| 227 | || defined(__ARM_ARCH_6K__) \ |
| 228 | || defined(__ARM_ARCH_6Z__) \ |
| 229 | || defined(__ARM_ARCH_6ZK__) \ |
| 230 | || defined(__ARM_ARCH_6KZ__) \ |
| 231 | || defined(__ARM_ARCH_6T2__) \ |
| 232 | || defined(__ARMV6__) |
| 233 | #define WTF_ARM_ARCH_VERSION 6 |
| 234 | |
| 235 | #elif defined(__ARM_ARCH_7A__) \ |
| 236 | || defined(__ARM_ARCH_7R__) \ |
| 237 | || defined(__ARM_ARCH_7S__) \ |
| 238 | || defined(__CORE_CORTEXA__) // GHS-specific |
| 239 | #define WTF_ARM_ARCH_VERSION 7 |
| 240 | |
| 241 | /* MSVC sets _M_ARM */ |
| 242 | #elif defined(_M_ARM) |
| 243 | #define WTF_ARM_ARCH_VERSION _M_ARM |
| 244 | |
| 245 | /* RVCT sets _TARGET_ARCH_ARM */ |
| 246 | #elif defined(__TARGET_ARCH_ARM) |
| 247 | #define WTF_ARM_ARCH_VERSION __TARGET_ARCH_ARM |
| 248 | |
| 249 | #if defined(__TARGET_ARCH_5E) \ |
| 250 | || defined(__TARGET_ARCH_5TE) \ |
| 251 | || defined(__TARGET_ARCH_5TEJ) |
| 252 | /*ARMv5TE requires allocators to use aligned memory*/ |
| 253 | #define WTF_USE_ARENA_ALLOC_ALIGNMENT_INTEGER 1 |
| 254 | #endif |
| 255 | |
| 256 | #else |
| 257 | #define WTF_ARM_ARCH_VERSION 0 |
| 258 | |
| 259 | #endif |
| 260 | |
| 261 | /* Set WTF_THUMB_ARCH_VERSION */ |
| 262 | #if defined(__ARM_ARCH_4T__) |
| 263 | #define WTF_THUMB_ARCH_VERSION 1 |
| 264 | |
| 265 | #elif defined(__ARM_ARCH_5T__) \ |
| 266 | || defined(__ARM_ARCH_5TE__) \ |
| 267 | || defined(__ARM_ARCH_5TEJ__) |
| 268 | #define WTF_THUMB_ARCH_VERSION 2 |
| 269 | |
| 270 | #elif defined(__ARM_ARCH_6J__) \ |
| 271 | || defined(__ARM_ARCH_6K__) \ |
| 272 | || defined(__ARM_ARCH_6Z__) \ |
| 273 | || defined(__ARM_ARCH_6ZK__) \ |
| 274 | || defined(__ARM_ARCH_6M__) |
| 275 | #define WTF_THUMB_ARCH_VERSION 3 |
| 276 | |
| 277 | #elif defined(__ARM_ARCH_6T2__) \ |
| 278 | || defined(__ARM_ARCH_7__) \ |
| 279 | || defined(__ARM_ARCH_7A__) \ |
| 280 | || defined(__ARM_ARCH_7M__) \ |
| 281 | || defined(__ARM_ARCH_7R__) \ |
| 282 | || defined(__ARM_ARCH_7S__) \ |
| 283 | || defined(__CORE_CORTEXA__) // GHS-specific |
| 284 | #define WTF_THUMB_ARCH_VERSION 4 |
| 285 | |
| 286 | /* RVCT sets __TARGET_ARCH_THUMB */ |
| 287 | #elif defined(__TARGET_ARCH_THUMB) |
| 288 | #define WTF_THUMB_ARCH_VERSION __TARGET_ARCH_THUMB |
| 289 | |
| 290 | #else |
| 291 | #define WTF_THUMB_ARCH_VERSION 0 |
| 292 | #endif |
| 293 | |
| 294 | |
| 295 | /* CPU(ARMV5_OR_LOWER) - ARM instruction set v5 or earlier */ |
| 296 | /* On ARMv5 and below the natural alignment is required. |
| 297 | And there are some other differences for v5 or earlier. */ |
| 298 | #if !defined(ARMV5_OR_LOWER) && !WTF_ARM_ARCH_AT_LEAST(6) |
| 299 | #define WTF_CPU_ARMV5_OR_LOWER 1 |
| 300 | #endif |
| 301 | |
| 302 | |
| 303 | /* CPU(ARM_TRADITIONAL) - Thumb2 is not available, only traditional ARM (v4 or greater) */ |
| 304 | /* CPU(ARM_THUMB2) - Thumb2 instruction set is available */ |
| 305 | /* Only one of these will be defined. */ |
| 306 | #if !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) |
| 307 | # if defined(thumb2) || defined(__thumb2__) \ |
| 308 | || ((defined(__thumb) || defined(__thumb__)) && WTF_THUMB_ARCH_VERSION == 4) \ |
| 309 | || (defined(__ARM_ARCH_ISA_THUMB) && __ARM_ARCH_ISA_THUMB == 2) |
| 310 | # define WTF_CPU_ARM_TRADITIONAL 0 |
| 311 | # define WTF_CPU_ARM_THUMB2 1 |
| 312 | # elif WTF_ARM_ARCH_AT_LEAST(4) |
| 313 | # define WTF_CPU_ARM_TRADITIONAL 1 |
| 314 | # define WTF_CPU_ARM_THUMB2 0 |
| 315 | # else |
| 316 | # error "Not supported ARM architecture" |
| 317 | # endif |
| 318 | #elif CPU(ARM_TRADITIONAL) && CPU(ARM_THUMB2) /* Sanity Check */ |
| 319 | # error "Cannot use both of WTF_CPU_ARM_TRADITIONAL and WTF_CPU_ARM_THUMB2 platforms" |
| 320 | #endif /* !defined(WTF_CPU_ARM_TRADITIONAL) && !defined(WTF_CPU_ARM_THUMB2) */ |
| 321 | |
| 322 | #if defined(__ARM_NEON__) && !defined(WTF_CPU_ARM_NEON) |
| 323 | #define WTF_CPU_ARM_NEON 1 |
| 324 | #endif |
| 325 | |
| 326 | #if CPU(ARM_NEON) && (!COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 7, 0)) |
| 327 | // All NEON intrinsics usage can be disabled by this macro. |
| 328 | #define HAVE_ARM_NEON_INTRINSICS 1 |
| 329 | #endif |
| 330 | |
| 331 | #if (defined(__VFP_FP__) && !defined(__SOFTFP__)) |
| 332 | #define WTF_CPU_ARM_VFP 1 |
| 333 | #endif |
| 334 | |
| 335 | #if defined(__ARM_ARCH_7S__) |
| 336 | #define WTF_CPU_APPLE_ARMV7S 1 |
| 337 | #endif |
| 338 | |
| 339 | #endif /* ARM */ |
| 340 | |
| 341 | #if CPU(ARM) || CPU(MIPS) || CPU(SH4) || CPU(SPARC) |
| 342 | #define WTF_CPU_NEEDS_ALIGNED_ACCESS 1 |
| 343 | #endif |
| 344 | |
| 345 | /* ==== OS() - underlying operating system; only to be used for mandated low-level services like |
| 346 | virtual memory, not to choose a GUI toolkit ==== */ |
| 347 | |
| 348 | /* OS(AIX) - AIX */ |
| 349 | #ifdef _AIX |
| 350 | #define WTF_OS_AIX 1 |
| 351 | #endif |
| 352 | |
| 353 | /* OS(DARWIN) - Any Darwin-based OS, including Mac OS X and iPhone OS */ |
| 354 | #ifdef __APPLE__ |
| 355 | #define WTF_OS_DARWIN 1 |
| 356 | |
| 357 | #include <Availability.h> |
| 358 | #include <AvailabilityMacros.h> |
| 359 | #include <TargetConditionals.h> |
| 360 | #endif |
| 361 | |
| 362 | /* OS(IOS) - iOS */ |
| 363 | /* OS(MAC_OS_X) - Mac OS X (not including iOS) */ |
| 364 | #if OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \ |
| 365 | || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) \ |
| 366 | || (defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR)) |
| 367 | #define WTF_OS_IOS 1 |
| 368 | #elif OS(DARWIN) && ((defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) \ |
| 369 | || (defined(TARGET_OS_APPLETV) && TARGET_OS_APPLETV) \ |
| 370 | || (defined(TARGET_APPLETV_SIMULATOR) && TARGET_APPLETV_SIMULATOR)) |
| 371 | #define WTF_OS_IOS 1 |
| 372 | #define WTF_OS_TVOS 1 |
| 373 | #elif OS(DARWIN) && defined(TARGET_OS_MAC) && TARGET_OS_MAC |
| 374 | #define WTF_OS_MAC_OS_X 1 |
| 375 | |
| 376 | /* FIXME: These can be removed after sufficient time has passed since the removal of BUILDING_ON / TARGETING macros. */ |
| 377 | |
| 378 | #define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED 0 / 0 |
| 379 | #define ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED 0 / 0 |
| 380 | |
| 381 | #define BUILDING_ON_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED |
| 382 | #define BUILDING_ON_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED |
| 383 | #define BUILDING_ON_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MIN_REQUIRED |
| 384 | |
| 385 | #define TARGETING_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED |
| 386 | #define TARGETING_SNOW_LEOPARD ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED |
| 387 | #define TARGETING_LION ERROR_PLEASE_COMPARE_WITH_MAC_OS_X_VERSION_MAX_ALLOWED |
| 388 | #endif |
| 389 | |
| 390 | /* OS(FREEBSD) - FreeBSD */ |
| 391 | #if defined(__FreeBSD__) || defined(__DragonFly__) || defined(__FreeBSD_kernel__) |
| 392 | #define WTF_OS_FREEBSD 1 |
| 393 | #endif |
| 394 | |
| 395 | /* OS(HURD) - GNU/Hurd */ |
| 396 | #ifdef __GNU__ |
| 397 | #define WTF_OS_HURD 1 |
| 398 | #endif |
| 399 | |
| 400 | /* OS(INTEGRITY) - INTEGRITY */ |
| 401 | #ifdef __INTEGRITY |
| 402 | #define WTF_OS_INTEGRITY 1 |
| 403 | #endif |
| 404 | |
| 405 | /* OS(LINUX) - Linux */ |
| 406 | #ifdef __linux__ |
| 407 | #define WTF_OS_LINUX 1 |
| 408 | #endif |
| 409 | |
| 410 | /* OS(NETBSD) - NetBSD */ |
| 411 | #if defined(__NetBSD__) |
| 412 | #define WTF_OS_NETBSD 1 |
| 413 | #endif |
| 414 | |
| 415 | /* OS(OPENBSD) - OpenBSD */ |
| 416 | #ifdef __OpenBSD__ |
| 417 | #define WTF_OS_OPENBSD 1 |
| 418 | #endif |
| 419 | |
| 420 | /* OS(QNX) - QNX */ |
| 421 | #if defined(__QNXNTO__) |
| 422 | #define WTF_OS_QNX 1 |
| 423 | #endif |
| 424 | |
| 425 | /* OS(SOLARIS) - Solaris */ |
| 426 | #if defined(sun) || defined(__sun) |
| 427 | #define WTF_OS_SOLARIS 1 |
| 428 | #endif |
| 429 | |
| 430 | /* OS(WINCE) - Windows CE; note that for this platform OS(WINDOWS) is also defined */ |
| 431 | #if defined(_WIN32_WCE) |
| 432 | #define WTF_OS_WINCE 1 |
| 433 | #endif |
| 434 | |
| 435 | /* OS(WINCE) - Windows Runtime; note that for this platform OS(WINDOWS) is also defined */ |
| 436 | #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) |
| 437 | #define WTF_OS_WINRT 1 |
| 438 | #endif |
| 439 | |
| 440 | /* OS(WINDOWS) - Any version of Windows */ |
| 441 | #if defined(WIN32) || defined(_WIN32) |
| 442 | #define WTF_OS_WINDOWS 1 |
| 443 | #endif |
| 444 | |
| 445 | #ifdef __rtems__ |
| 446 | #define WTF_OS_RTEMS 1 |
| 447 | #endif |
| 448 | |
| 449 | /* OS(VXWORKS) - VXWORKS */ |
| 450 | #if defined(__vxworks) |
| 451 | #define WTF_OS_VXWORKS 1 |
| 452 | #endif |
| 453 | |
| 454 | #define WTF_OS_WIN ERROR "USE WINDOWS WITH OS NOT WIN" |
| 455 | #define WTF_OS_MAC ERROR "USE MAC_OS_X WITH OS NOT MAC" |
| 456 | |
| 457 | /* OS(UNIX) - Any Unix-like system */ |
| 458 | #if OS(AIX) \ |
| 459 | || OS(DARWIN) \ |
| 460 | || OS(FREEBSD) \ |
| 461 | || OS(HURD) \ |
| 462 | || OS(INTEGRITY) \ |
| 463 | || OS(LINUX) \ |
| 464 | || OS(NETBSD) \ |
| 465 | || OS(OPENBSD) \ |
| 466 | || OS(QNX) \ |
| 467 | || OS(RTEMS) \ |
| 468 | || OS(SOLARIS) \ |
| 469 | || OS(VXWORKS) \ |
| 470 | || defined(unix) \ |
| 471 | || defined(__unix) \ |
| 472 | || defined(__unix__) |
| 473 | #define WTF_OS_UNIX 1 |
| 474 | #endif |
| 475 | |
| 476 | /* Operating environments */ |
| 477 | |
| 478 | /* FIXME: these are all mixes of OS, operating environment and policy choices. */ |
| 479 | /* PLATFORM(QT) */ |
| 480 | /* PLATFORM(WX) */ |
| 481 | /* PLATFORM(EFL) */ |
| 482 | /* PLATFORM(GTK) */ |
| 483 | /* PLATFORM(BLACKBERRY) */ |
| 484 | /* PLATFORM(MAC) */ |
| 485 | /* PLATFORM(WIN) */ |
| 486 | #if defined(BUILDING_QT__) |
| 487 | #define WTF_PLATFORM_QT 1 |
| 488 | #elif defined(BUILDING_WX__) |
| 489 | #define WTF_PLATFORM_WX 1 |
| 490 | #elif defined(BUILDING_EFL__) |
| 491 | #define WTF_PLATFORM_EFL 1 |
| 492 | #elif defined(BUILDING_GTK__) |
| 493 | #define WTF_PLATFORM_GTK 1 |
| 494 | #elif defined(BUILDING_BLACKBERRY__) |
| 495 | #define WTF_PLATFORM_BLACKBERRY 1 |
| 496 | #elif OS(DARWIN) |
| 497 | #define WTF_PLATFORM_MAC 1 |
| 498 | #elif OS(WINDOWS) |
| 499 | #define WTF_PLATFORM_WIN 1 |
| 500 | #else |
| 501 | |
| 502 | /* PLATFORM(IOS) */ |
| 503 | /* FIXME: this is sometimes used as an OS switch and sometimes for higher-level things */ |
| 504 | #if (defined(TARGET_OS_EMBEDDED) && TARGET_OS_EMBEDDED) || (defined(TARGET_OS_IPHONE) && TARGET_OS_IPHONE) |
| 505 | #define WTF_PLATFORM_IOS 1 |
| 506 | #endif |
| 507 | |
| 508 | /* PLATFORM(IOS_SIMULATOR) */ |
| 509 | #if defined(TARGET_IPHONE_SIMULATOR) && TARGET_IPHONE_SIMULATOR |
| 510 | #define WTF_PLATFORM_IOS 1 |
| 511 | #define WTF_PLATFORM_IOS_SIMULATOR 1 |
| 512 | #endif |
| 513 | #endif |
| 514 | |
| 515 | /* Graphics engines */ |
| 516 | |
| 517 | /* USE(CG) and PLATFORM(CI) */ |
| 518 | #if PLATFORM(MAC) || PLATFORM(IOS) |
| 519 | #define WTF_USE_CG 1 |
| 520 | #endif |
| 521 | #if PLATFORM(MAC) || PLATFORM(IOS) || (PLATFORM(WIN) && USE(CG)) |
| 522 | #define WTF_USE_CA 1 |
| 523 | #endif |
| 524 | |
| 525 | #if PLATFORM(BLACKBERRY) |
| 526 | #define WTF_USE_SKIA 1 |
| 527 | #define WTF_USE_LOW_QUALITY_IMAGE_INTERPOLATION 1 |
| 528 | #define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_DITHERING 1 |
| 529 | #define WTF_USE_LOW_QUALITY_IMAGE_NO_JPEG_FANCY_UPSAMPLING 1 |
| 530 | #endif |
| 531 | |
| 532 | #if PLATFORM(GTK) |
| 533 | #define WTF_USE_CAIRO 1 |
| 534 | #define ENABLE_GLOBAL_FASTMALLOC_NEW 0 |
| 535 | #endif |
| 536 | |
| 537 | /* On Windows, use QueryPerformanceCounter by default */ |
| 538 | #if OS(WINDOWS) |
| 539 | #define WTF_USE_QUERY_PERFORMANCE_COUNTER 1 |
| 540 | #endif |
| 541 | |
| 542 | #if OS(WINCE) |
| 543 | #define NOSHLWAPI /* shlwapi.h not available on WinCe */ |
| 544 | |
| 545 | /* MSDN documentation says these functions are provided with uspce.lib. But we cannot find this file. */ |
| 546 | #define __usp10__ /* disable "usp10.h" */ |
| 547 | |
| 548 | #define _INC_ASSERT /* disable "assert.h" */ |
| 549 | #define assert(x) |
| 550 | |
| 551 | #endif /* OS(WINCE) */ |
| 552 | |
| 553 | #if OS(WINCE) && !PLATFORM(QT) |
| 554 | #define WTF_USE_WCHAR_UNICODE 1 |
| 555 | #elif PLATFORM(GTK) |
| 556 | /* The GTK+ Unicode backend is configurable */ |
| 557 | #else |
| 558 | #define WTF_USE_ICU_UNICODE 1 |
| 559 | #endif |
| 560 | |
| 561 | #if PLATFORM(MAC) && !PLATFORM(IOS) |
| 562 | #if CPU(X86_64) |
| 563 | #define WTF_USE_PLUGIN_HOST_PROCESS 1 |
| 564 | #endif |
| 565 | #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 |
| 566 | #define WTF_USE_SCROLLBAR_PAINTER 1 |
| 567 | #define HAVE_XPC 1 |
| 568 | #endif |
| 569 | #define WTF_USE_CF 1 |
| 570 | #define HAVE_READLINE 1 |
| 571 | #define HAVE_RUNLOOP_TIMER 1 |
| 572 | #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 |
| 573 | #define HAVE_LAYER_HOSTING_IN_WINDOW_SERVER 1 |
| 574 | #endif |
| 575 | #define WTF_USE_APPKIT 1 |
| 576 | #define WTF_USE_SECURITY_FRAMEWORK 1 |
| 577 | #endif /* PLATFORM(MAC) && !PLATFORM(IOS) */ |
| 578 | |
| 579 | #if PLATFORM(IOS) |
| 580 | #define DONT_FINALIZE_ON_MAIN_THREAD 1 |
| 581 | #endif |
| 582 | |
| 583 | #if PLATFORM(QT) && OS(DARWIN) |
| 584 | #define WTF_USE_CF 1 |
| 585 | #endif |
| 586 | |
| 587 | #if OS(DARWIN) && !PLATFORM(GTK) && !PLATFORM(QT) |
| 588 | #define ENABLE_PURGEABLE_MEMORY 1 |
| 589 | #endif |
| 590 | |
| 591 | #if PLATFORM(IOS) |
| 592 | #define HAVE_READLINE 1 |
| 593 | #define WTF_USE_APPKIT 0 |
| 594 | #define WTF_USE_CF 1 |
| 595 | #define WTF_USE_CFNETWORK 1 |
| 596 | #define WTF_USE_NETWORK_CFDATA_ARRAY_CALLBACK 1 |
| 597 | #define WTF_USE_SECURITY_FRAMEWORK 0 |
| 598 | #define WTF_USE_WEB_THREAD 1 |
| 599 | #endif /* PLATFORM(IOS) */ |
| 600 | |
| 601 | #if PLATFORM(WIN) && !OS(WINCE) |
| 602 | #define WTF_USE_CF 1 |
| 603 | #endif |
| 604 | |
| 605 | #if PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO) |
| 606 | #define WTF_USE_CFNETWORK 1 |
| 607 | #endif |
| 608 | |
| 609 | #if USE(CFNETWORK) || PLATFORM(MAC) || PLATFORM(IOS) |
| 610 | #define WTF_USE_CFURLCACHE 1 |
| 611 | #endif |
| 612 | |
| 613 | #if PLATFORM(WX) |
| 614 | #if !CPU(PPC) |
| 615 | #if !defined(ENABLE_ASSEMBLER) |
| 616 | #define ENABLE_ASSEMBLER 1 |
| 617 | #endif |
| 618 | #define ENABLE_JIT 1 |
| 619 | #endif |
| 620 | #define ENABLE_GLOBAL_FASTMALLOC_NEW 0 |
| 621 | #define ENABLE_LLINT 0 |
| 622 | #if OS(DARWIN) |
| 623 | #define WTF_USE_CF 1 |
| 624 | #endif |
| 625 | #endif |
| 626 | |
| 627 | #if !defined(HAVE_ACCESSIBILITY) |
| 628 | #if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(GTK) || PLATFORM(EFL) |
| 629 | #define HAVE_ACCESSIBILITY 1 |
| 630 | #endif |
| 631 | #endif /* !defined(HAVE_ACCESSIBILITY) */ |
| 632 | |
| 633 | #if OS(UNIX) |
| 634 | #define HAVE_ERRNO_H 1 |
| 635 | #if !OS(INTEGRITY) |
| 636 | #define HAVE_MMAP 1 |
| 637 | #endif |
| 638 | #define HAVE_SIGNAL_H 1 |
| 639 | #define HAVE_STRINGS_H 1 |
| 640 | #define HAVE_SYS_PARAM_H 1 |
| 641 | #define HAVE_SYS_TIME_H 1 |
| 642 | #define WTF_USE_OS_RANDOMNESS 1 |
| 643 | #define WTF_USE_PTHREADS 1 |
| 644 | #endif /* OS(UNIX) */ |
| 645 | |
| 646 | #if OS(UNIX) && !OS(QNX) |
| 647 | #define HAVE_LANGINFO_H 1 |
| 648 | #endif |
| 649 | |
| 650 | #if (OS(FREEBSD) || OS(OPENBSD)) && !defined(__GLIBC__) |
| 651 | #define HAVE_PTHREAD_NP_H 1 |
| 652 | #endif |
| 653 | |
| 654 | #if !defined(HAVE_VASPRINTF) |
| 655 | #if !COMPILER(MSVC) && !COMPILER(RVCT) && !COMPILER(MINGW) && !(COMPILER(GCC) && OS(QNX)) |
| 656 | #define HAVE_VASPRINTF 1 |
| 657 | #endif |
| 658 | #endif |
| 659 | |
| 660 | #if !defined(HAVE_STRNSTR) |
| 661 | #if OS(DARWIN) || (OS(FREEBSD) && !defined(__GLIBC__)) |
| 662 | #define HAVE_STRNSTR 1 |
| 663 | #endif |
| 664 | #endif |
| 665 | |
| 666 | #if !OS(WINDOWS) && !OS(SOLARIS) |
| 667 | #define HAVE_TM_GMTOFF 1 |
| 668 | #define HAVE_TM_ZONE 1 |
| 669 | #define HAVE_TIMEGM 1 |
| 670 | #endif |
| 671 | |
| 672 | #if OS(DARWIN) |
| 673 | |
| 674 | #define HAVE_DISPATCH_H 1 |
| 675 | #define HAVE_MADV_FREE 1 |
| 676 | #define HAVE_MADV_FREE_REUSE 1 |
| 677 | #define HAVE_MERGESORT 1 |
| 678 | #define HAVE_PTHREAD_SETNAME_NP 1 |
| 679 | #define HAVE_SYS_TIMEB_H 1 |
| 680 | #define WTF_USE_ACCELERATE 1 |
| 681 | |
| 682 | #if !PLATFORM(IOS) |
| 683 | #define HAVE_HOSTED_CORE_ANIMATION 1 |
| 684 | #endif /* !PLATFORM(IOS) */ |
| 685 | |
| 686 | #endif /* OS(DARWIN) */ |
| 687 | |
| 688 | #if OS(WINDOWS) && !OS(WINCE) |
| 689 | #define HAVE_SYS_TIMEB_H 1 |
| 690 | #define HAVE_ALIGNED_MALLOC 1 |
| 691 | #define HAVE_ISDEBUGGERPRESENT 1 |
| 692 | #endif |
| 693 | |
| 694 | #if OS(WINDOWS) |
| 695 | #define HAVE_VIRTUALALLOC 1 |
| 696 | #define WTF_USE_OS_RANDOMNESS 1 |
| 697 | #endif |
| 698 | |
| 699 | #if OS(QNX) |
| 700 | #define HAVE_MADV_FREE_REUSE 1 |
| 701 | #define HAVE_MADV_FREE 1 |
| 702 | #endif |
| 703 | |
| 704 | /* ENABLE macro defaults */ |
| 705 | |
| 706 | /* FIXME: move out all ENABLE() defines from here to FeatureDefines.h */ |
| 707 | |
| 708 | /* Include feature macros */ |
| 709 | #include <wtf/FeatureDefines.h> |
| 710 | |
| 711 | #if PLATFORM(QT) |
| 712 | /* We must not customize the global operator new and delete for the Qt port. */ |
| 713 | #define ENABLE_GLOBAL_FASTMALLOC_NEW 0 |
| 714 | #if !OS(UNIX) |
| 715 | #define USE_SYSTEM_MALLOC 1 |
| 716 | #endif |
| 717 | #endif |
| 718 | |
| 719 | #if PLATFORM(EFL) |
| 720 | #define ENABLE_GLOBAL_FASTMALLOC_NEW 0 |
| 721 | #endif |
| 722 | |
| 723 | #if !defined(ENABLE_GLOBAL_FASTMALLOC_NEW) |
| 724 | #define ENABLE_GLOBAL_FASTMALLOC_NEW 1 |
| 725 | #endif |
| 726 | |
| 727 | #define ENABLE_DEBUG_WITH_BREAKPOINT 0 |
| 728 | #define ENABLE_SAMPLING_COUNTERS 0 |
| 729 | #define ENABLE_SAMPLING_FLAGS 0 |
| 730 | #define ENABLE_SAMPLING_REGIONS 0 |
| 731 | #define ENABLE_OPCODE_SAMPLING 0 |
| 732 | #define ENABLE_CODEBLOCK_SAMPLING 0 |
| 733 | #if ENABLE(CODEBLOCK_SAMPLING) && !ENABLE(OPCODE_SAMPLING) |
| 734 | #error "CODEBLOCK_SAMPLING requires OPCODE_SAMPLING" |
| 735 | #endif |
| 736 | #if ENABLE(OPCODE_SAMPLING) || ENABLE(SAMPLING_FLAGS) || ENABLE(SAMPLING_REGIONS) |
| 737 | #define ENABLE_SAMPLING_THREAD 1 |
| 738 | #endif |
| 739 | |
| 740 | #if !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) |
| 741 | #if (CPU(X86_64) && (OS(UNIX) || OS(WINDOWS))) \ |
| 742 | || (CPU(IA64) && !CPU(IA64_32)) \ |
| 743 | || CPU(ALPHA) \ |
| 744 | || CPU(ARM64) \ |
| 745 | || CPU(SPARC64) \ |
| 746 | || CPU(S390X) \ |
| 747 | || CPU(PPC64) |
| 748 | #define WTF_USE_JSVALUE64 1 |
| 749 | #else |
| 750 | #define WTF_USE_JSVALUE32_64 1 |
| 751 | #endif |
| 752 | #endif /* !defined(WTF_USE_JSVALUE64) && !defined(WTF_USE_JSVALUE32_64) */ |
| 753 | |
| 754 | /* Disable the JIT on versions of GCC prior to 4.1 */ |
| 755 | #if !defined(ENABLE_JIT) && COMPILER(GCC) && !GCC_VERSION_AT_LEAST(4, 1, 0) |
| 756 | #define ENABLE_JIT 0 |
| 757 | #endif |
| 758 | |
| 759 | /* The JIT is enabled by default on all x86, x86-64, ARM & MIPS platforms. */ |
| 760 | #if !defined(ENABLE_JIT) \ |
| 761 | && (CPU(X86) || CPU(X86_64) || CPU(ARM) || CPU(MIPS) || CPU(ARM64)) \ |
| 762 | && (OS(DARWIN) || !COMPILER(GCC) || GCC_VERSION_AT_LEAST(4, 1, 0)) \ |
| 763 | && !OS(WINCE) \ |
| 764 | && !(OS(QNX) && !PLATFORM(QT)) /* We use JIT in QNX Qt */ |
| 765 | #define ENABLE_JIT 1 |
| 766 | #endif |
| 767 | |
| 768 | /* If possible, try to enable a disassembler. This is optional. We proceed in two |
| 769 | steps: first we try to find some disassembler that we can use, and then we |
| 770 | decide if the high-level disassembler API can be enabled. */ |
| 771 | #if !defined(WTF_USE_UDIS86) && ENABLE(JIT) && (PLATFORM(MAC) || (PLATFORM(QT) && OS(LINUX))) \ |
| 772 | && (CPU(X86) || CPU(X86_64)) |
| 773 | #define WTF_USE_UDIS86 1 |
| 774 | #endif |
| 775 | |
| 776 | #if !defined(ENABLE_DISASSEMBLER) && (USE(UDIS86) || USE(ARMV7_DISASSEMBLER) || USE(ARM64_DISASSEMBLER) || USE(MIPS32_DISASSEMBLER)) |
| 777 | #define ENABLE_DISASSEMBLER 1 |
| 778 | #endif |
| 779 | |
| 780 | /* On the GTK+ port we take an extra precaution for LLINT support: |
| 781 | * We disable it on x86 builds if the build target doesn't support SSE2 |
| 782 | * instructions (LLINT requires SSE2 on this platform). */ |
| 783 | #if !defined(ENABLE_LLINT) && PLATFORM(GTK) && CPU(X86) && COMPILER(GCC) \ |
| 784 | && !defined(__SSE2__) |
| 785 | #define ENABLE_LLINT 0 |
| 786 | #endif |
| 787 | |
| 788 | /* On some of the platforms where we have a JIT, we want to also have the |
| 789 | low-level interpreter. */ |
| 790 | #if !defined(ENABLE_LLINT) \ |
| 791 | && ENABLE(JIT) \ |
| 792 | && (OS(DARWIN) || OS(LINUX)) \ |
| 793 | && (PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(GTK) || PLATFORM(QT)) \ |
| 794 | && (CPU(X86) || CPU(X86_64) || CPU(ARM_THUMB2) || CPU(ARM_TRADITIONAL) || CPU(MIPS)) |
| 795 | #define ENABLE_LLINT 1 |
| 796 | #endif |
| 797 | |
| 798 | #if !defined(ENABLE_DFG_JIT) && ENABLE(JIT) && !COMPILER(MSVC) |
| 799 | /* Enable the DFG JIT on X86 and X86_64. Only tested on Mac and GNU/Linux. */ |
| 800 | #if (CPU(X86) || CPU(X86_64)) && (OS(DARWIN) || OS(LINUX)) |
| 801 | #define ENABLE_DFG_JIT 1 |
| 802 | #endif |
| 803 | /* Enable the DFG JIT on ARMv7. Only tested on iOS and Qt Linux. */ |
| 804 | #if CPU(ARM_THUMB2) && (PLATFORM(IOS) || PLATFORM(BLACKBERRY) || PLATFORM(QT)) |
| 805 | #define ENABLE_DFG_JIT 1 |
| 806 | #endif |
| 807 | /* Enable the DFG JIT on ARM. */ |
| 808 | #if CPU(ARM_TRADITIONAL) |
| 809 | #define ENABLE_DFG_JIT 1 |
| 810 | #endif |
| 811 | /* Enable the DFG JIT on MIPS. */ |
| 812 | #if CPU(MIPS) |
| 813 | #define ENABLE_DFG_JIT 1 |
| 814 | #endif |
| 815 | #endif |
| 816 | |
| 817 | /* If the jit is not available, enable the LLInt C Loop: */ |
| 818 | /* Not for Qml. We have our own interpreter. */ |
| 819 | #if 0 /* !ENABLE(JIT) */ |
| 820 | #undef ENABLE_LLINT /* Undef so that we can redefine it. */ |
| 821 | #undef ENABLE_LLINT_C_LOOP /* Undef so that we can redefine it. */ |
| 822 | #undef ENABLE_DFG_JIT /* Undef so that we can redefine it. */ |
| 823 | #define ENABLE_LLINT 1 |
| 824 | #define ENABLE_LLINT_C_LOOP 1 |
| 825 | #define ENABLE_DFG_JIT 0 |
| 826 | #endif |
| 827 | |
| 828 | /* Do a sanity check to make sure that we at least have one execution engine in |
| 829 | use: */ |
| 830 | #if 0 /* !(ENABLE(JIT) || ENABLE(LLINT)) */ |
| 831 | #error You have to have at least one execution model enabled to build JSC |
| 832 | #endif |
| 833 | |
| 834 | /* Profiling of types and values used by JIT code. DFG_JIT depends on it, but you |
| 835 | can enable it manually with DFG turned off if you want to use it as a standalone |
| 836 | profiler. In that case, you probably want to also enable VERBOSE_VALUE_PROFILE |
| 837 | below. */ |
| 838 | #if !defined(ENABLE_VALUE_PROFILER) && ENABLE(DFG_JIT) |
| 839 | #define ENABLE_VALUE_PROFILER 1 |
| 840 | #endif |
| 841 | |
| 842 | #if !defined(ENABLE_VERBOSE_VALUE_PROFILE) && ENABLE(VALUE_PROFILER) |
| 843 | #define ENABLE_VERBOSE_VALUE_PROFILE 0 |
| 844 | #endif |
| 845 | |
| 846 | #if !defined(ENABLE_SIMPLE_HEAP_PROFILING) |
| 847 | #define ENABLE_SIMPLE_HEAP_PROFILING 0 |
| 848 | #endif |
| 849 | |
| 850 | /* Counts uses of write barriers using sampling counters. Be sure to also |
| 851 | set ENABLE_SAMPLING_COUNTERS to 1. */ |
| 852 | #if !defined(ENABLE_WRITE_BARRIER_PROFILING) |
| 853 | #define ENABLE_WRITE_BARRIER_PROFILING 0 |
| 854 | #endif |
| 855 | |
| 856 | /* Enable verification that that register allocations are not made within generated control flow. |
| 857 | Turned on for debug builds. */ |
| 858 | #if !defined(ENABLE_DFG_REGISTER_ALLOCATION_VALIDATION) && ENABLE(DFG_JIT) |
| 859 | #if !defined(NDEBUG) |
| 860 | #define ENABLE_DFG_REGISTER_ALLOCATION_VALIDATION 1 |
| 861 | #else |
| 862 | #define ENABLE_DFG_REGISTER_ALLOCATION_VALIDATION 0 |
| 863 | #endif |
| 864 | #endif |
| 865 | |
| 866 | /* Configure the JIT */ |
| 867 | #if CPU(X86) && COMPILER(MSVC) |
| 868 | #define JSC_HOST_CALL __fastcall |
| 869 | #elif CPU(X86) && COMPILER(GCC) |
| 870 | #define JSC_HOST_CALL __attribute__ ((fastcall)) |
| 871 | #else |
| 872 | #define JSC_HOST_CALL |
| 873 | #endif |
| 874 | |
| 875 | /* Configure the interpreter */ |
| 876 | #if COMPILER(GCC) || (COMPILER(RVCT) && defined(__GNUC__)) |
| 877 | #define HAVE_COMPUTED_GOTO 1 |
| 878 | #endif |
| 879 | |
| 880 | /* Determine if we need to enable Computed Goto Opcodes or not: */ |
| 881 | #if HAVE(COMPUTED_GOTO) && ENABLE(LLINT) |
| 882 | #define ENABLE_COMPUTED_GOTO_OPCODES 1 |
| 883 | #endif |
| 884 | |
| 885 | /* Regular Expression Tracing - Set to 1 to trace RegExp's in jsc. Results dumped at exit */ |
| 886 | #define ENABLE_REGEXP_TRACING 0 |
| 887 | |
| 888 | /* Yet Another Regex Runtime - turned on by default for JIT enabled ports. */ |
| 889 | #if !defined(ENABLE_YARR_JIT) && (ENABLE(JIT) || ENABLE(LLINT_C_LOOP)) && !(OS(QNX) && PLATFORM(QT)) |
| 890 | #define ENABLE_YARR_JIT 1 |
| 891 | |
| 892 | /* Setting this flag compares JIT results with interpreter results. */ |
| 893 | #define ENABLE_YARR_JIT_DEBUG 0 |
| 894 | #endif |
| 895 | |
| 896 | /* If either the JIT or the RegExp JIT is enabled, then the Assembler must be |
| 897 | enabled as well: */ |
| 898 | #if ENABLE(JIT) || ENABLE(YARR_JIT) |
| 899 | #if defined(ENABLE_ASSEMBLER) && !ENABLE_ASSEMBLER |
| 900 | #error "Cannot enable the JIT or RegExp JIT without enabling the Assembler" |
| 901 | #else |
| 902 | #undef ENABLE_ASSEMBLER |
| 903 | #define ENABLE_ASSEMBLER 1 |
| 904 | #endif |
| 905 | #endif |
| 906 | |
| 907 | /* Pick which allocator to use; we only need an executable allocator if the assembler is compiled in. |
| 908 | On x86-64 we use a single fixed mmap, on other platforms we mmap on demand. */ |
| 909 | #if ENABLE(ASSEMBLER) |
| 910 | #if CPU(X86_64) && !OS(WINDOWS) || PLATFORM(IOS) || CPU(ARM64) |
| 911 | #define ENABLE_EXECUTABLE_ALLOCATOR_FIXED 1 |
| 912 | #else |
| 913 | #define ENABLE_EXECUTABLE_ALLOCATOR_DEMAND 1 |
| 914 | #endif |
| 915 | #endif |
| 916 | |
| 917 | /* Use the QXmlStreamReader implementation for XMLDocumentParser */ |
| 918 | /* Use the QXmlQuery implementation for XSLTProcessor */ |
| 919 | #if PLATFORM(QT) |
| 920 | #if !USE(LIBXML2) |
| 921 | #define WTF_USE_QXMLSTREAM 1 |
| 922 | #define WTF_USE_QXMLQUERY 1 |
| 923 | #endif |
| 924 | #endif |
| 925 | |
| 926 | /* Accelerated compositing */ |
| 927 | #if PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(QT) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) |
| 928 | #define WTF_USE_ACCELERATED_COMPOSITING 1 |
| 929 | #endif |
| 930 | |
| 931 | #if ENABLE(WEBGL) && !defined(WTF_USE_3D_GRAPHICS) |
| 932 | #define WTF_USE_3D_GRAPHICS 1 |
| 933 | #endif |
| 934 | |
| 935 | /* Qt always uses Texture Mapper */ |
| 936 | #if PLATFORM(QT) |
| 937 | #define WTF_USE_TEXTURE_MAPPER 1 |
| 938 | #endif |
| 939 | |
| 940 | #if USE(TEXTURE_MAPPER) && USE(3D_GRAPHICS) && !defined(WTF_USE_TEXTURE_MAPPER_GL) |
| 941 | #define WTF_USE_TEXTURE_MAPPER_GL 1 |
| 942 | #endif |
| 943 | |
| 944 | /* Compositing on the UI-process in WebKit2 */ |
| 945 | #if USE(3D_GRAPHICS) && PLATFORM(QT) |
| 946 | #define WTF_USE_COORDINATED_GRAPHICS 1 |
| 947 | #endif |
| 948 | |
| 949 | #if PLATFORM(MAC) || PLATFORM(IOS) |
| 950 | #define WTF_USE_PROTECTION_SPACE_AUTH_CALLBACK 1 |
| 951 | #endif |
| 952 | |
| 953 | /* Set up a define for a common error that is intended to cause a build error -- thus the space after Error. */ |
| 954 | #define WTF_PLATFORM_CFNETWORK Error USE_macro_should_be_used_with_CFNETWORK |
| 955 | |
| 956 | /* FIXME: Eventually we should enable this for all platforms and get rid of the define. */ |
| 957 | #if PLATFORM(IOS) || PLATFORM(MAC) || PLATFORM(WIN) || PLATFORM(QT) || PLATFORM(GTK) || PLATFORM(EFL) |
| 958 | #define WTF_USE_PLATFORM_STRATEGIES 1 |
| 959 | #endif |
| 960 | |
| 961 | #if PLATFORM(WIN) |
| 962 | #define WTF_USE_CROSS_PLATFORM_CONTEXT_MENUS 1 |
| 963 | #endif |
| 964 | |
| 965 | #if PLATFORM(MAC) && HAVE(ACCESSIBILITY) |
| 966 | #define WTF_USE_ACCESSIBILITY_CONTEXT_MENUS 1 |
| 967 | #endif |
| 968 | |
| 969 | #if !defined(ENABLE_THREADING_LIBDISPATCH) && HAVE(DISPATCH_H) |
| 970 | #define ENABLE_THREADING_LIBDISPATCH 1 |
| 971 | #elif !defined(ENABLE_THREADING_OPENMP) && defined(_OPENMP) |
| 972 | #define ENABLE_THREADING_OPENMP 1 |
| 973 | #elif !defined(THREADING_GENERIC) |
| 974 | #define ENABLE_THREADING_GENERIC 1 |
| 975 | #endif |
| 976 | |
| 977 | #if USE(GLIB) |
| 978 | #include <wtf/gobject/GTypedefs.h> |
| 979 | #endif |
| 980 | |
| 981 | /* FIXME: This define won't be needed once #27551 is fully landed. However, |
| 982 | since most ports try to support sub-project independence, adding new headers |
| 983 | to WTF causes many ports to break, and so this way we can address the build |
| 984 | breakages one port at a time. */ |
| 985 | #if !defined(WTF_USE_EXPORT_MACROS) && (PLATFORM(MAC) || PLATFORM(QT) || PLATFORM(WX)) |
| 986 | #define WTF_USE_EXPORT_MACROS 1 |
| 987 | #endif |
| 988 | |
| 989 | #if !defined(WTF_USE_EXPORT_MACROS_FOR_TESTING) && (PLATFORM(GTK) || PLATFORM(WIN)) |
| 990 | #define WTF_USE_EXPORT_MACROS_FOR_TESTING 1 |
| 991 | #endif |
| 992 | |
| 993 | #if (PLATFORM(QT) && !OS(DARWIN) && !OS(WINDOWS)) || PLATFORM(GTK) || PLATFORM(EFL) |
| 994 | #define WTF_USE_UNIX_DOMAIN_SOCKETS 1 |
| 995 | #endif |
| 996 | |
| 997 | #if !defined(ENABLE_COMPARE_AND_SWAP) && (OS(WINDOWS) || (COMPILER(GCC) && (CPU(X86) || CPU(X86_64) || CPU(ARM_THUMB2)))) |
| 998 | #define ENABLE_COMPARE_AND_SWAP 1 |
| 999 | #endif |
| 1000 | |
| 1001 | #define ENABLE_OBJECT_MARK_LOGGING 0 |
| 1002 | |
| 1003 | #if !defined(ENABLE_PARALLEL_GC) && !ENABLE(OBJECT_MARK_LOGGING) && (PLATFORM(MAC) || PLATFORM(IOS) || PLATFORM(BLACKBERRY) || PLATFORM(GTK)) && ENABLE(COMPARE_AND_SWAP) |
| 1004 | #define ENABLE_PARALLEL_GC 1 |
| 1005 | #elif PLATFORM(QT) |
| 1006 | // Parallel GC is temporarily disabled on Qt because of regular crashes, see https://bugs.webkit.org/show_bug.cgi?id=90957 for details |
| 1007 | #define ENABLE_PARALLEL_GC 0 |
| 1008 | #endif |
| 1009 | |
| 1010 | #if !defined(ENABLE_GC_VALIDATION) && !defined(NDEBUG) |
| 1011 | #define ENABLE_GC_VALIDATION 1 |
| 1012 | #endif |
| 1013 | |
| 1014 | #if !defined(ENABLE_BINDING_INTEGRITY) |
| 1015 | #define ENABLE_BINDING_INTEGRITY 1 |
| 1016 | #endif |
| 1017 | |
| 1018 | #if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070 |
| 1019 | #define WTF_USE_AVFOUNDATION 1 |
| 1020 | #endif |
| 1021 | |
| 1022 | #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 60000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) |
| 1023 | #define WTF_USE_COREMEDIA 1 |
| 1024 | #endif |
| 1025 | |
| 1026 | #if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 |
| 1027 | #define HAVE_AVFOUNDATION_TEXT_TRACK_SUPPORT 1 |
| 1028 | #endif |
| 1029 | |
| 1030 | #if PLATFORM(MAC) && !PLATFORM(IOS) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1090 |
| 1031 | #define HAVE_MEDIA_ACCESSIBILITY_FRAMEWORK 1 |
| 1032 | #endif |
| 1033 | |
| 1034 | #if PLATFORM(MAC) || PLATFORM(GTK) || (PLATFORM(WIN) && !OS(WINCE) && !PLATFORM(WIN_CAIRO)) || PLATFORM(BLACKBERRY) |
| 1035 | #define WTF_USE_REQUEST_ANIMATION_FRAME_TIMER 1 |
| 1036 | #endif |
| 1037 | |
| 1038 | #if PLATFORM(MAC) || PLATFORM(BLACKBERRY) |
| 1039 | #define WTF_USE_REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR 1 |
| 1040 | #endif |
| 1041 | |
| 1042 | #if PLATFORM(MAC) && (PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED >= 1070) |
| 1043 | #define HAVE_INVERTED_WHEEL_EVENTS 1 |
| 1044 | #endif |
| 1045 | |
| 1046 | #if PLATFORM(MAC) |
| 1047 | #define WTF_USE_COREAUDIO 1 |
| 1048 | #endif |
| 1049 | |
| 1050 | #if !defined(WTF_USE_ZLIB) && !PLATFORM(QT) |
| 1051 | #define WTF_USE_ZLIB 1 |
| 1052 | #endif |
| 1053 | |
| 1054 | #if PLATFORM(QT) |
| 1055 | #include <qglobal.h> |
| 1056 | #endif |
| 1057 | |
| 1058 | #if !PLATFORM(IOS) && PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1080 |
| 1059 | #define WTF_USE_CONTENT_FILTERING 1 |
| 1060 | #endif |
| 1061 | |
| 1062 | #if ENABLE(YARR_JIT) |
| 1063 | #if CPU(ARM64) || (CPU(X86_64) && !OS(WINDOWS)) |
| 1064 | /* Enable JIT'ing Regular Expressions that have nested parenthesis. */ |
| 1065 | #define ENABLE_YARR_JIT_ALL_PARENS_EXPRESSIONS 1 |
| 1066 | #define ENABLE_YARR_JIT_BACKREFERENCES 1 |
| 1067 | #endif |
| 1068 | #endif |
| 1069 | |
| 1070 | #endif /* WTF_Platform_h */ |
| 1071 | |