OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_GLOBALS_H_ | 5 #ifndef V8_GLOBALS_H_ |
6 #define V8_GLOBALS_H_ | 6 #define V8_GLOBALS_H_ |
7 | 7 |
8 #include "include/v8stdint.h" | 8 #include "include/v8stdint.h" |
9 | 9 |
10 #include "src/base/build_config.h" | 10 #include "src/base/build_config.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 // include very early in the main include file. | 59 // include very early in the main include file. |
60 | 60 |
61 #ifdef USE_MYBOOL | 61 #ifdef USE_MYBOOL |
62 typedef unsigned int __my_bool__; | 62 typedef unsigned int __my_bool__; |
63 #define bool __my_bool__ // use 'indirection' to avoid name clashes | 63 #define bool __my_bool__ // use 'indirection' to avoid name clashes |
64 #endif | 64 #endif |
65 | 65 |
66 typedef uint8_t byte; | 66 typedef uint8_t byte; |
67 typedef byte* Address; | 67 typedef byte* Address; |
68 | 68 |
69 // Define our own macros for writing 64-bit constants. This is less fragile | |
70 // than defining __STDC_CONSTANT_MACROS before including <stdint.h>, and it | |
71 // works on compilers that don't have it (like MSVC). | |
72 #if V8_CC_MSVC | |
73 # define V8_UINT64_C(x) (x ## UI64) | |
74 # define V8_INT64_C(x) (x ## I64) | |
75 # if V8_HOST_ARCH_64_BIT | |
76 # define V8_INTPTR_C(x) (x ## I64) | |
77 # define V8_PTR_PREFIX "ll" | |
78 # else | |
79 # define V8_INTPTR_C(x) (x) | |
80 # define V8_PTR_PREFIX "" | |
81 # endif // V8_HOST_ARCH_64_BIT | |
82 #elif V8_CC_MINGW64 | |
83 # define V8_UINT64_C(x) (x ## ULL) | |
84 # define V8_INT64_C(x) (x ## LL) | |
85 # define V8_INTPTR_C(x) (x ## LL) | |
86 # define V8_PTR_PREFIX "I64" | |
87 #elif V8_HOST_ARCH_64_BIT | |
88 # if V8_OS_MACOSX | |
89 # define V8_UINT64_C(x) (x ## ULL) | |
90 # define V8_INT64_C(x) (x ## LL) | |
91 # else | |
92 # define V8_UINT64_C(x) (x ## UL) | |
93 # define V8_INT64_C(x) (x ## L) | |
94 # endif | |
95 # define V8_INTPTR_C(x) (x ## L) | |
96 # define V8_PTR_PREFIX "l" | |
97 #else | |
98 # define V8_UINT64_C(x) (x ## ULL) | |
99 # define V8_INT64_C(x) (x ## LL) | |
100 # define V8_INTPTR_C(x) (x) | |
101 # define V8_PTR_PREFIX "" | |
102 #endif | |
103 | |
104 #define V8PRIxPTR V8_PTR_PREFIX "x" | |
105 #define V8PRIdPTR V8_PTR_PREFIX "d" | |
106 #define V8PRIuPTR V8_PTR_PREFIX "u" | |
107 | |
108 // Fix for Mac OS X defining uintptr_t as "unsigned long": | |
109 #if V8_OS_MACOSX | |
110 #undef V8PRIxPTR | |
111 #define V8PRIxPTR "lx" | |
112 #endif | |
113 | |
114 // ----------------------------------------------------------------------------- | 69 // ----------------------------------------------------------------------------- |
115 // Constants | 70 // Constants |
116 | 71 |
117 const int KB = 1024; | 72 const int KB = 1024; |
118 const int MB = KB * KB; | 73 const int MB = KB * KB; |
119 const int GB = KB * KB * KB; | 74 const int GB = KB * KB * KB; |
120 const int kMaxInt = 0x7FFFFFFF; | 75 const int kMaxInt = 0x7FFFFFFF; |
121 const int kMinInt = -kMaxInt - 1; | 76 const int kMinInt = -kMaxInt - 1; |
122 const int kMaxInt8 = (1 << 7) - 1; | 77 const int kMaxInt8 = (1 << 7) - 1; |
123 const int kMinInt8 = -(1 << 7); | 78 const int kMinInt8 = -(1 << 7); |
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
767 enum MinusZeroMode { | 722 enum MinusZeroMode { |
768 TREAT_MINUS_ZERO_AS_ZERO, | 723 TREAT_MINUS_ZERO_AS_ZERO, |
769 FAIL_ON_MINUS_ZERO | 724 FAIL_ON_MINUS_ZERO |
770 }; | 725 }; |
771 | 726 |
772 } } // namespace v8::internal | 727 } } // namespace v8::internal |
773 | 728 |
774 namespace i = v8::internal; | 729 namespace i = v8::internal; |
775 | 730 |
776 #endif // V8_GLOBALS_H_ | 731 #endif // V8_GLOBALS_H_ |
OLD | NEW |