| 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 898 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 return MapWord(reinterpret_cast<uintptr_t>(raw)); | 909 return MapWord(reinterpret_cast<uintptr_t>(raw)); |
| 910 } | 910 } |
| 911 | 911 |
| 912 | 912 |
| 913 HeapObject* MapWord::ToForwardingAddress() { | 913 HeapObject* MapWord::ToForwardingAddress() { |
| 914 ASSERT(IsForwardingAddress()); | 914 ASSERT(IsForwardingAddress()); |
| 915 return HeapObject::FromAddress(reinterpret_cast<Address>(value_)); | 915 return HeapObject::FromAddress(reinterpret_cast<Address>(value_)); |
| 916 } | 916 } |
| 917 | 917 |
| 918 | 918 |
| 919 bool MapWord::IsSerializationAddress() { | |
| 920 return HAS_SMI_TAG(reinterpret_cast<Object*>(value_)); | |
| 921 } | |
| 922 | |
| 923 | |
| 924 MapWord MapWord::FromSerializationAddress(int raw) { | |
| 925 // When the map word is being used as a serialization address we Smi-encode | |
| 926 // the serialization address (which is always a smallish positive integer). | |
| 927 return MapWord(reinterpret_cast<uintptr_t>(Smi::FromInt(raw))); | |
| 928 } | |
| 929 | |
| 930 | |
| 931 int MapWord::ToSerializationAddress() { | |
| 932 // When the map word is being used as a serialization address we treat the | |
| 933 // map word as a Smi and get the small integer that it encodes. | |
| 934 return reinterpret_cast<Smi*>(value_)->value(); | |
| 935 } | |
| 936 | |
| 937 | |
| 938 bool MapWord::IsMarked() { | 919 bool MapWord::IsMarked() { |
| 939 return (value_ & kMarkingMask) == 0; | 920 return (value_ & kMarkingMask) == 0; |
| 940 } | 921 } |
| 941 | 922 |
| 942 | 923 |
| 943 void MapWord::SetMark() { | 924 void MapWord::SetMark() { |
| 944 value_ &= ~kMarkingMask; | 925 value_ &= ~kMarkingMask; |
| 945 } | 926 } |
| 946 | 927 |
| 947 | 928 |
| (...skipping 2102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3050 #undef WRITE_INT_FIELD | 3031 #undef WRITE_INT_FIELD |
| 3051 #undef READ_SHORT_FIELD | 3032 #undef READ_SHORT_FIELD |
| 3052 #undef WRITE_SHORT_FIELD | 3033 #undef WRITE_SHORT_FIELD |
| 3053 #undef READ_BYTE_FIELD | 3034 #undef READ_BYTE_FIELD |
| 3054 #undef WRITE_BYTE_FIELD | 3035 #undef WRITE_BYTE_FIELD |
| 3055 | 3036 |
| 3056 | 3037 |
| 3057 } } // namespace v8::internal | 3038 } } // namespace v8::internal |
| 3058 | 3039 |
| 3059 #endif // V8_OBJECTS_INL_H_ | 3040 #endif // V8_OBJECTS_INL_H_ |
| OLD | NEW |