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 837 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
848 // Assert that the space encoding fits in the three bytes allotted for it. | 848 // Assert that the space encoding fits in the three bytes allotted for it. |
849 ASSERT((LAST_SPACE & ~kSpaceTagMask) == 0); | 849 ASSERT((LAST_SPACE & ~kSpaceTagMask) == 0); |
850 intptr_t requested = requested_bytes >> kObjectAlignmentBits; | 850 intptr_t requested = requested_bytes >> kObjectAlignmentBits; |
851 int tag_bits = kSpaceTagSize + kFailureTypeTagSize; | 851 int tag_bits = kSpaceTagSize + kFailureTypeTagSize; |
852 if (((requested << tag_bits) >> tag_bits) != requested) { | 852 if (((requested << tag_bits) >> tag_bits) != requested) { |
853 // No room for entire requested size in the bits. Round down to | 853 // No room for entire requested size in the bits. Round down to |
854 // maximally representable size. | 854 // maximally representable size. |
855 requested = static_cast<intptr_t>( | 855 requested = static_cast<intptr_t>( |
856 (~static_cast<uintptr_t>(0)) >> (tag_bits + 1)); | 856 (~static_cast<uintptr_t>(0)) >> (tag_bits + 1)); |
857 } | 857 } |
858 int value = (requested << kSpaceTagSize) | NEW_SPACE; | 858 int value = static_cast<int>(requested << kSpaceTagSize) | NEW_SPACE; |
859 return Construct(RETRY_AFTER_GC, value); | 859 return Construct(RETRY_AFTER_GC, value); |
860 } | 860 } |
861 | 861 |
862 | 862 |
863 Failure* Failure::Construct(Type type, intptr_t value) { | 863 Failure* Failure::Construct(Type type, intptr_t value) { |
864 intptr_t info = (static_cast<intptr_t>(value) << kFailureTypeTagSize) | type; | 864 intptr_t info = (static_cast<intptr_t>(value) << kFailureTypeTagSize) | type; |
865 ASSERT(((info << kFailureTagSize) >> kFailureTagSize) == info); | 865 ASSERT(((info << kFailureTagSize) >> kFailureTagSize) == info); |
866 return reinterpret_cast<Failure*>((info << kFailureTagSize) | kFailureTag); | 866 return reinterpret_cast<Failure*>((info << kFailureTagSize) | kFailureTag); |
867 } | 867 } |
868 | 868 |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1002 ((value_ & kMapPageOffsetMask) >> kMapPageOffsetShift) | 1002 ((value_ & kMapPageOffsetMask) >> kMapPageOffsetShift) |
1003 << kObjectAlignmentBits); | 1003 << kObjectAlignmentBits); |
1004 | 1004 |
1005 return (map_space->PageAddress(map_page_index) + map_page_offset); | 1005 return (map_space->PageAddress(map_page_index) + map_page_offset); |
1006 } | 1006 } |
1007 | 1007 |
1008 | 1008 |
1009 int MapWord::DecodeOffset() { | 1009 int MapWord::DecodeOffset() { |
1010 // The offset field is represented in the kForwardingOffsetBits | 1010 // The offset field is represented in the kForwardingOffsetBits |
1011 // most-significant bits. | 1011 // most-significant bits. |
1012 int offset = (value_ >> kForwardingOffsetShift) << kObjectAlignmentBits; | 1012 uintptr_t offset = (value_ >> kForwardingOffsetShift) << kObjectAlignmentBits; |
1013 ASSERT(0 <= offset && offset < Page::kObjectAreaSize); | 1013 ASSERT(offset < static_cast<uintptr_t>(Page::kObjectAreaSize)); |
1014 return offset; | 1014 return static_cast<int>(offset); |
1015 } | 1015 } |
1016 | 1016 |
1017 | 1017 |
1018 MapWord MapWord::FromEncodedAddress(Address address) { | 1018 MapWord MapWord::FromEncodedAddress(Address address) { |
1019 return MapWord(reinterpret_cast<uintptr_t>(address)); | 1019 return MapWord(reinterpret_cast<uintptr_t>(address)); |
1020 } | 1020 } |
1021 | 1021 |
1022 | 1022 |
1023 Address MapWord::ToEncodedAddress() { | 1023 Address MapWord::ToEncodedAddress() { |
1024 return reinterpret_cast<Address>(value_); | 1024 return reinterpret_cast<Address>(value_); |
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3102 #undef WRITE_INT_FIELD | 3102 #undef WRITE_INT_FIELD |
3103 #undef READ_SHORT_FIELD | 3103 #undef READ_SHORT_FIELD |
3104 #undef WRITE_SHORT_FIELD | 3104 #undef WRITE_SHORT_FIELD |
3105 #undef READ_BYTE_FIELD | 3105 #undef READ_BYTE_FIELD |
3106 #undef WRITE_BYTE_FIELD | 3106 #undef WRITE_BYTE_FIELD |
3107 | 3107 |
3108 | 3108 |
3109 } } // namespace v8::internal | 3109 } } // namespace v8::internal |
3110 | 3110 |
3111 #endif // V8_OBJECTS_INL_H_ | 3111 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |