Ben Murdoch | 3fb3ca8 | 2011-12-02 17:19:32 +0000 | [diff] [blame] | 1 | // Copyright 2011 the V8 project authors. All rights reserved. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 2 | // Redistribution and use in source and binary forms, with or without |
| 3 | // modification, are permitted provided that the following conditions are |
| 4 | // met: |
| 5 | // |
| 6 | // * Redistributions of source code must retain the above copyright |
| 7 | // notice, this list of conditions and the following disclaimer. |
| 8 | // * Redistributions in binary form must reproduce the above |
| 9 | // copyright notice, this list of conditions and the following |
| 10 | // disclaimer in the documentation and/or other materials provided |
| 11 | // with the distribution. |
| 12 | // * Neither the name of Google Inc. nor the names of its |
| 13 | // contributors may be used to endorse or promote products derived |
| 14 | // from this software without specific prior written permission. |
| 15 | // |
| 16 | // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 17 | // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 18 | // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 19 | // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 20 | // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 21 | // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 22 | // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 23 | // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 24 | // THEORY 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 | #ifndef V8_GLOBALS_H_ |
| 29 | #define V8_GLOBALS_H_ |
| 30 | |
Ben Murdoch | 589d697 | 2011-11-30 16:04:58 +0000 | [diff] [blame^] | 31 | // Define V8_INFINITY |
| 32 | #define V8_INFINITY INFINITY |
| 33 | |
| 34 | // GCC specific stuff |
| 35 | #ifdef __GNUC__ |
| 36 | |
| 37 | #define __GNUC_VERSION_FOR_INFTY__ (__GNUC__ * 10000 + __GNUC_MINOR__ * 100) |
| 38 | |
| 39 | // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' |
| 40 | // warning flag and certain versions of GCC due to a bug: |
| 41 | // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 |
| 42 | // For now, we use the more involved template-based version from <limits>, but |
| 43 | // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) |
| 44 | // __GNUC_PREREQ is not defined in GCC for Mac OS X, so we define our own macro |
| 45 | #if __GNUC_VERSION_FOR_INFTY__ >= 29600 && __GNUC_VERSION_FOR_INFTY__ < 40100 |
| 46 | #include <limits> |
| 47 | #undef V8_INFINITY |
| 48 | #define V8_INFINITY std::numeric_limits<double>::infinity() |
| 49 | #endif |
| 50 | #undef __GNUC_VERSION_FOR_INFTY__ |
| 51 | |
| 52 | #endif // __GNUC__ |
| 53 | |
| 54 | #ifdef _MSC_VER |
| 55 | #undef V8_INFINITY |
| 56 | #define V8_INFINITY HUGE_VAL |
| 57 | #endif |
| 58 | |
| 59 | |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 60 | #include "../include/v8stdint.h" |
| 61 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 62 | namespace v8 { |
| 63 | namespace internal { |
| 64 | |
| 65 | // Processor architecture detection. For more info on what's defined, see: |
| 66 | // http://msdn.microsoft.com/en-us/library/b0084kay.aspx |
| 67 | // http://www.agner.org/optimize/calling_conventions.pdf |
| 68 | // or with gcc, run: "echo | gcc -E -dM -" |
| 69 | #if defined(_M_X64) || defined(__x86_64__) |
| 70 | #define V8_HOST_ARCH_X64 1 |
| 71 | #define V8_HOST_ARCH_64_BIT 1 |
| 72 | #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 73 | #elif defined(_M_IX86) || defined(__i386__) |
| 74 | #define V8_HOST_ARCH_IA32 1 |
| 75 | #define V8_HOST_ARCH_32_BIT 1 |
| 76 | #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 77 | #elif defined(__ARMEL__) |
| 78 | #define V8_HOST_ARCH_ARM 1 |
| 79 | #define V8_HOST_ARCH_32_BIT 1 |
Kristian Monsen | 25f6136 | 2010-05-21 11:50:48 +0100 | [diff] [blame] | 80 | // Some CPU-OS combinations allow unaligned access on ARM. We assume |
| 81 | // that unaligned accesses are not allowed unless the build system |
| 82 | // defines the CAN_USE_UNALIGNED_ACCESSES macro to be non-zero. |
| 83 | #if CAN_USE_UNALIGNED_ACCESSES |
| 84 | #define V8_HOST_CAN_READ_UNALIGNED 1 |
| 85 | #endif |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 86 | #elif defined(__MIPSEL__) |
Andrei Popescu | 3100271 | 2010-02-23 13:46:05 +0000 | [diff] [blame] | 87 | #define V8_HOST_ARCH_MIPS 1 |
| 88 | #define V8_HOST_ARCH_32_BIT 1 |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 89 | #else |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 90 | #error Host architecture was not detected as supported by v8 |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 91 | #endif |
| 92 | |
Leon Clarke | f7060e2 | 2010-06-03 12:02:55 +0100 | [diff] [blame] | 93 | // Target architecture detection. This may be set externally. If not, detect |
| 94 | // in the same way as the host architecture, that is, target the native |
| 95 | // environment as presented by the compiler. |
| 96 | #if !defined(V8_TARGET_ARCH_X64) && !defined(V8_TARGET_ARCH_IA32) && \ |
| 97 | !defined(V8_TARGET_ARCH_ARM) && !defined(V8_TARGET_ARCH_MIPS) |
| 98 | #if defined(_M_X64) || defined(__x86_64__) |
| 99 | #define V8_TARGET_ARCH_X64 1 |
| 100 | #elif defined(_M_IX86) || defined(__i386__) |
| 101 | #define V8_TARGET_ARCH_IA32 1 |
| 102 | #elif defined(__ARMEL__) |
| 103 | #define V8_TARGET_ARCH_ARM 1 |
Steve Block | 44f0eee | 2011-05-26 01:26:41 +0100 | [diff] [blame] | 104 | #elif defined(__MIPSEL__) |
Leon Clarke | f7060e2 | 2010-06-03 12:02:55 +0100 | [diff] [blame] | 105 | #define V8_TARGET_ARCH_MIPS 1 |
| 106 | #else |
| 107 | #error Target architecture was not detected as supported by v8 |
| 108 | #endif |
| 109 | #endif |
| 110 | |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 111 | // Check for supported combinations of host and target architectures. |
| 112 | #if defined(V8_TARGET_ARCH_IA32) && !defined(V8_HOST_ARCH_IA32) |
| 113 | #error Target architecture ia32 is only supported on ia32 host |
| 114 | #endif |
| 115 | #if defined(V8_TARGET_ARCH_X64) && !defined(V8_HOST_ARCH_X64) |
| 116 | #error Target architecture x64 is only supported on x64 host |
| 117 | #endif |
| 118 | #if (defined(V8_TARGET_ARCH_ARM) && \ |
| 119 | !(defined(V8_HOST_ARCH_IA32) || defined(V8_HOST_ARCH_ARM))) |
| 120 | #error Target architecture arm is only supported on arm and ia32 host |
| 121 | #endif |
| 122 | #if (defined(V8_TARGET_ARCH_MIPS) && \ |
| 123 | !(defined(V8_HOST_ARCH_IA32) || defined(V8_HOST_ARCH_MIPS))) |
| 124 | #error Target architecture mips is only supported on mips and ia32 host |
| 125 | #endif |
| 126 | |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 127 | // Determine whether we are running in a simulated environment. |
| 128 | // Setting USE_SIMULATOR explicitly from the build script will force |
| 129 | // the use of a simulated environment. |
| 130 | #if !defined(USE_SIMULATOR) |
| 131 | #if (defined(V8_TARGET_ARCH_ARM) && !defined(V8_HOST_ARCH_ARM)) |
| 132 | #define USE_SIMULATOR 1 |
| 133 | #endif |
| 134 | #if (defined(V8_TARGET_ARCH_MIPS) && !defined(V8_HOST_ARCH_MIPS)) |
| 135 | #define USE_SIMULATOR 1 |
| 136 | #endif |
| 137 | #endif |
| 138 | |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 139 | // Define unaligned read for the target architectures supporting it. |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 140 | #if defined(V8_TARGET_ARCH_X64) || defined(V8_TARGET_ARCH_IA32) |
| 141 | #define V8_TARGET_CAN_READ_UNALIGNED 1 |
| 142 | #elif V8_TARGET_ARCH_ARM |
Kristian Monsen | 25f6136 | 2010-05-21 11:50:48 +0100 | [diff] [blame] | 143 | // Some CPU-OS combinations allow unaligned access on ARM. We assume |
| 144 | // that unaligned accesses are not allowed unless the build system |
| 145 | // defines the CAN_USE_UNALIGNED_ACCESSES macro to be non-zero. |
| 146 | #if CAN_USE_UNALIGNED_ACCESSES |
| 147 | #define V8_TARGET_CAN_READ_UNALIGNED 1 |
| 148 | #endif |
Andrei Popescu | 3100271 | 2010-02-23 13:46:05 +0000 | [diff] [blame] | 149 | #elif V8_TARGET_ARCH_MIPS |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 150 | #else |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 151 | #error Target architecture is not supported by v8 |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 152 | #endif |
| 153 | |
| 154 | // Support for alternative bool type. This is only enabled if the code is |
| 155 | // compiled with USE_MYBOOL defined. This catches some nasty type bugs. |
| 156 | // For instance, 'bool b = "false";' results in b == true! This is a hidden |
| 157 | // source of bugs. |
| 158 | // However, redefining the bool type does have some negative impact on some |
| 159 | // platforms. It gives rise to compiler warnings (i.e. with |
| 160 | // MSVC) in the API header files when mixing code that uses the standard |
| 161 | // bool with code that uses the redefined version. |
| 162 | // This does not actually belong in the platform code, but needs to be |
| 163 | // defined here because the platform code uses bool, and platform.h is |
| 164 | // include very early in the main include file. |
| 165 | |
| 166 | #ifdef USE_MYBOOL |
| 167 | typedef unsigned int __my_bool__; |
| 168 | #define bool __my_bool__ // use 'indirection' to avoid name clashes |
| 169 | #endif |
| 170 | |
| 171 | typedef uint8_t byte; |
| 172 | typedef byte* Address; |
| 173 | |
| 174 | // Define our own macros for writing 64-bit constants. This is less fragile |
| 175 | // than defining __STDC_CONSTANT_MACROS before including <stdint.h>, and it |
| 176 | // works on compilers that don't have it (like MSVC). |
| 177 | #if V8_HOST_ARCH_64_BIT |
| 178 | #ifdef _MSC_VER |
| 179 | #define V8_UINT64_C(x) (x ## UI64) |
| 180 | #define V8_INT64_C(x) (x ## I64) |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 181 | #define V8_INTPTR_C(x) (x ## I64) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 182 | #define V8_PTR_PREFIX "ll" |
| 183 | #else // _MSC_VER |
| 184 | #define V8_UINT64_C(x) (x ## UL) |
| 185 | #define V8_INT64_C(x) (x ## L) |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 186 | #define V8_INTPTR_C(x) (x ## L) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 187 | #define V8_PTR_PREFIX "l" |
| 188 | #endif // _MSC_VER |
| 189 | #else // V8_HOST_ARCH_64_BIT |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 190 | #define V8_INTPTR_C(x) (x) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 191 | #define V8_PTR_PREFIX "" |
| 192 | #endif // V8_HOST_ARCH_64_BIT |
| 193 | |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 194 | // The following macro works on both 32 and 64-bit platforms. |
| 195 | // Usage: instead of writing 0x1234567890123456 |
| 196 | // write V8_2PART_UINT64_C(0x12345678,90123456); |
| 197 | #define V8_2PART_UINT64_C(a, b) (((static_cast<uint64_t>(a) << 32) + 0x##b##u)) |
| 198 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 199 | #define V8PRIxPTR V8_PTR_PREFIX "x" |
| 200 | #define V8PRIdPTR V8_PTR_PREFIX "d" |
| 201 | |
| 202 | // Fix for Mac OS X defining uintptr_t as "unsigned long": |
| 203 | #if defined(__APPLE__) && defined(__MACH__) |
| 204 | #undef V8PRIxPTR |
| 205 | #define V8PRIxPTR "lx" |
| 206 | #endif |
| 207 | |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 208 | #if (defined(__APPLE__) && defined(__MACH__)) || \ |
| 209 | defined(__FreeBSD__) || defined(__OpenBSD__) |
| 210 | #define USING_BSD_ABI |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 211 | #endif |
| 212 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 213 | // ----------------------------------------------------------------------------- |
| 214 | // Constants |
| 215 | |
| 216 | const int KB = 1024; |
| 217 | const int MB = KB * KB; |
| 218 | const int GB = KB * KB * KB; |
| 219 | const int kMaxInt = 0x7FFFFFFF; |
| 220 | const int kMinInt = -kMaxInt - 1; |
| 221 | |
| 222 | const uint32_t kMaxUInt32 = 0xFFFFFFFFu; |
| 223 | |
| 224 | const int kCharSize = sizeof(char); // NOLINT |
| 225 | const int kShortSize = sizeof(short); // NOLINT |
Shimeng (Simon) Wang | 8a31eba | 2010-12-06 19:01:33 -0800 | [diff] [blame] | 226 | const int kIntSize = sizeof(int); // NOLINT |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 227 | const int kDoubleSize = sizeof(double); // NOLINT |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 228 | const int kIntptrSize = sizeof(intptr_t); // NOLINT |
Shimeng (Simon) Wang | 8a31eba | 2010-12-06 19:01:33 -0800 | [diff] [blame] | 229 | const int kPointerSize = sizeof(void*); // NOLINT |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 230 | |
Ben Murdoch | 3fb3ca8 | 2011-12-02 17:19:32 +0000 | [diff] [blame] | 231 | const int kDoubleSizeLog2 = 3; |
| 232 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 233 | #if V8_HOST_ARCH_64_BIT |
| 234 | const int kPointerSizeLog2 = 3; |
| 235 | const intptr_t kIntptrSignBit = V8_INT64_C(0x8000000000000000); |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 236 | const uintptr_t kUintptrAllBitsSet = V8_UINT64_C(0xFFFFFFFFFFFFFFFF); |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 237 | #else |
| 238 | const int kPointerSizeLog2 = 2; |
| 239 | const intptr_t kIntptrSignBit = 0x80000000; |
John Reck | 5913587 | 2010-11-02 12:39:01 -0700 | [diff] [blame] | 240 | const uintptr_t kUintptrAllBitsSet = 0xFFFFFFFFu; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 241 | #endif |
| 242 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 243 | const int kBitsPerByte = 8; |
| 244 | const int kBitsPerByteLog2 = 3; |
| 245 | const int kBitsPerPointer = kPointerSize * kBitsPerByte; |
| 246 | const int kBitsPerInt = kIntSize * kBitsPerByte; |
| 247 | |
Steve Block | 6ded16b | 2010-05-10 14:33:55 +0100 | [diff] [blame] | 248 | // IEEE 754 single precision floating point number bit layout. |
| 249 | const uint32_t kBinary32SignMask = 0x80000000u; |
| 250 | const uint32_t kBinary32ExponentMask = 0x7f800000u; |
| 251 | const uint32_t kBinary32MantissaMask = 0x007fffffu; |
| 252 | const int kBinary32ExponentBias = 127; |
| 253 | const int kBinary32MaxExponent = 0xFE; |
| 254 | const int kBinary32MinExponent = 0x01; |
| 255 | const int kBinary32MantissaBits = 23; |
| 256 | const int kBinary32ExponentShift = 23; |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 257 | |
Steve Block | 9fac840 | 2011-05-12 15:51:54 +0100 | [diff] [blame] | 258 | // ASCII/UC16 constants |
| 259 | // Code-point values in Unicode 4.0 are 21 bits wide. |
| 260 | typedef uint16_t uc16; |
| 261 | typedef int32_t uc32; |
| 262 | const int kASCIISize = kCharSize; |
| 263 | const int kUC16Size = sizeof(uc16); // NOLINT |
| 264 | const uc32 kMaxAsciiCharCode = 0x7f; |
| 265 | const uint32_t kMaxAsciiCharCodeU = 0x7fu; |
| 266 | |
Ben Murdoch | b0fe162 | 2011-05-05 13:52:32 +0100 | [diff] [blame] | 267 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 268 | // The expression OFFSET_OF(type, field) computes the byte-offset |
| 269 | // of the specified field relative to the containing type. This |
| 270 | // corresponds to 'offsetof' (in stddef.h), except that it doesn't |
| 271 | // use 0 or NULL, which causes a problem with the compiler warnings |
| 272 | // we have enabled (which is also why 'offsetof' doesn't seem to work). |
| 273 | // Here we simply use the non-zero value 4, which seems to work. |
| 274 | #define OFFSET_OF(type, field) \ |
| 275 | (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4) |
| 276 | |
| 277 | |
| 278 | // The expression ARRAY_SIZE(a) is a compile-time constant of type |
| 279 | // size_t which represents the number of elements of the given |
| 280 | // array. You should only use ARRAY_SIZE on statically allocated |
| 281 | // arrays. |
| 282 | #define ARRAY_SIZE(a) \ |
| 283 | ((sizeof(a) / sizeof(*(a))) / \ |
| 284 | static_cast<size_t>(!(sizeof(a) % sizeof(*(a))))) |
| 285 | |
| 286 | |
| 287 | // The USE(x) template is used to silence C++ compiler warnings |
| 288 | // issued for (yet) unused variables (typically parameters). |
| 289 | template <typename T> |
| 290 | static inline void USE(T) { } |
| 291 | |
| 292 | |
| 293 | // FUNCTION_ADDR(f) gets the address of a C function f. |
| 294 | #define FUNCTION_ADDR(f) \ |
| 295 | (reinterpret_cast<v8::internal::Address>(reinterpret_cast<intptr_t>(f))) |
| 296 | |
| 297 | |
| 298 | // FUNCTION_CAST<F>(addr) casts an address into a function |
| 299 | // of type F. Used to invoke generated code from within C. |
| 300 | template <typename F> |
| 301 | F FUNCTION_CAST(Address addr) { |
| 302 | return reinterpret_cast<F>(reinterpret_cast<intptr_t>(addr)); |
| 303 | } |
| 304 | |
| 305 | |
| 306 | // A macro to disallow the evil copy constructor and operator= functions |
| 307 | // This should be used in the private: declarations for a class |
| 308 | #define DISALLOW_COPY_AND_ASSIGN(TypeName) \ |
| 309 | TypeName(const TypeName&); \ |
| 310 | void operator=(const TypeName&) |
| 311 | |
| 312 | |
| 313 | // A macro to disallow all the implicit constructors, namely the |
| 314 | // default constructor, copy constructor and operator= functions. |
| 315 | // |
| 316 | // This should be used in the private: declarations for a class |
| 317 | // that wants to prevent anyone from instantiating it. This is |
| 318 | // especially useful for classes containing only static methods. |
| 319 | #define DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \ |
| 320 | TypeName(); \ |
| 321 | DISALLOW_COPY_AND_ASSIGN(TypeName) |
| 322 | |
| 323 | |
Kristian Monsen | 80d68ea | 2010-09-08 11:05:35 +0100 | [diff] [blame] | 324 | // Define used for helping GCC to make better inlining. Don't bother for debug |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 325 | // builds. On GCC 3.4.5 using __attribute__((always_inline)) causes compilation |
| 326 | // errors in debug build. |
| 327 | #if defined(__GNUC__) && !defined(DEBUG) |
| 328 | #if (__GNUC__ >= 4) |
| 329 | #define INLINE(header) inline header __attribute__((always_inline)) |
Ben Murdoch | bb769b2 | 2010-08-11 14:56:33 +0100 | [diff] [blame] | 330 | #define NO_INLINE(header) header __attribute__((noinline)) |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 331 | #else |
| 332 | #define INLINE(header) inline __attribute__((always_inline)) header |
Ben Murdoch | bb769b2 | 2010-08-11 14:56:33 +0100 | [diff] [blame] | 333 | #define NO_INLINE(header) __attribute__((noinline)) header |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 334 | #endif |
| 335 | #else |
| 336 | #define INLINE(header) inline header |
Ben Murdoch | bb769b2 | 2010-08-11 14:56:33 +0100 | [diff] [blame] | 337 | #define NO_INLINE(header) header |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 338 | #endif |
| 339 | |
Kristian Monsen | 80d68ea | 2010-09-08 11:05:35 +0100 | [diff] [blame] | 340 | |
| 341 | #if defined(__GNUC__) && __GNUC__ >= 4 |
| 342 | #define MUST_USE_RESULT __attribute__ ((warn_unused_result)) |
| 343 | #else |
| 344 | #define MUST_USE_RESULT |
| 345 | #endif |
| 346 | |
Shimeng (Simon) Wang | 8a31eba | 2010-12-06 19:01:33 -0800 | [diff] [blame] | 347 | // ----------------------------------------------------------------------------- |
| 348 | // Forward declarations for frequently used classes |
| 349 | // (sorted alphabetically) |
Kristian Monsen | 80d68ea | 2010-09-08 11:05:35 +0100 | [diff] [blame] | 350 | |
Shimeng (Simon) Wang | 8a31eba | 2010-12-06 19:01:33 -0800 | [diff] [blame] | 351 | class FreeStoreAllocationPolicy; |
| 352 | template <typename T, class P = FreeStoreAllocationPolicy> class List; |
Steve Block | d0582a6 | 2009-12-15 09:54:21 +0000 | [diff] [blame] | 353 | |
Steve Block | a7e24c1 | 2009-10-30 11:49:00 +0000 | [diff] [blame] | 354 | } } // namespace v8::internal |
| 355 | |
| 356 | #endif // V8_GLOBALS_H_ |