| 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/dart.h" |
| 8 #include "vm/freelist.h" | 9 #include "vm/freelist.h" |
| 9 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
| 10 #include "vm/object.h" | 11 #include "vm/object.h" |
| 11 #include "vm/visitor.h" | 12 #include "vm/visitor.h" |
| 12 | 13 |
| 13 | 14 |
| 14 namespace dart { | 15 namespace dart { |
| 15 | 16 |
| 16 bool RawObject::IsVMHeapObject() const { | 17 bool RawObject::IsVMHeapObject() const { |
| 17 // TODO(asiva): Need a better way to represent VM heap objects, for | 18 return Dart::vm_isolate()->heap()->Contains(ToAddr(this)); |
| 18 // now we use the premarked property for identifying objects in the | |
| 19 // VM heap. | |
| 20 ASSERT(IsHeapObject()); | |
| 21 ASSERT(!Isolate::Current()->heap()->gc_in_progress()); | |
| 22 return IsMarked(); | |
| 23 } | 19 } |
| 24 | 20 |
| 25 | 21 |
| 26 void RawObject::Validate(Isolate* isolate) const { | 22 void RawObject::Validate(Isolate* isolate) const { |
| 27 if (Object::void_class_ == reinterpret_cast<RawClass*>(kHeapObjectTag)) { | 23 if (Object::void_class_ == reinterpret_cast<RawClass*>(kHeapObjectTag)) { |
| 28 // Validation relies on properly initialized class classes. Skip if the | 24 // Validation relies on properly initialized class classes. Skip if the |
| 29 // VM is still being initialized. | 25 // VM is still being initialized. |
| 30 return; | 26 return; |
| 31 } | 27 } |
| 32 // All Smi values are valid. | 28 // All Smi values are valid. |
| (...skipping 772 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 | 801 |
| 806 intptr_t RawMirrorReference::VisitMirrorReferencePointers( | 802 intptr_t RawMirrorReference::VisitMirrorReferencePointers( |
| 807 RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) { | 803 RawMirrorReference* raw_obj, ObjectPointerVisitor* visitor) { |
| 808 // Make sure that we got here with the tagged pointer as this. | 804 // Make sure that we got here with the tagged pointer as this. |
| 809 ASSERT(raw_obj->IsHeapObject()); | 805 ASSERT(raw_obj->IsHeapObject()); |
| 810 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 806 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
| 811 return MirrorReference::InstanceSize(); | 807 return MirrorReference::InstanceSize(); |
| 812 } | 808 } |
| 813 | 809 |
| 814 } // namespace dart | 810 } // namespace dart |
| OLD | NEW |