| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef VM_RAW_OBJECT_H_ | 5 #ifndef VM_RAW_OBJECT_H_ |
| 6 #define VM_RAW_OBJECT_H_ | 6 #define VM_RAW_OBJECT_H_ |
| 7 | 7 |
| 8 #include "vm/assert.h" | 8 #include "vm/assert.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 #include "vm/snapshot.h" | 10 #include "vm/snapshot.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 return mark_bits == kMarked; | 165 return mark_bits == kMarked; |
| 166 } | 166 } |
| 167 void SetMarkBit() { | 167 void SetMarkBit() { |
| 168 ASSERT(!IsMarked()); | 168 ASSERT(!IsMarked()); |
| 169 uword header_bits = reinterpret_cast<uword>(ptr()->class_); | 169 uword header_bits = reinterpret_cast<uword>(ptr()->class_); |
| 170 ptr()->class_ = reinterpret_cast<RawClass*>(header_bits | kMarked); | 170 ptr()->class_ = reinterpret_cast<RawClass*>(header_bits | kMarked); |
| 171 } | 171 } |
| 172 void ClearMarkBit() { | 172 void ClearMarkBit() { |
| 173 ASSERT(IsMarked()); | 173 ASSERT(IsMarked()); |
| 174 uword header_bits = reinterpret_cast<uword>(ptr()->class_); | 174 uword header_bits = reinterpret_cast<uword>(ptr()->class_); |
| 175 ptr()->class_ = reinterpret_cast<RawClass*>(header_bits ^ kMarked); | 175 ptr()->class_ = reinterpret_cast<RawClass*>(header_bits ^ kMarkBit); |
| 176 } | 176 } |
| 177 | 177 |
| 178 // Support for object tags. | 178 // Support for object tags. |
| 179 bool IsCanonical() const { | 179 bool IsCanonical() const { |
| 180 return CanonicalObjectTag::decode(ptr()->tags_); | 180 return CanonicalObjectTag::decode(ptr()->tags_); |
| 181 } | 181 } |
| 182 void SetCanonical() { | 182 void SetCanonical() { |
| 183 intptr_t tags = ptr()->tags_; | 183 intptr_t tags = ptr()->tags_; |
| 184 ptr()->tags_ = CanonicalObjectTag::update(true, tags); | 184 ptr()->tags_ = CanonicalObjectTag::update(true, tags); |
| 185 } | 185 } |
| (...skipping 29 matching lines...) Expand all Loading... |
| 215 | 215 |
| 216 protected: | 216 protected: |
| 217 RawClass* class_; | 217 RawClass* class_; |
| 218 intptr_t tags_; // Various object tags (bits). | 218 intptr_t tags_; // Various object tags (bits). |
| 219 | 219 |
| 220 private: | 220 private: |
| 221 enum { | 221 enum { |
| 222 kMarkingMask = 3, | 222 kMarkingMask = 3, |
| 223 kNotMarked = 1, // Tagged pointer. | 223 kNotMarked = 1, // Tagged pointer. |
| 224 kMarked = 3, // Tagged pointer and forwarding bit set. | 224 kMarked = 3, // Tagged pointer and forwarding bit set. |
| 225 kMarkBit = 2, |
| 225 }; | 226 }; |
| 226 | 227 |
| 227 class CanonicalObjectTag : public BitField<bool, 2, 1> { | 228 class CanonicalObjectTag : public BitField<bool, 2, 1> { |
| 228 }; | 229 }; |
| 229 | 230 |
| 230 class CreatedFromSnapshotTag : public BitField<bool, 3, 1> { | 231 class CreatedFromSnapshotTag : public BitField<bool, 3, 1> { |
| 231 }; | 232 }; |
| 232 | 233 |
| 233 RawObject* ptr() const { | 234 RawObject* ptr() const { |
| 234 ASSERT(IsHeapObject()); | 235 ASSERT(IsHeapObject()); |
| (...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 899 intptr_t type_; // Uninitialized, simple or complex. | 900 intptr_t type_; // Uninitialized, simple or complex. |
| 900 intptr_t flags_; // Represents global/local, case insensitive, multiline. | 901 intptr_t flags_; // Represents global/local, case insensitive, multiline. |
| 901 | 902 |
| 902 // Variable length data follows here. | 903 // Variable length data follows here. |
| 903 uint8_t data_[0]; | 904 uint8_t data_[0]; |
| 904 }; | 905 }; |
| 905 | 906 |
| 906 } // namespace dart | 907 } // namespace dart |
| 907 | 908 |
| 908 #endif // VM_RAW_OBJECT_H_ | 909 #endif // VM_RAW_OBJECT_H_ |
| OLD | NEW |