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 280 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 | 291 |
292 # define V8_HAS___FORCEINLINE 1 | 292 # define V8_HAS___FORCEINLINE 1 |
293 | 293 |
294 #endif | 294 #endif |
295 | 295 |
296 | 296 |
297 // ----------------------------------------------------------------------------- | 297 // ----------------------------------------------------------------------------- |
298 // Helper macros | 298 // Helper macros |
299 | 299 |
300 // A macro used to make better inlining. Don't bother for debug builds. | 300 // A macro used to make better inlining. Don't bother for debug builds. |
| 301 // Use like: |
| 302 // V8_INLINE int GetZero() { return 0; } |
301 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE | 303 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_ALWAYS_INLINE |
302 # define V8_INLINE(declarator) inline __attribute__((always_inline)) declarator | 304 # define V8_INLINE inline __attribute__((always_inline)) |
303 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE | 305 #elif !defined(DEBUG) && V8_HAS___FORCEINLINE |
304 # define V8_INLINE(declarator) __forceinline declarator | 306 # define V8_INLINE __forceinline |
305 #else | 307 #else |
306 # define V8_INLINE(declarator) inline declarator | 308 # define V8_INLINE inline |
307 #endif | 309 #endif |
308 | 310 |
309 | 311 |
310 // A macro used to tell the compiler to never inline a particular function. | 312 // A macro used to tell the compiler to never inline a particular function. |
311 // Don't bother for debug builds. | 313 // Don't bother for debug builds. |
| 314 // Use like: |
| 315 // V8_NOINLINE int GetMinusOne() { return -1; } |
312 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE | 316 #if !defined(DEBUG) && V8_HAS_ATTRIBUTE_NOINLINE |
313 # define V8_NOINLINE(declarator) __attribute__((noinline)) declarator | 317 # define V8_NOINLINE __attribute__((noinline)) |
314 #elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE | 318 #elif !defined(DEBUG) && V8_HAS_DECLSPEC_NOINLINE |
315 # define V8_NOINLINE(declarator) __declspec(noinline) declarator | 319 # define V8_NOINLINE __declspec(noinline) |
316 #else | 320 #else |
317 # define V8_NOINLINE(declarator) declarator | 321 # define V8_NOINLINE /* NOT SUPPORTED */ |
318 #endif | 322 #endif |
319 | 323 |
320 | 324 |
321 // A macro to mark classes or functions as deprecated. | 325 // A macro to mark classes or functions as deprecated. |
322 #if !V8_DISABLE_DEPRECATIONS && V8_HAS_ATTRIBUTE_DEPRECATED | 326 #if !V8_DISABLE_DEPRECATIONS && V8_HAS_ATTRIBUTE_DEPRECATED |
323 # define V8_DEPRECATED(declarator) declarator __attribute__((deprecated)) | 327 # define V8_DEPRECATED(declarator) declarator __attribute__((deprecated)) |
324 #elif !V8_DISABLE_DEPRECATIONS && V8_HAS_DECLSPEC_DEPRECATED | 328 #elif !V8_DISABLE_DEPRECATIONS && V8_HAS_DECLSPEC_DEPRECATED |
325 # define V8_DEPRECATED(declarator) __declspec(deprecated) declarator | 329 # define V8_DEPRECATED(declarator) __declspec(deprecated) declarator |
326 #else | 330 #else |
327 # define V8_DEPRECATED(declarator) declarator | 331 # define V8_DEPRECATED(declarator) declarator |
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 # define V8_ALIGNOF(type) __alignof__(type) | 467 # define V8_ALIGNOF(type) __alignof__(type) |
464 #else | 468 #else |
465 // Note that alignment of a type within a struct can be less than the | 469 // Note that alignment of a type within a struct can be less than the |
466 // alignment of the type stand-alone (because of ancient ABIs), so this | 470 // alignment of the type stand-alone (because of ancient ABIs), so this |
467 // should only be used as a last resort. | 471 // should only be used as a last resort. |
468 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; } | 472 namespace v8 { template <typename T> class AlignOfHelper { char c; T t; }; } |
469 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type)) | 473 # define V8_ALIGNOF(type) (sizeof(::v8::AlignOfHelper<type>) - sizeof(type)) |
470 #endif | 474 #endif |
471 | 475 |
472 #endif // V8CONFIG_H_ | 476 #endif // V8CONFIG_H_ |
OLD | NEW |