OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 12 matching lines...) Expand all Loading... |
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 // ----------------------------------------------------------------------------- |
32 // Types | 32 // Types |
33 // Windows is missing the stdint.h header file. Instead we define standard | 33 // Visual Studio C++ is missing the stdint.h header file. Instead we define |
34 // integer types for Windows here. | 34 // standard integer types for Windows here. |
35 | 35 |
36 #ifdef WIN32 | 36 #ifdef _MSC_VER |
37 typedef signed char int8_t; | 37 typedef signed char int8_t; |
38 typedef unsigned char uint8_t; | 38 typedef unsigned char uint8_t; |
39 typedef short int16_t; // NOLINT | 39 typedef short int16_t; // NOLINT |
40 typedef unsigned short uint16_t; // NOLINT | 40 typedef unsigned short uint16_t; // NOLINT |
41 typedef int int32_t; | 41 typedef int int32_t; |
42 typedef unsigned int uint32_t; | 42 typedef unsigned int uint32_t; |
43 typedef __int64 int64_t; | 43 typedef __int64 int64_t; |
44 typedef unsigned __int64 uint64_t; | 44 typedef unsigned __int64 uint64_t; |
45 #else | 45 #else // _MSC_VER |
46 #include <stdint.h> // for intptr_t | 46 #include <stdint.h> // for intptr_t |
47 #endif | 47 #endif // _MSC_VER |
48 | 48 |
49 | 49 |
50 namespace v8 { namespace internal { | 50 namespace v8 { namespace internal { |
51 | 51 |
52 // Support for alternative bool type. This is only enabled if the code is | 52 // Support for alternative bool type. This is only enabled if the code is |
53 // compiled with USE_MYBOOL defined. This catches some nasty type bugs. | 53 // compiled with USE_MYBOOL defined. This catches some nasty type bugs. |
54 // For instance, 'bool b = "false";' results in b == true! This is a hidden | 54 // For instance, 'bool b = "false";' results in b == true! This is a hidden |
55 // source of bugs. | 55 // source of bugs. |
56 // However, redefining the bool type does have some negative impact on some | 56 // However, redefining the bool type does have some negative impact on some |
57 // platforms. It gives rise to compiler warnings (i.e. with | 57 // platforms. It gives rise to compiler warnings (i.e. with |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
457 return result; \ | 457 return result; \ |
458 } \ | 458 } \ |
459 void operator delete(void* object) { \ | 459 void operator delete(void* object) { \ |
460 Logger::DeleteEvent(name, object); \ | 460 Logger::DeleteEvent(name, object); \ |
461 ::operator delete(object); \ | 461 ::operator delete(object); \ |
462 } | 462 } |
463 #else | 463 #else |
464 #define TRACK_MEMORY(name) | 464 #define TRACK_MEMORY(name) |
465 #endif | 465 #endif |
466 | 466 |
467 // define used for helping GCC to make better inlining. | 467 // define used for helping GCC to make better inlining. Don't bother for debug |
468 #ifdef __GNUC__ | 468 // builds. On GCC 3.4.5 using __attribute__((always_inline)) causes compilation |
| 469 // errors in debug build. |
| 470 #if defined(__GNUC__) && !defined(DEBUG) |
469 #if (__GNUC__ >= 4) | 471 #if (__GNUC__ >= 4) |
470 #define INLINE(header) inline header __attribute__((always_inline)) | 472 #define INLINE(header) inline header __attribute__((always_inline)) |
471 #else | 473 #else |
472 #define INLINE(header) inline __attribute__((always_inline)) header | 474 #define INLINE(header) inline __attribute__((always_inline)) header |
473 #endif | 475 #endif |
474 #else | 476 #else |
475 #define INLINE(header) inline header | 477 #define INLINE(header) inline header |
476 #endif | 478 #endif |
477 | 479 |
478 // The type-based aliasing rule allows the compiler to assume that pointers of | 480 // The type-based aliasing rule allows the compiler to assume that pointers of |
(...skipping 28 matching lines...) Expand all Loading... |
507 | 509 |
508 Dest dest; | 510 Dest dest; |
509 memcpy(&dest, &source, sizeof(dest)); | 511 memcpy(&dest, &source, sizeof(dest)); |
510 return dest; | 512 return dest; |
511 } | 513 } |
512 | 514 |
513 | 515 |
514 } } // namespace v8::internal | 516 } } // namespace v8::internal |
515 | 517 |
516 #endif // V8_GLOBALS_H_ | 518 #endif // V8_GLOBALS_H_ |
OLD | NEW |