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