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