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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 #endif | 127 #endif |
128 | 128 |
129 const int kObjectAlignmentBits = kPointerSizeLog2; | 129 const int kObjectAlignmentBits = kPointerSizeLog2; |
130 const intptr_t kObjectAlignment = 1 << kObjectAlignmentBits; | 130 const intptr_t kObjectAlignment = 1 << kObjectAlignmentBits; |
131 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; | 131 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; |
132 | 132 |
133 // Desired alignment for pointers. | 133 // Desired alignment for pointers. |
134 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); | 134 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); |
135 const intptr_t kPointerAlignmentMask = kPointerAlignment - 1; | 135 const intptr_t kPointerAlignmentMask = kPointerAlignment - 1; |
136 | 136 |
137 // Tag information for HeapObject. | |
138 const int kHeapObjectTag = 1; | |
139 const int kHeapObjectTagSize = 2; | |
140 const intptr_t kHeapObjectTagMask = (1 << kHeapObjectTagSize) - 1; | |
141 | |
142 | |
143 // Tag information for Smi. | |
144 const int kSmiTag = 0; | |
145 const int kSmiTagSize = 1; | |
146 const intptr_t kSmiTagMask = (1 << kSmiTagSize) - 1; | |
147 | |
148 | 137 |
149 // Tag information for Failure. | 138 // Tag information for Failure. |
150 const int kFailureTag = 3; | 139 const int kFailureTag = 3; |
151 const int kFailureTagSize = 2; | 140 const int kFailureTagSize = 2; |
152 const intptr_t kFailureTagMask = (1 << kFailureTagSize) - 1; | 141 const intptr_t kFailureTagMask = (1 << kFailureTagSize) - 1; |
153 | 142 |
154 | 143 |
155 const int kBitsPerByte = 8; | 144 const int kBitsPerByte = 8; |
156 const int kBitsPerByteLog2 = 3; | 145 const int kBitsPerByteLog2 = 3; |
157 const int kBitsPerPointer = kPointerSize * kBitsPerByte; | 146 const int kBitsPerPointer = kPointerSize * kBitsPerByte; |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
422 // Macros | 411 // Macros |
423 | 412 |
424 // Testers for test. | 413 // Testers for test. |
425 | 414 |
426 #define HAS_SMI_TAG(value) \ | 415 #define HAS_SMI_TAG(value) \ |
427 ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag) | 416 ((reinterpret_cast<intptr_t>(value) & kSmiTagMask) == kSmiTag) |
428 | 417 |
429 #define HAS_FAILURE_TAG(value) \ | 418 #define HAS_FAILURE_TAG(value) \ |
430 ((reinterpret_cast<intptr_t>(value) & kFailureTagMask) == kFailureTag) | 419 ((reinterpret_cast<intptr_t>(value) & kFailureTagMask) == kFailureTag) |
431 | 420 |
432 #define HAS_HEAP_OBJECT_TAG(value) \ | |
433 ((reinterpret_cast<intptr_t>(value) & kHeapObjectTagMask) == kHeapObjectTag) | |
434 | |
435 // OBJECT_SIZE_ALIGN returns the value aligned HeapObject size | 421 // OBJECT_SIZE_ALIGN returns the value aligned HeapObject size |
436 #define OBJECT_SIZE_ALIGN(value) \ | 422 #define OBJECT_SIZE_ALIGN(value) \ |
437 (((value) + kObjectAlignmentMask) & ~kObjectAlignmentMask) | 423 (((value) + kObjectAlignmentMask) & ~kObjectAlignmentMask) |
438 | 424 |
439 // POINTER_SIZE_ALIGN returns the value aligned as a pointer. | 425 // POINTER_SIZE_ALIGN returns the value aligned as a pointer. |
440 #define POINTER_SIZE_ALIGN(value) \ | 426 #define POINTER_SIZE_ALIGN(value) \ |
441 (((value) + kPointerAlignmentMask) & ~kPointerAlignmentMask) | 427 (((value) + kPointerAlignmentMask) & ~kPointerAlignmentMask) |
442 | 428 |
443 // The expression OFFSET_OF(type, field) computes the byte-offset | 429 // The expression OFFSET_OF(type, field) computes the byte-offset |
444 // of the specified field relative to the containing type. This | 430 // of the specified field relative to the containing type. This |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
561 | 547 |
562 Dest dest; | 548 Dest dest; |
563 memcpy(&dest, &source, sizeof(dest)); | 549 memcpy(&dest, &source, sizeof(dest)); |
564 return dest; | 550 return dest; |
565 } | 551 } |
566 | 552 |
567 | 553 |
568 } } // namespace v8::internal | 554 } } // namespace v8::internal |
569 | 555 |
570 #endif // V8_GLOBALS_H_ | 556 #endif // V8_GLOBALS_H_ |
OLD | NEW |