| 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 10 matching lines...) Expand all Loading... |
| 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT | 21 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, | 22 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 23 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 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. | 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 | 27 |
| 28 #ifndef V8_GLOBALS_H_ | 28 #ifndef V8_GLOBALS_H_ |
| 29 #define V8_GLOBALS_H_ | 29 #define V8_GLOBALS_H_ |
| 30 | 30 |
| 31 // ---------------------------------------------------------------------------- | 31 // Define V8_INFINITY |
| 32 // Operating system detection (V8_OS_x) | 32 #define V8_INFINITY INFINITY |
| 33 // | |
| 34 // ANDROID - Android | |
| 35 // BSD4 - Any BSD 4.4 system | |
| 36 // CYGWIN - Cygwin | |
| 37 // DARWIN - Darwin / Mac OS X | |
| 38 // FREEBSD - FreeBSD | |
| 39 // LINUX - Linux | |
| 40 // NACL - Native Client | |
| 41 // NETBSD - NetBSD | |
| 42 // OPENBSD - OpenBSD | |
| 43 // SOLARIS - Solaris | |
| 44 // UNIX - Any UNIX BSD/SYSV system | |
| 45 // WIN32 - Win32 (Windows 2000/XP/Vista/7 and Windows Server 2003/2008) | |
| 46 | 33 |
| 47 #if defined(ANDROID) || defined(__ANDROID__) | 34 // GCC specific stuff |
| 48 # define V8_OS_ANDROID 1 | 35 #ifdef __GNUC__ |
| 49 # define V8_OS_LINUX 1 | 36 |
| 50 # define V8_OS_UNIX 1 | 37 #define __GNUC_VERSION_FOR_INFTY__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) |
| 51 #elif defined(__APPLE__) && defined(__MACH__) | 38 |
| 52 # define V8_OS_DARWIN 1 | 39 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' |
| 53 # define V8_OS_BSD4 1 | 40 // warning flag and certain versions of GCC due to a bug: |
| 54 # define V8_OS_UNIX 1 | 41 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 |
| 55 #elif defined(__CYGWIN__) | 42 // For now, we use the more involved template-based version from <limits>, but |
| 56 # define V8_OS_CYGWIN 1 | 43 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) |
| 57 # define V8_OS_UNIX 1 | 44 // __GNUC_PREREQ is not defined in GCC for Mac OS X, so we define our own macro |
| 58 #elif defined(WIN64) || defined(_WIN64) || defined(__WIN64__) | 45 #if __GNUC_VERSION_FOR_INFTY__ >= 29600 && __GNUC_VERSION_FOR_INFTY__ < 40100 |
| 59 # define V8_OS_WIN32 1 | 46 #include <limits> |
| 60 # define V8_OS_WIN64 1 | 47 #undef V8_INFINITY |
| 61 #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || \ | 48 #define V8_INFINITY std::numeric_limits<double>::infinity() |
| 62 (defined(__MWERKS__) && defined(__INTEL__)) | 49 #endif |
| 63 # define V8_OS_WIN32 1 | 50 #undef __GNUC_VERSION_FOR_INFTY__ |
| 64 #elif defined(__sun) || defined(sun) | 51 |
| 65 # define V8_OS_SOLARIS 1 | 52 #endif // __GNUC__ |
| 66 # define V8_OS_UNIX 1 | 53 |
| 67 #elif defined(__native_client__) | 54 #ifdef _MSC_VER |
| 68 # define V8_OS_NACL 1 | 55 #undef V8_INFINITY |
| 69 #elif defined(__linux__) || defined(__linux) | 56 #define V8_INFINITY HUGE_VAL |
| 70 # define V8_OS_LINUX 1 | |
| 71 # define V8_OS_UNIX 1 | |
| 72 #elif defined(__FreeBSD__) || defined(__DragonFly__) | |
| 73 # define V8_OS_FREEBSD 1 | |
| 74 # define V8_OS_BSD4 1 | |
| 75 # define V8_OS_UNIX 1 | |
| 76 #elif defined(__NetBSD__) | |
| 77 # define V8_OS_NETBSD 1 | |
| 78 # define V8_OS_BSD4 1 | |
| 79 # define V8_OS_UNIX 1 | |
| 80 #elif defined(__OpenBSD__) | |
| 81 # define V8_OS_OPENBSD 1 | |
| 82 # define V8_OS_BSD4 1 | |
| 83 # define V8_OS_UNIX 1 | |
| 84 #else | |
| 85 # error Operating system was not detected as supported by v8 | |
| 86 #endif | 57 #endif |
| 87 | 58 |
| 88 | 59 |
| 89 // ---------------------------------------------------------------------------- | 60 #include "../include/v8stdint.h" |
| 90 // Compiler detection (V8_CC_x) | |
| 91 // | |
| 92 // CLANG - C++ front-end for the LLVM compiler | |
| 93 // GNU - GNU C++ or compatible | |
| 94 // INTEL - Intel C++ for Linux or Windows | |
| 95 // MINGW - Minimalistic GNU for Windows Compiler | |
| 96 // MIPS - MIPSpro C++ | |
| 97 // MSVC - Microsoft Visual C/C++ or compatible | |
| 98 // RVCT - ARM Realview Compiler Suite | |
| 99 | 61 |
| 100 #if defined(_MSC_VER) | 62 namespace v8 { |
| 101 # define V8_CC_MSVC 1 | 63 namespace internal { |
| 102 # if defined(__INTEL_COMPILER) | |
| 103 # define V8_CC_INTEL 1 | |
| 104 # endif | |
| 105 #elif defined(__GNUC__) | |
| 106 # define V8_CC_GNU 1 | |
| 107 # define V8_GNUC_PREREQ(major, minor) \ | |
| 108 (__GNUC__ > (major) || (__GNUC__ == (major) && __GNUC_MINOR__ >= (minor))) | |
| 109 # if defined(__MINGW64__) | |
| 110 # define V8_CC_MINGW 1 | |
| 111 # define V8_CC_MINGW64 1 | |
| 112 # elif defined(__MINGW32__) | |
| 113 # define V8_CC_MINGW 1 | |
| 114 # define V8_CC_MINGW32 1 | |
| 115 # elif defined(__ARMCC__) || defined(__CC_ARM) | |
| 116 # define V8_CC_RVCT 1 // ARM Realview Compiler Suite also masquerades as GCC | |
| 117 # elif defined(__INTEL_COMPILER) | |
| 118 # define V8_CC_INTEL 1 // Intel C++ also masquerades as GCC 3.2.0 | |
| 119 # elif defined(__clang__) | |
| 120 # define V8_CC_CLANG 1 // Clang also masquerades as GCC 4.2.1 | |
| 121 # endif | |
| 122 #elif defined(__ARMCC__) || defined(__CC_ARM) | |
| 123 # define V8_CC_RVCT 1 | |
| 124 #elif defined(__INTEL_COMPILER) | |
| 125 # define V8_CC_INTEL 1 | |
| 126 #elif defined(__SUNPRO_CC) || defined(__SUNPRO_C) | |
| 127 # define V8_CC_SUN 1 | |
| 128 #else | |
| 129 # error Compiler was not detected as supported by v8 | |
| 130 #endif | |
| 131 | 64 |
| 132 #ifndef V8_GNUC_PREREQ | |
| 133 #define V8_GNUC_PREREQ(major, minor) 0 | |
| 134 #endif | |
| 135 | |
| 136 | |
| 137 // ---------------------------------------------------------------------------- | |
| 138 // Processor architecture detection. For more info on what's defined, see: | 65 // Processor architecture detection. For more info on what's defined, see: |
| 139 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx | 66 // http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
| 140 // http://www.agner.org/optimize/calling_conventions.pdf | 67 // http://www.agner.org/optimize/calling_conventions.pdf |
| 141 // or with gcc, run: "echo | gcc -E -dM -" | 68 // or with gcc, run: "echo | gcc -E -dM -" |
| 142 | |
| 143 #if defined(_M_X64) || defined(__x86_64__) | 69 #if defined(_M_X64) || defined(__x86_64__) |
| 144 #if V8_OS_NACL | 70 #if defined(__native_client__) |
| 145 // For Native Client builds of V8, use V8_TARGET_ARCH_ARM, so that V8 | 71 // For Native Client builds of V8, use V8_TARGET_ARCH_ARM, so that V8 |
| 146 // generates ARM machine code, together with a portable ARM simulator | 72 // generates ARM machine code, together with a portable ARM simulator |
| 147 // compiled for the host architecture in question. | 73 // compiled for the host architecture in question. |
| 148 // | 74 // |
| 149 // Since Native Client is ILP-32 on all architectures we use | 75 // Since Native Client is ILP-32 on all architectures we use |
| 150 // V8_HOST_ARCH_IA32 on both 32- and 64-bit x86. | 76 // V8_HOST_ARCH_IA32 on both 32- and 64-bit x86. |
| 151 #define V8_HOST_ARCH_IA32 1 | 77 #define V8_HOST_ARCH_IA32 1 |
| 152 #define V8_HOST_ARCH_32_BIT 1 | 78 #define V8_HOST_ARCH_32_BIT 1 |
| 153 #define V8_HOST_CAN_READ_UNALIGNED 1 | 79 #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 154 #else | 80 #else |
| 155 #define V8_HOST_ARCH_X64 1 | 81 #define V8_HOST_ARCH_X64 1 |
| 156 #define V8_HOST_ARCH_64_BIT 1 | 82 #define V8_HOST_ARCH_64_BIT 1 |
| 157 #define V8_HOST_CAN_READ_UNALIGNED 1 | 83 #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 158 #endif // V8_OS_NACL | 84 #endif // __native_client__ |
| 159 #elif defined(_M_IX86) || defined(__i386__) | 85 #elif defined(_M_IX86) || defined(__i386__) |
| 160 #define V8_HOST_ARCH_IA32 1 | 86 #define V8_HOST_ARCH_IA32 1 |
| 161 #define V8_HOST_ARCH_32_BIT 1 | 87 #define V8_HOST_ARCH_32_BIT 1 |
| 162 #define V8_HOST_CAN_READ_UNALIGNED 1 | 88 #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 163 #elif defined(__ARMEL__) | 89 #elif defined(__ARMEL__) |
| 164 #define V8_HOST_ARCH_ARM 1 | 90 #define V8_HOST_ARCH_ARM 1 |
| 165 #define V8_HOST_ARCH_32_BIT 1 | 91 #define V8_HOST_ARCH_32_BIT 1 |
| 166 #elif defined(__MIPSEL__) | 92 #elif defined(__MIPSEL__) |
| 167 #define V8_HOST_ARCH_MIPS 1 | 93 #define V8_HOST_ARCH_MIPS 1 |
| 168 #define V8_HOST_ARCH_32_BIT 1 | 94 #define V8_HOST_ARCH_32_BIT 1 |
| 169 #else | 95 #else |
| 170 #error Host architecture was not detected as supported by v8 | 96 #error Host architecture was not detected as supported by v8 |
| 171 #endif | 97 #endif |
| 172 | 98 |
| 173 #if defined(__ARM_ARCH_7A__) || \ | 99 #if defined(__ARM_ARCH_7A__) || \ |
| 174 defined(__ARM_ARCH_7R__) || \ | 100 defined(__ARM_ARCH_7R__) || \ |
| 175 defined(__ARM_ARCH_7__) | 101 defined(__ARM_ARCH_7__) |
| 176 # define CAN_USE_ARMV7_INSTRUCTIONS 1 | 102 # define CAN_USE_ARMV7_INSTRUCTIONS 1 |
| 177 # ifndef CAN_USE_VFP3_INSTRUCTIONS | 103 # ifndef CAN_USE_VFP3_INSTRUCTIONS |
| 178 # define CAN_USE_VFP3_INSTRUCTIONS 1 | 104 # define CAN_USE_VFP3_INSTRUCTIONS |
| 179 # endif | 105 # endif |
| 180 #endif | 106 #endif |
| 181 | 107 |
| 182 | 108 |
| 183 // Target architecture detection. This may be set externally. If not, detect | 109 // Target architecture detection. This may be set externally. If not, detect |
| 184 // in the same way as the host architecture, that is, target the native | 110 // in the same way as the host architecture, that is, target the native |
| 185 // environment as presented by the compiler. | 111 // environment as presented by the compiler. |
| 186 #if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && \ | 112 #if !V8_TARGET_ARCH_X64 && !V8_TARGET_ARCH_IA32 && \ |
| 187 !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_MIPS | 113 !V8_TARGET_ARCH_ARM && !V8_TARGET_ARCH_MIPS |
| 188 #if V8_HOST_ARCH_X64 | 114 #if defined(_M_X64) || defined(__x86_64__) |
| 189 #define V8_TARGET_ARCH_X64 1 | 115 #define V8_TARGET_ARCH_X64 1 |
| 190 #elif V8_HOST_ARCH_IA32 | 116 #elif defined(_M_IX86) || defined(__i386__) |
| 191 #define V8_TARGET_ARCH_IA32 1 | 117 #define V8_TARGET_ARCH_IA32 1 |
| 192 #elif V8_HOST_ARCH_ARM | 118 #elif defined(__ARMEL__) |
| 193 #define V8_TARGET_ARCH_ARM 1 | 119 #define V8_TARGET_ARCH_ARM 1 |
| 194 #elif V8_HOST_ARCH_MIPS | 120 #elif defined(__MIPSEL__) |
| 195 #define V8_TARGET_ARCH_MIPS 1 | 121 #define V8_TARGET_ARCH_MIPS 1 |
| 196 #else | 122 #else |
| 197 #error Target architecture was not detected as supported by v8 | 123 #error Target architecture was not detected as supported by v8 |
| 198 #endif | 124 #endif |
| 199 #endif | 125 #endif |
| 200 | 126 |
| 201 // Check for supported combinations of host and target architectures. | 127 // Check for supported combinations of host and target architectures. |
| 202 #if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32 | 128 #if V8_TARGET_ARCH_IA32 && !V8_HOST_ARCH_IA32 |
| 203 #error Target architecture ia32 is only supported on ia32 host | 129 #error Target architecture ia32 is only supported on ia32 host |
| 204 #endif | 130 #endif |
| (...skipping 25 matching lines...) Expand all Loading... |
| 230 #elif V8_TARGET_ARCH_X64 | 156 #elif V8_TARGET_ARCH_X64 |
| 231 #define V8_TARGET_LITTLE_ENDIAN 1 | 157 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 232 #elif V8_TARGET_ARCH_ARM | 158 #elif V8_TARGET_ARCH_ARM |
| 233 #define V8_TARGET_LITTLE_ENDIAN 1 | 159 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 234 #elif V8_TARGET_ARCH_MIPS | 160 #elif V8_TARGET_ARCH_MIPS |
| 235 #define V8_TARGET_LITTLE_ENDIAN 1 | 161 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 236 #else | 162 #else |
| 237 #error Unknown target architecture endiannes | 163 #error Unknown target architecture endiannes |
| 238 #endif | 164 #endif |
| 239 | 165 |
| 240 // Define V8_INFINITY | |
| 241 #if V8_CC_GNU && V8_GNUC_PREREQ(2, 96) && !V8_GNUC_PREREQ(4, 1) | |
| 242 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' | |
| 243 // warning flag and certain versions of GCC due to a bug: | |
| 244 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 | |
| 245 // For now, we use the more involved template-based version from <limits>, but | |
| 246 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) | |
| 247 #include <limits> | |
| 248 #define V8_INFINITY std::numeric_limits<double>::infinity() | |
| 249 #elif V8_CC_MSVC | |
| 250 #define V8_INFINITY HUGE_VAL | |
| 251 #else | |
| 252 #define V8_INFINITY INFINITY | |
| 253 #endif | |
| 254 | |
| 255 | |
| 256 #include "../include/v8stdint.h" | |
| 257 | |
| 258 namespace v8 { | |
| 259 namespace internal { | |
| 260 | |
| 261 // Support for alternative bool type. This is only enabled if the code is | 166 // Support for alternative bool type. This is only enabled if the code is |
| 262 // compiled with USE_MYBOOL defined. This catches some nasty type bugs. | 167 // compiled with USE_MYBOOL defined. This catches some nasty type bugs. |
| 263 // For instance, 'bool b = "false";' results in b == true! This is a hidden | 168 // For instance, 'bool b = "false";' results in b == true! This is a hidden |
| 264 // source of bugs. | 169 // source of bugs. |
| 265 // However, redefining the bool type does have some negative impact on some | 170 // However, redefining the bool type does have some negative impact on some |
| 266 // platforms. It gives rise to compiler warnings (i.e. with | 171 // platforms. It gives rise to compiler warnings (i.e. with |
| 267 // MSVC) in the API header files when mixing code that uses the standard | 172 // MSVC) in the API header files when mixing code that uses the standard |
| 268 // bool with code that uses the redefined version. | 173 // bool with code that uses the redefined version. |
| 269 // This does not actually belong in the platform code, but needs to be | 174 // This does not actually belong in the platform code, but needs to be |
| 270 // defined here because the platform code uses bool, and platform.h is | 175 // defined here because the platform code uses bool, and platform.h is |
| 271 // include very early in the main include file. | 176 // include very early in the main include file. |
| 272 | 177 |
| 273 #ifdef USE_MYBOOL | 178 #ifdef USE_MYBOOL |
| 274 typedef unsigned int __my_bool__; | 179 typedef unsigned int __my_bool__; |
| 275 #define bool __my_bool__ // use 'indirection' to avoid name clashes | 180 #define bool __my_bool__ // use 'indirection' to avoid name clashes |
| 276 #endif | 181 #endif |
| 277 | 182 |
| 278 typedef uint8_t byte; | 183 typedef uint8_t byte; |
| 279 typedef byte* Address; | 184 typedef byte* Address; |
| 280 | 185 |
| 281 // Define our own macros for writing 64-bit constants. This is less fragile | 186 // Define our own macros for writing 64-bit constants. This is less fragile |
| 282 // than defining __STDC_CONSTANT_MACROS before including <stdint.h>, and it | 187 // than defining __STDC_CONSTANT_MACROS before including <stdint.h>, and it |
| 283 // works on compilers that don't have it (like MSVC). | 188 // works on compilers that don't have it (like MSVC). |
| 284 #if V8_HOST_ARCH_64_BIT | 189 #if V8_HOST_ARCH_64_BIT |
| 285 #if V8_CC_MSVC | 190 #if defined(_MSC_VER) |
| 286 #define V8_UINT64_C(x) (x ## UI64) | 191 #define V8_UINT64_C(x) (x ## UI64) |
| 287 #define V8_INT64_C(x) (x ## I64) | 192 #define V8_INT64_C(x) (x ## I64) |
| 288 #define V8_INTPTR_C(x) (x ## I64) | 193 #define V8_INTPTR_C(x) (x ## I64) |
| 289 #define V8_PTR_PREFIX "ll" | 194 #define V8_PTR_PREFIX "ll" |
| 290 #elif V8_CC_MINGW64 | 195 #elif defined(__MINGW64__) |
| 291 #define V8_UINT64_C(x) (x ## ULL) | 196 #define V8_UINT64_C(x) (x ## ULL) |
| 292 #define V8_INT64_C(x) (x ## LL) | 197 #define V8_INT64_C(x) (x ## LL) |
| 293 #define V8_INTPTR_C(x) (x ## LL) | 198 #define V8_INTPTR_C(x) (x ## LL) |
| 294 #define V8_PTR_PREFIX "I64" | 199 #define V8_PTR_PREFIX "I64" |
| 295 #else | 200 #else |
| 296 #define V8_UINT64_C(x) (x ## UL) | 201 #define V8_UINT64_C(x) (x ## UL) |
| 297 #define V8_INT64_C(x) (x ## L) | 202 #define V8_INT64_C(x) (x ## L) |
| 298 #define V8_INTPTR_C(x) (x ## L) | 203 #define V8_INTPTR_C(x) (x ## L) |
| 299 #define V8_PTR_PREFIX "l" | 204 #define V8_PTR_PREFIX "l" |
| 300 #endif | 205 #endif |
| 301 #else // V8_HOST_ARCH_64_BIT | 206 #else // V8_HOST_ARCH_64_BIT |
| 302 #define V8_INTPTR_C(x) (x) | 207 #define V8_INTPTR_C(x) (x) |
| 303 #define V8_PTR_PREFIX "" | 208 #define V8_PTR_PREFIX "" |
| 304 #endif // V8_HOST_ARCH_64_BIT | 209 #endif // V8_HOST_ARCH_64_BIT |
| 305 | 210 |
| 306 // The following macro works on both 32 and 64-bit platforms. | 211 // The following macro works on both 32 and 64-bit platforms. |
| 307 // Usage: instead of writing 0x1234567890123456 | 212 // Usage: instead of writing 0x1234567890123456 |
| 308 // write V8_2PART_UINT64_C(0x12345678,90123456); | 213 // write V8_2PART_UINT64_C(0x12345678,90123456); |
| 309 #define V8_2PART_UINT64_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u)) | 214 #define V8_2PART_UINT64_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u)) |
| 310 | 215 |
| 311 #define V8PRIxPTR V8_PTR_PREFIX "x" | 216 #define V8PRIxPTR V8_PTR_PREFIX "x" |
| 312 #define V8PRIdPTR V8_PTR_PREFIX "d" | 217 #define V8PRIdPTR V8_PTR_PREFIX "d" |
| 313 #define V8PRIuPTR V8_PTR_PREFIX "u" | 218 #define V8PRIuPTR V8_PTR_PREFIX "u" |
| 314 | 219 |
| 315 // Fix for Mac OS X defining uintptr_t as "unsigned long": | 220 // Fix for Mac OS X defining uintptr_t as "unsigned long": |
| 316 #if V8_OS_DARWIN | 221 #if defined(__APPLE__) && defined(__MACH__) |
| 317 #undef V8PRIxPTR | 222 #undef V8PRIxPTR |
| 318 #define V8PRIxPTR "lx" | 223 #define V8PRIxPTR "lx" |
| 319 #endif | 224 #endif |
| 320 | 225 |
| 226 #if (defined(__APPLE__) && defined(__MACH__)) || \ |
| 227 defined(__FreeBSD__) || defined(__OpenBSD__) |
| 228 #define USING_BSD_ABI |
| 229 #endif |
| 230 |
| 321 // ----------------------------------------------------------------------------- | 231 // ----------------------------------------------------------------------------- |
| 322 // Constants | 232 // Constants |
| 323 | 233 |
| 324 const int KB = 1024; | 234 const int KB = 1024; |
| 325 const int MB = KB * KB; | 235 const int MB = KB * KB; |
| 326 const int GB = KB * KB * KB; | 236 const int GB = KB * KB * KB; |
| 327 const int kMaxInt = 0x7FFFFFFF; | 237 const int kMaxInt = 0x7FFFFFFF; |
| 328 const int kMinInt = -kMaxInt - 1; | 238 const int kMinInt = -kMaxInt - 1; |
| 329 | 239 |
| 330 const uint32_t kMaxUInt32 = 0xFFFFFFFFu; | 240 const uint32_t kMaxUInt32 = 0xFFFFFFFFu; |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 // that wants to prevent anyone from instantiating it. This is | 351 // that wants to prevent anyone from instantiating it. This is |
| 442 // especially useful for classes containing only static methods. | 352 // especially useful for classes containing only static methods. |
| 443 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ | 353 #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ |
| 444 TypeName() DISALLOW_BY_DELETE; \ | 354 TypeName() DISALLOW_BY_DELETE; \ |
| 445 DISALLOW_COPY_AND_ASSIGN(TypeName) | 355 DISALLOW_COPY_AND_ASSIGN(TypeName) |
| 446 | 356 |
| 447 | 357 |
| 448 // Define used for helping GCC to make better inlining. Don't bother for debug | 358 // Define used for helping GCC to make better inlining. Don't bother for debug |
| 449 // builds. On GCC 3.4.5 using __attribute__((always_inline)) causes compilation | 359 // builds. On GCC 3.4.5 using __attribute__((always_inline)) causes compilation |
| 450 // errors in debug build. | 360 // errors in debug build. |
| 451 #if V8_CC_GNU && !defined(DEBUG) | 361 #if defined(__GNUC__) && !defined(DEBUG) |
| 452 #if V8_GNUC_PREREQ(4, 0) | 362 #if (__GNUC__ >= 4) |
| 453 #define INLINE(header) inline header __attribute__((always_inline)) | 363 #define INLINE(header) inline header __attribute__((always_inline)) |
| 454 #define NO_INLINE(header) header __attribute__((noinline)) | 364 #define NO_INLINE(header) header __attribute__((noinline)) |
| 455 #else | 365 #else |
| 456 #define INLINE(header) inline __attribute__((always_inline)) header | 366 #define INLINE(header) inline __attribute__((always_inline)) header |
| 457 #define NO_INLINE(header) __attribute__((noinline)) header | 367 #define NO_INLINE(header) __attribute__((noinline)) header |
| 458 #endif | 368 #endif |
| 459 #elif V8_CC_MSVC && !defined(DEBUG) | 369 #elif defined(_MSC_VER) && !defined(DEBUG) |
| 460 #define INLINE(header) __forceinline header | 370 #define INLINE(header) __forceinline header |
| 461 #define NO_INLINE(header) header | 371 #define NO_INLINE(header) header |
| 462 #else | 372 #else |
| 463 #define INLINE(header) inline header | 373 #define INLINE(header) inline header |
| 464 #define NO_INLINE(header) header | 374 #define NO_INLINE(header) header |
| 465 #endif | 375 #endif |
| 466 | 376 |
| 467 | 377 |
| 468 #if V8_GNUC_PREREQ(4, 0) | 378 #if defined(__GNUC__) && __GNUC__ >= 4 |
| 469 #define MUST_USE_RESULT __attribute__ ((warn_unused_result)) | 379 #define MUST_USE_RESULT __attribute__ ((warn_unused_result)) |
| 470 #else | 380 #else |
| 471 #define MUST_USE_RESULT | 381 #define MUST_USE_RESULT |
| 472 #endif | 382 #endif |
| 473 | 383 |
| 474 | 384 |
| 475 // Define DISABLE_ASAN macros. | 385 // Define DISABLE_ASAN macros. |
| 476 #if defined(__has_feature) | 386 #if defined(__has_feature) |
| 477 #if __has_feature(address_sanitizer) | 387 #if __has_feature(address_sanitizer) |
| 478 #define DISABLE_ASAN __attribute__((no_address_safety_analysis)) | 388 #define DISABLE_ASAN __attribute__((no_address_safety_analysis)) |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 533 // the backend, so both modes are represented by the kStrictMode value. | 443 // the backend, so both modes are represented by the kStrictMode value. |
| 534 enum StrictModeFlag { | 444 enum StrictModeFlag { |
| 535 kNonStrictMode, | 445 kNonStrictMode, |
| 536 kStrictMode | 446 kStrictMode |
| 537 }; | 447 }; |
| 538 | 448 |
| 539 | 449 |
| 540 } } // namespace v8::internal | 450 } } // namespace v8::internal |
| 541 | 451 |
| 542 #endif // V8_GLOBALS_H_ | 452 #endif // V8_GLOBALS_H_ |
| OLD | NEW |