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/dart.h" |
9 #include "vm/freelist.h" | 9 #include "vm/freelist.h" |
10 #include "vm/isolate.h" | 10 #include "vm/isolate.h" |
11 #include "vm/object.h" | 11 #include "vm/object.h" |
12 #include "vm/visitor.h" | 12 #include "vm/visitor.h" |
13 | 13 |
14 | 14 |
15 namespace dart { | 15 namespace dart { |
16 | 16 |
17 #if defined(DEBUG) | 17 #if defined(DEBUG) |
18 DEFINE_FLAG(bool, validate_overwrite, true, "Verify overwritten fields."); | 18 DEFINE_FLAG(bool, validate_overwrite, true, "Verify overwritten fields."); |
19 #endif // DEBUG | 19 #endif // DEBUG |
20 | 20 |
21 bool RawObject::IsVMHeapObject() const { | |
22 return Dart::vm_isolate()->heap()->Contains(ToAddr(this)); | |
23 } | |
24 | |
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. |
33 if (!IsHeapObject()) { | 29 if (!IsHeapObject()) { |
34 return; | 30 return; |
(...skipping 902 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
937 intptr_t RawUserTag::VisitUserTagPointers( | 933 intptr_t RawUserTag::VisitUserTagPointers( |
938 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { | 934 RawUserTag* raw_obj, ObjectPointerVisitor* visitor) { |
939 // Make sure that we got here with the tagged pointer as this. | 935 // Make sure that we got here with the tagged pointer as this. |
940 ASSERT(raw_obj->IsHeapObject()); | 936 ASSERT(raw_obj->IsHeapObject()); |
941 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); | 937 visitor->VisitPointers(raw_obj->from(), raw_obj->to()); |
942 return UserTag::InstanceSize(); | 938 return UserTag::InstanceSize(); |
943 } | 939 } |
944 | 940 |
945 | 941 |
946 } // namespace dart | 942 } // namespace dart |
OLD | NEW |