OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 | 275 |
276 // Latin1/UTF-16 constants | 276 // Latin1/UTF-16 constants |
277 // Code-point values in Unicode 4.0 are 21 bits wide. | 277 // Code-point values in Unicode 4.0 are 21 bits wide. |
278 // Code units in UTF-16 are 16 bits wide. | 278 // Code units in UTF-16 are 16 bits wide. |
279 typedef uint16_t uc16; | 279 typedef uint16_t uc16; |
280 typedef int32_t uc32; | 280 typedef int32_t uc32; |
281 const int kOneByteSize = kCharSize; | 281 const int kOneByteSize = kCharSize; |
282 const int kUC16Size = sizeof(uc16); // NOLINT | 282 const int kUC16Size = sizeof(uc16); // NOLINT |
283 | 283 |
284 | 284 |
| 285 // Round up n to be a multiple of sz, where sz is a power of 2. |
| 286 #define ROUND_UP(n, sz) (((n) + ((sz) - 1)) & ~((sz) - 1)) |
| 287 |
| 288 |
285 // The expression OFFSET_OF(type, field) computes the byte-offset | 289 // The expression OFFSET_OF(type, field) computes the byte-offset |
286 // of the specified field relative to the containing type. This | 290 // of the specified field relative to the containing type. This |
287 // corresponds to 'offsetof' (in stddef.h), except that it doesn't | 291 // corresponds to 'offsetof' (in stddef.h), except that it doesn't |
288 // use 0 or NULL, which causes a problem with the compiler warnings | 292 // use 0 or NULL, which causes a problem with the compiler warnings |
289 // we have enabled (which is also why 'offsetof' doesn't seem to work). | 293 // we have enabled (which is also why 'offsetof' doesn't seem to work). |
290 // Here we simply use the non-zero value 4, which seems to work. | 294 // Here we simply use the non-zero value 4, which seems to work. |
291 #define OFFSET_OF(type, field) \ | 295 #define OFFSET_OF(type, field) \ |
292 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4) | 296 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4) |
293 | 297 |
294 | 298 |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // the backend, so both modes are represented by the kStrictMode value. | 430 // the backend, so both modes are represented by the kStrictMode value. |
427 enum StrictModeFlag { | 431 enum StrictModeFlag { |
428 kNonStrictMode, | 432 kNonStrictMode, |
429 kStrictMode | 433 kStrictMode |
430 }; | 434 }; |
431 | 435 |
432 | 436 |
433 } } // namespace v8::internal | 437 } } // namespace v8::internal |
434 | 438 |
435 #endif // V8_GLOBALS_H_ | 439 #endif // V8_GLOBALS_H_ |
OLD | NEW |