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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
938 return MapWord(reinterpret_cast<uintptr_t>(raw)); | 938 return MapWord(reinterpret_cast<uintptr_t>(raw)); |
939 } | 939 } |
940 | 940 |
941 | 941 |
942 HeapObject* MapWord::ToForwardingAddress() { | 942 HeapObject* MapWord::ToForwardingAddress() { |
943 ASSERT(IsForwardingAddress()); | 943 ASSERT(IsForwardingAddress()); |
944 return HeapObject::FromAddress(reinterpret_cast<Address>(value_)); | 944 return HeapObject::FromAddress(reinterpret_cast<Address>(value_)); |
945 } | 945 } |
946 | 946 |
947 | 947 |
| 948 bool MapWord::IsSerializationAddress() { |
| 949 return HAS_SMI_TAG(reinterpret_cast<Object*>(value_)); |
| 950 } |
| 951 |
| 952 |
| 953 MapWord MapWord::FromSerializationAddress(int raw) { |
| 954 // When the map word is being used as a serialization address we Smi-encode |
| 955 // the serialization address (which is always a smallish positive integer). |
| 956 return MapWord(reinterpret_cast<uintptr_t>(Smi::FromInt(raw))); |
| 957 } |
| 958 |
| 959 |
| 960 int MapWord::ToSerializationAddress() { |
| 961 // When the map word is being used as a serialization address we treat the |
| 962 // map word as a Smi and get the small integer that it encodes. |
| 963 return reinterpret_cast<Smi*>(value_)->value(); |
| 964 } |
| 965 |
| 966 |
948 bool MapWord::IsMarked() { | 967 bool MapWord::IsMarked() { |
949 return (value_ & kMarkingMask) == 0; | 968 return (value_ & kMarkingMask) == 0; |
950 } | 969 } |
951 | 970 |
952 | 971 |
953 void MapWord::SetMark() { | 972 void MapWord::SetMark() { |
954 value_ &= ~kMarkingMask; | 973 value_ &= ~kMarkingMask; |
955 } | 974 } |
956 | 975 |
957 | 976 |
(...skipping 2175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3133 #undef WRITE_INT_FIELD | 3152 #undef WRITE_INT_FIELD |
3134 #undef READ_SHORT_FIELD | 3153 #undef READ_SHORT_FIELD |
3135 #undef WRITE_SHORT_FIELD | 3154 #undef WRITE_SHORT_FIELD |
3136 #undef READ_BYTE_FIELD | 3155 #undef READ_BYTE_FIELD |
3137 #undef WRITE_BYTE_FIELD | 3156 #undef WRITE_BYTE_FIELD |
3138 | 3157 |
3139 | 3158 |
3140 } } // namespace v8::internal | 3159 } } // namespace v8::internal |
3141 | 3160 |
3142 #endif // V8_OBJECTS_INL_H_ | 3161 #endif // V8_OBJECTS_INL_H_ |
OLD | NEW |