| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 #endif | 134 #endif |
| 135 | 135 |
| 136 const int kObjectAlignmentBits = kPointerSizeLog2; | 136 const int kObjectAlignmentBits = kPointerSizeLog2; |
| 137 const intptr_t kObjectAlignment = 1 << kObjectAlignmentBits; | 137 const intptr_t kObjectAlignment = 1 << kObjectAlignmentBits; |
| 138 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; | 138 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; |
| 139 | 139 |
| 140 // Desired alignment for pointers. | 140 // Desired alignment for pointers. |
| 141 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); | 141 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); |
| 142 const intptr_t kPointerAlignmentMask = kPointerAlignment - 1; | 142 const intptr_t kPointerAlignmentMask = kPointerAlignment - 1; |
| 143 | 143 |
| 144 // Desired alignment for maps. |
| 145 #if V8_HOST_ARCH_64_BIT |
| 146 const intptr_t kMapAlignmentBits = kObjectAlignmentBits; |
| 147 #else |
| 148 const intptr_t kMapAlignmentBits = kObjectAlignmentBits + 3; |
| 149 #endif |
| 150 const intptr_t kMapAlignment = (1 << kMapAlignmentBits); |
| 151 const intptr_t kMapAlignmentMask = kMapAlignment - 1; |
| 144 | 152 |
| 145 // Tag information for Failure. | 153 // Tag information for Failure. |
| 146 const int kFailureTag = 3; | 154 const int kFailureTag = 3; |
| 147 const int kFailureTagSize = 2; | 155 const int kFailureTagSize = 2; |
| 148 const intptr_t kFailureTagMask = (1 << kFailureTagSize) - 1; | 156 const intptr_t kFailureTagMask = (1 << kFailureTagSize) - 1; |
| 149 | 157 |
| 150 | 158 |
| 151 const int kBitsPerByte = 8; | 159 const int kBitsPerByte = 8; |
| 152 const int kBitsPerByteLog2 = 3; | 160 const int kBitsPerByteLog2 = 3; |
| 153 const int kBitsPerPointer = kPointerSize * kBitsPerByte; | 161 const int kBitsPerPointer = kPointerSize * kBitsPerByte; |
| 154 const int kBitsPerInt = kIntSize * kBitsPerByte; | 162 const int kBitsPerInt = kIntSize * kBitsPerByte; |
| 155 | 163 |
| 156 | 164 |
| 157 // Zap-value: The value used for zapping dead objects. | 165 // Zap-value: The value used for zapping dead objects. |
| 158 // Should be a recognizable hex value tagged as a heap object pointer. | 166 // Should be a recognizable hex value tagged as a heap object pointer. |
| 159 #ifdef V8_HOST_ARCH_64_BIT | 167 #ifdef V8_HOST_ARCH_64_BIT |
| 160 const Address kZapValue = | 168 const Address kZapValue = |
| 161 reinterpret_cast<Address>(V8_UINT64_C(0xdeadbeedbeadbeed)); | 169 reinterpret_cast<Address>(V8_UINT64_C(0xdeadbeedbeadbeed)); |
| 162 const Address kHandleZapValue = | 170 const Address kHandleZapValue = |
| 163 reinterpret_cast<Address>(V8_UINT64_C(0x1baddead0baddead)); | 171 reinterpret_cast<Address>(V8_UINT64_C(0x1baddead0baddead)); |
| 164 const Address kFromSpaceZapValue = | 172 const Address kFromSpaceZapValue = |
| 165 reinterpret_cast<Address>(V8_UINT64_C(0x1beefdad0beefdad)); | 173 reinterpret_cast<Address>(V8_UINT64_C(0x1beefdad0beefdad)); |
| 166 #else | 174 #else |
| 167 const Address kZapValue = reinterpret_cast<Address>(0xdeadbeed); | 175 const Address kZapValue = reinterpret_cast<Address>(0xdeadbeed); |
| 168 const Address kHandleZapValue = reinterpret_cast<Address>(0xbaddead); | 176 const Address kHandleZapValue = reinterpret_cast<Address>(0xbaddead); |
| 169 const Address kFromSpaceZapValue = reinterpret_cast<Address>(0xbeefdad); | 177 const Address kFromSpaceZapValue = reinterpret_cast<Address>(0xbeefdad); |
| 170 #endif | 178 #endif |
| 171 | 179 |
| 172 | 180 |
| 181 // Number of bits to represent the page size for paged spaces. The value of 13 |
| 182 // gives 8K bytes per page. |
| 183 const int kPageSizeBits = 13; |
| 184 |
| 185 |
| 173 // Constants relevant to double precision floating point numbers. | 186 // Constants relevant to double precision floating point numbers. |
| 174 | 187 |
| 175 // Quiet NaNs have bits 51 to 62 set, possibly the sign bit, and no | 188 // Quiet NaNs have bits 51 to 62 set, possibly the sign bit, and no |
| 176 // other bits set. | 189 // other bits set. |
| 177 const uint64_t kQuietNaNMask = static_cast<uint64_t>(0xfff) << 51; | 190 const uint64_t kQuietNaNMask = static_cast<uint64_t>(0xfff) << 51; |
| 178 // If looking only at the top 32 bits, the QNaN mask is bits 19 to 30. | 191 // If looking only at the top 32 bits, the QNaN mask is bits 19 to 30. |
| 179 const uint32_t kQuietNaNHighBitsMask = 0xfff << (51 - 32); | 192 const uint32_t kQuietNaNHighBitsMask = 0xfff << (51 - 32); |
| 180 | 193 |
| 181 | 194 |
| 182 // ----------------------------------------------------------------------------- | 195 // ----------------------------------------------------------------------------- |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 438 ((reinterpret_cast<intptr_t>(value) & kFailureTagMask) == kFailureTag) | 451 ((reinterpret_cast<intptr_t>(value) & kFailureTagMask) == kFailureTag) |
| 439 | 452 |
| 440 // OBJECT_SIZE_ALIGN returns the value aligned HeapObject size | 453 // OBJECT_SIZE_ALIGN returns the value aligned HeapObject size |
| 441 #define OBJECT_SIZE_ALIGN(value) \ | 454 #define OBJECT_SIZE_ALIGN(value) \ |
| 442 (((value) + kObjectAlignmentMask) & ~kObjectAlignmentMask) | 455 (((value) + kObjectAlignmentMask) & ~kObjectAlignmentMask) |
| 443 | 456 |
| 444 // POINTER_SIZE_ALIGN returns the value aligned as a pointer. | 457 // POINTER_SIZE_ALIGN returns the value aligned as a pointer. |
| 445 #define POINTER_SIZE_ALIGN(value) \ | 458 #define POINTER_SIZE_ALIGN(value) \ |
| 446 (((value) + kPointerAlignmentMask) & ~kPointerAlignmentMask) | 459 (((value) + kPointerAlignmentMask) & ~kPointerAlignmentMask) |
| 447 | 460 |
| 461 // MAP_SIZE_ALIGN returns the value aligned as a map pointer. |
| 462 #define MAP_SIZE_ALIGN(value) \ |
| 463 (((value) + kMapAlignmentMask) & ~kMapAlignmentMask) |
| 464 |
| 448 // The expression OFFSET_OF(type, field) computes the byte-offset | 465 // The expression OFFSET_OF(type, field) computes the byte-offset |
| 449 // of the specified field relative to the containing type. This | 466 // of the specified field relative to the containing type. This |
| 450 // corresponds to 'offsetof' (in stddef.h), except that it doesn't | 467 // corresponds to 'offsetof' (in stddef.h), except that it doesn't |
| 451 // use 0 or NULL, which causes a problem with the compiler warnings | 468 // use 0 or NULL, which causes a problem with the compiler warnings |
| 452 // we have enabled (which is also why 'offsetof' doesn't seem to work). | 469 // we have enabled (which is also why 'offsetof' doesn't seem to work). |
| 453 // Here we simply use the non-zero value 4, which seems to work. | 470 // Here we simply use the non-zero value 4, which seems to work. |
| 454 #define OFFSET_OF(type, field) \ | 471 #define OFFSET_OF(type, field) \ |
| 455 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4) | 472 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4) |
| 456 | 473 |
| 457 | 474 |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 566 | 583 |
| 567 Dest dest; | 584 Dest dest; |
| 568 memcpy(&dest, &source, sizeof(dest)); | 585 memcpy(&dest, &source, sizeof(dest)); |
| 569 return dest; | 586 return dest; |
| 570 } | 587 } |
| 571 | 588 |
| 572 | 589 |
| 573 } } // namespace v8::internal | 590 } } // namespace v8::internal |
| 574 | 591 |
| 575 #endif // V8_GLOBALS_H_ | 592 #endif // V8_GLOBALS_H_ |
| OLD | NEW |