OLD | NEW |
1 // Copyright 2010 the V8 project authors. All rights reserved. | 1 // Copyright 2010 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 #if defined(__APPLE__) && defined(__MACH__) | 174 #if defined(__APPLE__) && defined(__MACH__) |
175 #undef V8PRIxPTR | 175 #undef V8PRIxPTR |
176 #define V8PRIxPTR "lx" | 176 #define V8PRIxPTR "lx" |
177 #endif | 177 #endif |
178 | 178 |
179 #if (defined(__APPLE__) && defined(__MACH__)) || \ | 179 #if (defined(__APPLE__) && defined(__MACH__)) || \ |
180 defined(__FreeBSD__) || defined(__OpenBSD__) | 180 defined(__FreeBSD__) || defined(__OpenBSD__) |
181 #define USING_BSD_ABI | 181 #define USING_BSD_ABI |
182 #endif | 182 #endif |
183 | 183 |
184 // Code-point values in Unicode 4.0 are 21 bits wide. | |
185 typedef uint16_t uc16; | |
186 typedef int32_t uc32; | |
187 | |
188 // ----------------------------------------------------------------------------- | 184 // ----------------------------------------------------------------------------- |
189 // Constants | 185 // Constants |
190 | 186 |
191 const int KB = 1024; | 187 const int KB = 1024; |
192 const int MB = KB * KB; | 188 const int MB = KB * KB; |
193 const int GB = KB * KB * KB; | 189 const int GB = KB * KB * KB; |
194 const int kMaxInt = 0x7FFFFFFF; | 190 const int kMaxInt = 0x7FFFFFFF; |
195 const int kMinInt = -kMaxInt - 1; | 191 const int kMinInt = -kMaxInt - 1; |
196 | 192 |
197 const uint32_t kMaxUInt32 = 0xFFFFFFFFu; | 193 const uint32_t kMaxUInt32 = 0xFFFFFFFFu; |
(...skipping 23 matching lines...) Expand all Loading... |
221 // IEEE 754 single precision floating point number bit layout. | 217 // IEEE 754 single precision floating point number bit layout. |
222 const uint32_t kBinary32SignMask = 0x80000000u; | 218 const uint32_t kBinary32SignMask = 0x80000000u; |
223 const uint32_t kBinary32ExponentMask = 0x7f800000u; | 219 const uint32_t kBinary32ExponentMask = 0x7f800000u; |
224 const uint32_t kBinary32MantissaMask = 0x007fffffu; | 220 const uint32_t kBinary32MantissaMask = 0x007fffffu; |
225 const int kBinary32ExponentBias = 127; | 221 const int kBinary32ExponentBias = 127; |
226 const int kBinary32MaxExponent = 0xFE; | 222 const int kBinary32MaxExponent = 0xFE; |
227 const int kBinary32MinExponent = 0x01; | 223 const int kBinary32MinExponent = 0x01; |
228 const int kBinary32MantissaBits = 23; | 224 const int kBinary32MantissaBits = 23; |
229 const int kBinary32ExponentShift = 23; | 225 const int kBinary32ExponentShift = 23; |
230 | 226 |
| 227 // ASCII/UC16 constants |
| 228 // Code-point values in Unicode 4.0 are 21 bits wide. |
| 229 typedef uint16_t uc16; |
| 230 typedef int32_t uc32; |
| 231 const int kASCIISize = kCharSize; |
| 232 const int kUC16Size = sizeof(uc16); // NOLINT |
| 233 const uc32 kMaxAsciiCharCode = 0x7f; |
| 234 const uint32_t kMaxAsciiCharCodeU = 0x7fu; |
| 235 |
231 | 236 |
232 // The expression OFFSET_OF(type, field) computes the byte-offset | 237 // The expression OFFSET_OF(type, field) computes the byte-offset |
233 // of the specified field relative to the containing type. This | 238 // of the specified field relative to the containing type. This |
234 // corresponds to 'offsetof' (in stddef.h), except that it doesn't | 239 // corresponds to 'offsetof' (in stddef.h), except that it doesn't |
235 // use 0 or NULL, which causes a problem with the compiler warnings | 240 // use 0 or NULL, which causes a problem with the compiler warnings |
236 // we have enabled (which is also why 'offsetof' doesn't seem to work). | 241 // we have enabled (which is also why 'offsetof' doesn't seem to work). |
237 // Here we simply use the non-zero value 4, which seems to work. | 242 // Here we simply use the non-zero value 4, which seems to work. |
238 #define OFFSET_OF(type, field) \ | 243 #define OFFSET_OF(type, field) \ |
239 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4) | 244 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4) |
240 | 245 |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 // ----------------------------------------------------------------------------- | 316 // ----------------------------------------------------------------------------- |
312 // Forward declarations for frequently used classes | 317 // Forward declarations for frequently used classes |
313 // (sorted alphabetically) | 318 // (sorted alphabetically) |
314 | 319 |
315 class FreeStoreAllocationPolicy; | 320 class FreeStoreAllocationPolicy; |
316 template <typename T, class P = FreeStoreAllocationPolicy> class List; | 321 template <typename T, class P = FreeStoreAllocationPolicy> class List; |
317 | 322 |
318 } } // namespace v8::internal | 323 } } // namespace v8::internal |
319 | 324 |
320 #endif // V8_GLOBALS_H_ | 325 #endif // V8_GLOBALS_H_ |
OLD | NEW |