| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 #include "vm/raw_object.h" | 5 #include "vm/raw_object.h" |
| 6 | 6 |
| 7 #include "vm/class_table.h" | 7 #include "vm/class_table.h" |
| 8 #include "vm/freelist.h" | 8 #include "vm/freelist.h" |
| 9 #include "vm/isolate.h" | 9 #include "vm/isolate.h" |
| 10 #include "vm/object.h" | 10 #include "vm/object.h" |
| 11 #include "vm/visitor.h" | 11 #include "vm/visitor.h" |
| 12 | 12 |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 bool RawObject::IsVMHeapObject() const { | 16 bool RawObject::IsVMHeapObject() const { |
| 17 // TODO(asiva): Need a better way to represent VM heap objects, for | 17 // TODO(asiva): Need a better way to represent VM heap objects, for |
| 18 // now we use the premarked property for identifying objects in the | 18 // now we use the premarked property for identifying objects in the |
| 19 // VM heap. | 19 // VM heap. |
| 20 ASSERT(IsHeapObject()); | 20 ASSERT(IsHeapObject()); |
| 21 ASSERT(!Isolate::Current()->heap()->gc_in_progress()); | 21 ASSERT(!Isolate::Current()->heap()->gc_in_progress()); |
| 22 return IsMarked(); | 22 return IsMarked(); |
| 23 } | 23 } |
| 24 | 24 |
| 25 | 25 |
| 26 void RawObject::Validate(Isolate* isolate) const { | 26 void RawObject::Validate(Isolate* isolate) const { |
| 27 if (Object::null_class_ == reinterpret_cast<RawClass*>(kHeapObjectTag)) { | 27 if (Object::void_class_ == reinterpret_cast<RawClass*>(kHeapObjectTag)) { |
| 28 // Validation relies on properly initialized class classes. Skip if the | 28 // Validation relies on properly initialized class classes. Skip if the |
| 29 // VM is still being initialized. | 29 // VM is still being initialized. |
| 30 return; | 30 return; |
| 31 } | 31 } |
| 32 // All Smi values are valid. | 32 // All Smi values are valid. |
| 33 if (!IsHeapObject()) { | 33 if (!IsHeapObject()) { |
| 34 return; | 34 return; |
| 35 } | 35 } |
| 36 // Validate that the tags_ field is sensible. | 36 // Validate that the tags_ field is sensible. |
| 37 uword tags = ptr()->tags_; | 37 uword tags = ptr()->tags_; |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 810 | 810 |
| 811 intptr_t RawMirrorReference::VisitMirrorReferencePointers( | 811 intptr_t RawMirrorReference::VisitMirrorReferencePointers( |
| 812 RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) { | 812 RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) { |
| 813 // Make sure that we got here with the tagged pointer as this. | 813 // Make sure that we got here with the tagged pointer as this. |
| 814 ASSERT(raw_obj->IsHeapObject()); | 814 ASSERT(raw_obj->IsHeapObject()); |
| 815 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 815 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 816 return MirrorReference::InstanceSize(); | 816 return MirrorReference::InstanceSize(); |
| 817 } | 817 } |
| 818 | 818 |
| 819 } // namespace dart | 819 } // namespace dart |
| OLD | NEW |