| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 #include "../include/v8stdint.h" | 31 #include "../include/v8stdint.h" |
| 32 | 32 |
| 33 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' | 33 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' |
| 34 // warning flag and certain versions of GCC due to a bug: | 34 // warning flag and certain versions of GCC due to a bug: |
| 35 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 | 35 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 |
| 36 // For now, we use the more involved template-based version from <limits>, but | 36 // For now, we use the more involved template-based version from <limits>, but |
| 37 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) | 37 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) |
| 38 #if V8_CC_GNU && V8_GNUC_PREREQ(2, 96, 0) && !V8_GNUC_PREREQ(4, 1, 0) | 38 #if V8_CC_GNU && V8_GNUC_PREREQ(2, 96, 0) && !V8_GNUC_PREREQ(4, 1, 0) |
| 39 # include <limits> // NOLINT | 39 # include <limits> // NOLINT |
| 40 # define V8_INFINITY std::numeric_limits<double>::infinity() | 40 # define V8_INFINITY std::numeric_limits<double>::infinity() |
| 41 #elif V8_CC_MSVC | 41 #elif V8_LIBC_MSVCRT |
| 42 # define V8_INFINITY HUGE_VAL | 42 # define V8_INFINITY HUGE_VAL |
| 43 #else | 43 #else |
| 44 # define V8_INFINITY INFINITY | 44 # define V8_INFINITY INFINITY |
| 45 #endif | 45 #endif |
| 46 | 46 |
| 47 namespace v8 { | 47 namespace v8 { |
| 48 namespace internal { | 48 namespace internal { |
| 49 | 49 |
| 50 // Processor architecture detection. For more info on what's defined, see: | 50 // Processor architecture detection. For more info on what's defined, see: |
| 51 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 51 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
| (...skipping 12 matching lines...) Expand all Loading... |
| 64 #define V8_HOST_CAN_READ_UNALIGNED 1 | 64 #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 65 #else | 65 #else |
| 66 #define V8_HOST_ARCH_X64 1 | 66 #define V8_HOST_ARCH_X64 1 |
| 67 #define V8_HOST_ARCH_64_BIT 1 | 67 #define V8_HOST_ARCH_64_BIT 1 |
| 68 #define V8_HOST_CAN_READ_UNALIGNED 1 | 68 #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 69 #endif // __native_client__ | 69 #endif // __native_client__ |
| 70 #elif defined(_M_IX86) || defined(__i386__) | 70 #elif defined(_M_IX86) || defined(__i386__) |
| 71 #define V8_HOST_ARCH_IA32 1 | 71 #define V8_HOST_ARCH_IA32 1 |
| 72 #define V8_HOST_ARCH_32_BIT 1 | 72 #define V8_HOST_ARCH_32_BIT 1 |
| 73 #define V8_HOST_CAN_READ_UNALIGNED 1 | 73 #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 74 #elif defined(__AARCH64EL__) |
| 75 #define V8_HOST_ARCH_A64 1 |
| 76 #define V8_HOST_ARCH_64_BIT 1 |
| 77 #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 74 #elif defined(__ARMEL__) | 78 #elif defined(__ARMEL__) |
| 75 #define V8_HOST_ARCH_ARM 1 | 79 #define V8_HOST_ARCH_ARM 1 |
| 76 #define V8_HOST_ARCH_32_BIT 1 | 80 #define V8_HOST_ARCH_32_BIT 1 |
| 77 #elif defined(__MIPSEL__) | 81 #elif defined(__MIPSEL__) |
| 78 #define V8_HOST_ARCH_MIPS 1 | 82 #define V8_HOST_ARCH_MIPS 1 |
| 79 #define V8_HOST_ARCH_32_BIT 1 | 83 #define V8_HOST_ARCH_32_BIT 1 |
| 80 #else | 84 #else |
| 81 #error Host architecture was not detected as supported by v8 | 85 #error "Host architecture was not detected as supported by v8" |
| 82 #endif | 86 #endif |
| 83 | 87 |
| 84 #if defined(__ARM_ARCH_7A__) || \ | 88 #if defined(__ARM_ARCH_7A__) || \ |
| 85 defined(__ARM_ARCH_7R__) || \ | 89 defined(__ARM_ARCH_7R__) || \ |
| 86 defined(__ARM_ARCH_7__) | 90 defined(__ARM_ARCH_7__) |
| 87 # define CAN_USE_ARMV7_INSTRUCTIONS 1 | 91 # define CAN_USE_ARMV7_INSTRUCTIONS 1 |
| 88 # ifndef CAN_USE_VFP3_INSTRUCTIONS | 92 # ifndef CAN_USE_VFP3_INSTRUCTIONS |
| 89 # define CAN_USE_VFP3_INSTRUCTIONS | 93 # define CAN_USE_VFP3_INSTRUCTIONS |
| 90 # endif | 94 # endif |
| 91 #endif | 95 #endif |
| 92 | 96 |
| 93 | 97 |
| 94 // Target architecture detection. This may be set externally. If not, detect | 98 // Target architecture detection. This may be set externally. If not, detect |
| 95 // in the same way as the host architecture, that is, target the native | 99 // in the same way as the host architecture, that is, target the native |
| 96 // environment as presented by the compiler. | 100 // environment as presented by the compiler. |
| 97 #if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && \ | 101 #if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && \ |
| 98 !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_MIPS | 102 !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_A64 && !V8_TARGET_ARCH_MIPS |
| 99 #if defined(_M_X64) || defined(__x86_64__) | 103 #if defined(_M_X64) || defined(__x86_64__) |
| 100 #define V8_TARGET_ARCH_X64 1 | 104 #define V8_TARGET_ARCH_X64 1 |
| 101 #elif defined(_M_IX86) || defined(__i386__) | 105 #elif defined(_M_IX86) || defined(__i386__) |
| 102 #define V8_TARGET_ARCH_IA32 1 | 106 #define V8_TARGET_ARCH_IA32 1 |
| 107 #elif defined(__AARCH64EL__) |
| 108 #define V8_TARGET_ARCH_A64 1 |
| 103 #elif defined(__ARMEL__) | 109 #elif defined(__ARMEL__) |
| 104 #define V8_TARGET_ARCH_ARM 1 | 110 #define V8_TARGET_ARCH_ARM 1 |
| 105 #elif defined(__MIPSEL__) | 111 #elif defined(__MIPSEL__) |
| 106 #define V8_TARGET_ARCH_MIPS 1 | 112 #define V8_TARGET_ARCH_MIPS 1 |
| 107 #else | 113 #else |
| 108 #error Target architecture was not detected as supported by v8 | 114 #error Target architecture was not detected as supported by v8 |
| 109 #endif | 115 #endif |
| 110 #endif | 116 #endif |
| 111 | 117 |
| 112 // Check for supported combinations of host and target architectures. | 118 // Check for supported combinations of host and target architectures. |
| 113 #if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32 | 119 #if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32 |
| 114 #error Target architecture ia32 is only supported on ia32 host | 120 #error Target architecture ia32 is only supported on ia32 host |
| 115 #endif | 121 #endif |
| 116 #if V8_TARGET_ARCH_X64 && !V8_HOST_ARCH_X64 | 122 #if V8_TARGET_ARCH_X64 && !V8_HOST_ARCH_X64 |
| 117 #error Target architecture x64 is only supported on x64 host | 123 #error Target architecture x64 is only supported on x64 host |
| 118 #endif | 124 #endif |
| 119 #if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM)) | 125 #if (V8_TARGET_ARCH_ARM && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_ARM)) |
| 120 #error Target architecture arm is only supported on arm and ia32 host | 126 #error Target architecture arm is only supported on arm and ia32 host |
| 121 #endif | 127 #endif |
| 128 #if (V8_TARGET_ARCH_A64 && !(V8_HOST_ARCH_X64 || V8_HOST_ARCH_A64)) |
| 129 #error Target architecture a64 is only supported on a64 and x64 host |
| 130 #endif |
| 122 #if (V8_TARGET_ARCH_MIPS && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_MIPS)) | 131 #if (V8_TARGET_ARCH_MIPS && !(V8_HOST_ARCH_IA32 || V8_HOST_ARCH_MIPS)) |
| 123 #error Target architecture mips is only supported on mips and ia32 host | 132 #error Target architecture mips is only supported on mips and ia32 host |
| 124 #endif | 133 #endif |
| 125 | 134 |
| 126 // Determine whether we are running in a simulated environment. | 135 // Determine whether we are running in a simulated environment. |
| 127 // Setting USE_SIMULATOR explicitly from the build script will force | 136 // Setting USE_SIMULATOR explicitly from the build script will force |
| 128 // the use of a simulated environment. | 137 // the use of a simulated environment. |
| 129 #if !defined(USE_SIMULATOR) | 138 #if !defined(USE_SIMULATOR) |
| 139 #if (V8_TARGET_ARCH_A64 && !V8_HOST_ARCH_A64) |
| 140 #define USE_SIMULATOR 1 |
| 141 #endif |
| 130 #if (V8_TARGET_ARCH_ARM && !V8_HOST_ARCH_ARM) | 142 #if (V8_TARGET_ARCH_ARM && !V8_HOST_ARCH_ARM) |
| 131 #define USE_SIMULATOR 1 | 143 #define USE_SIMULATOR 1 |
| 132 #endif | 144 #endif |
| 133 #if (V8_TARGET_ARCH_MIPS && !V8_HOST_ARCH_MIPS) | 145 #if (V8_TARGET_ARCH_MIPS && !V8_HOST_ARCH_MIPS) |
| 134 #define USE_SIMULATOR 1 | 146 #define USE_SIMULATOR 1 |
| 135 #endif | 147 #endif |
| 136 #endif | 148 #endif |
| 137 | 149 |
| 138 // Determine architecture endiannes (we only support little-endian). | 150 // Determine architecture endiannes (we only support little-endian). |
| 139 #if V8_TARGET_ARCH_IA32 | 151 #if V8_TARGET_ARCH_IA32 |
| 140 #define V8_TARGET_LITTLE_ENDIAN 1 | 152 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 141 #elif V8_TARGET_ARCH_X64 | 153 #elif V8_TARGET_ARCH_X64 |
| 142 #define V8_TARGET_LITTLE_ENDIAN 1 | 154 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 143 #elif V8_TARGET_ARCH_ARM | 155 #elif V8_TARGET_ARCH_ARM |
| 144 #define V8_TARGET_LITTLE_ENDIAN 1 | 156 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 157 #elif V8_TARGET_ARCH_A64 |
| 158 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 145 #elif V8_TARGET_ARCH_MIPS | 159 #elif V8_TARGET_ARCH_MIPS |
| 146 #define V8_TARGET_LITTLE_ENDIAN 1 | 160 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 147 #else | 161 #else |
| 148 #error Unknown target architecture endiannes | 162 #error Unknown target architecture endiannes |
| 149 #endif | 163 #endif |
| 150 | 164 |
| 151 // Support for alternative bool type. This is only enabled if the code is | 165 // Support for alternative bool type. This is only enabled if the code is |
| 152 // compiled with USE_MYBOOL defined. This catches some nasty type bugs. | 166 // compiled with USE_MYBOOL defined. This catches some nasty type bugs. |
| 153 // For instance, 'bool b = "false";' results in b == true! This is a hidden | 167 // For instance, 'bool b = "false";' results in b == true! This is a hidden |
| 154 // source of bugs. | 168 // source of bugs. |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 #if __has_feature(address_sanitizer) | 383 #if __has_feature(address_sanitizer) |
| 370 #define DISABLE_ASAN __attribute__((no_sanitize_address)) | 384 #define DISABLE_ASAN __attribute__((no_sanitize_address)) |
| 371 #endif | 385 #endif |
| 372 #endif | 386 #endif |
| 373 | 387 |
| 374 | 388 |
| 375 #ifndef DISABLE_ASAN | 389 #ifndef DISABLE_ASAN |
| 376 #define DISABLE_ASAN | 390 #define DISABLE_ASAN |
| 377 #endif | 391 #endif |
| 378 | 392 |
| 393 #if V8_CC_GNU |
| 394 #define V8_IMMEDIATE_CRASH() __builtin_trap() |
| 395 #else |
| 396 #define V8_IMMEDIATE_CRASH() ((void(*)())0)() |
| 397 #endif |
| 398 |
| 379 | 399 |
| 380 // ----------------------------------------------------------------------------- | 400 // ----------------------------------------------------------------------------- |
| 381 // Forward declarations for frequently used classes | 401 // Forward declarations for frequently used classes |
| 382 // (sorted alphabetically) | 402 // (sorted alphabetically) |
| 383 | 403 |
| 384 class FreeStoreAllocationPolicy; | 404 class FreeStoreAllocationPolicy; |
| 385 template <typename T, class P = FreeStoreAllocationPolicy> class List; | 405 template <typename T, class P = FreeStoreAllocationPolicy> class List; |
| 386 | 406 |
| 387 // ----------------------------------------------------------------------------- | 407 // ----------------------------------------------------------------------------- |
| 388 // Declarations for use in both the preparser and the rest of V8. | 408 // Declarations for use in both the preparser and the rest of V8. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 413 // the backend, so both modes are represented by the kStrictMode value. | 433 // the backend, so both modes are represented by the kStrictMode value. |
| 414 enum StrictModeFlag { | 434 enum StrictModeFlag { |
| 415 kNonStrictMode, | 435 kNonStrictMode, |
| 416 kStrictMode | 436 kStrictMode |
| 417 }; | 437 }; |
| 418 | 438 |
| 419 | 439 |
| 420 } } // namespace v8::internal | 440 } } // namespace v8::internal |
| 421 | 441 |
| 422 #endif // V8_GLOBALS_H_ | 442 #endif // V8_GLOBALS_H_ |
| OLD | NEW |