OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
288 | 288 |
289 # define V8_HAS___FORCEINLINE 1 | 289 # define V8_HAS___FORCEINLINE 1 |
290 | 290 |
291 #endif | 291 #endif |
292 | 292 |
293 | 293 |
294 // ----------------------------------------------------------------------------- | 294 // ----------------------------------------------------------------------------- |
295 // Helper macros | 295 // Helper macros |
296 | 296 |
297 // A macro used to make better inlining. Don't bother for debug builds. | 297 // A macro used to make better inlining. Don't bother for debug builds. |
| 298 // Use like: |
| 299 // V8_INLINE int GetZero() { return 0; } |
298 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE | 300 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE |
299 # define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator | 301 # define V8_INLINE inline __attribute__((always_inline)) |
300 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE | 302 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE |
301 # define V8_INLINE(declarator) __forceinline declarator | 303 # define V8_INLINE __forceinline |
302 #else | 304 #else |
303 # define V8_INLINE(declarator) inline declarator | 305 # define V8_INLINE inline |
304 #endif | 306 #endif |
305 | 307 |
306 | 308 |
307 // A macro used to tell the compiler to never inline a particular function. | 309 // A macro used to tell the compiler to never inline a particular function. |
308 // Don't bother for debug builds. | 310 // Don't bother for debug builds. |
| 311 // Use like: |
| 312 // V8_NOINLINE int GetMinusOne() { return -1; } |
309 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE | 313 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE |
310 # define V8_NOINLINE(declarator) __attribute__((noinline)) declarator | 314 # define V8_NOINLINE __attribute__((noinline)) |
311 #elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE | 315 #elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE |
312 # define V8_NOINLINE(declarator) __declspec(noinline) declarator | 316 # define V8_NOINLINE __declspec(noinline) |
313 #else | 317 #else |
314 # define V8_NOINLINE(declarator) declarator | 318 # define V8_NOINLINE /* NOT SUPPORTED */ |
315 #endif | 319 #endif |
316 | 320 |
317 | 321 |
318 // A macro to mark classes or functions as deprecated. | 322 // A macro to mark classes or functions as deprecated. |
319 #if !V8_DISABLE_DEPRECATIONS && V8_HAS_ATTRIBUTE_DEPRECATED | 323 #if !V8_DISABLE_DEPRECATIONS && V8_HAS_ATTRIBUTE_DEPRECATED |
320 # define V8_DEPRECATED(declarator) declarator __attribute__((deprecated)) | 324 # define V8_DEPRECATED(declarator) declarator __attribute__((deprecated)) |
321 #elif !V8_DISABLE_DEPRECATIONS && V8_HAS_DECLSPEC_DEPRECATED | 325 #elif !V8_DISABLE_DEPRECATIONS && V8_HAS_DECLSPEC_DEPRECATED |
322 # define V8_DEPRECATED(declarator) __declspec(deprecated) declarator | 326 # define V8_DEPRECATED(declarator) __declspec(deprecated) declarator |
323 #else | 327 #else |
324 # define V8_DEPRECATED(declarator) declarator | 328 # define V8_DEPRECATED(declarator) declarator |
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 # define V8_ALIGNOF(type) __alignof__(type) | 442 # define V8_ALIGNOF(type) __alignof__(type) |
439 #else | 443 #else |
440 // Note that alignment of a type within a struct can be less than the | 444 // Note that alignment of a type within a struct can be less than the |
441 // alignment of the type stand-alone (because of ancient ABIs), so this | 445 // alignment of the type stand-alone (because of ancient ABIs), so this |
442 // should only be used as a last resort. | 446 // should only be used as a last resort. |
443 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; } | 447 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; } |
444 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type)) | 448 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type)) |
445 #endif | 449 #endif |
446 | 450 |
447 #endif // V8CONFIG_H_ | 451 #endif // V8CONFIG_H_ |
OLD | NEW |