OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 #define HAS_FAILURE_TAG(value) \ | 368 #define HAS_FAILURE_TAG(value) \ |
369 ((reinterpret_cast<int>(value) & kFailureTagMask) == kFailureTag) | 369 ((reinterpret_cast<int>(value) & kFailureTagMask) == kFailureTag) |
370 | 370 |
371 #define HAS_HEAP_OBJECT_TAG(value) \ | 371 #define HAS_HEAP_OBJECT_TAG(value) \ |
372 ((reinterpret_cast<int>(value) & kHeapObjectTagMask) == kHeapObjectTag) | 372 ((reinterpret_cast<int>(value) & kHeapObjectTagMask) == kHeapObjectTag) |
373 | 373 |
374 // OBJECT_SIZE_ALIGN returns the value aligned HeapObject size | 374 // OBJECT_SIZE_ALIGN returns the value aligned HeapObject size |
375 #define OBJECT_SIZE_ALIGN(value) \ | 375 #define OBJECT_SIZE_ALIGN(value) \ |
376 ((value + kObjectAlignmentMask) & ~kObjectAlignmentMask) | 376 ((value + kObjectAlignmentMask) & ~kObjectAlignmentMask) |
377 | 377 |
378 | |
379 // The expression OFFSET_OF(type, field) computes the byte-offset | 378 // The expression OFFSET_OF(type, field) computes the byte-offset |
380 // of the specified field relative to the containing type. This | 379 // of the specified field relative to the containing type. This |
381 // corresponds to 'offsetof' (in stddef.h), except that it doesn't | 380 // corresponds to 'offsetof' (in stddef.h), except that it doesn't |
382 // use 0 or NULL, which causes a problem with the compiler warnings | 381 // use 0 or NULL, which causes a problem with the compiler warnings |
383 // we have enabled (which is also why 'offsetof' doesn't seem to work). | 382 // we have enabled (which is also why 'offsetof' doesn't seem to work). |
384 // Here we simply use the non-zero value 4, which seems to work. | 383 // Here we simply use the non-zero value 4, which seems to work. |
385 #define OFFSET_OF(type, field) \ | 384 #define OFFSET_OF(type, field) \ |
386 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4) | 385 (reinterpret_cast<intptr_t>(&(reinterpret_cast<type*>(4)->field)) - 4) |
387 | 386 |
388 | 387 |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
495 | 494 |
496 Dest dest; | 495 Dest dest; |
497 memcpy(&dest, &source, sizeof(dest)); | 496 memcpy(&dest, &source, sizeof(dest)); |
498 return dest; | 497 return dest; |
499 } | 498 } |
500 | 499 |
501 | 500 |
502 } } // namespace v8::internal | 501 } } // namespace v8::internal |
503 | 502 |
504 #endif // V8_GLOBALS_H_ | 503 #endif // V8_GLOBALS_H_ |
OLD | NEW |