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/verifier.h" | 5 #include "vm/verifier.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "vm/dart.h" | 8 #include "vm/dart.h" |
9 #include "vm/dart_api_state.h" | 9 #include "vm/dart_api_state.h" |
10 #include "vm/freelist.h" | 10 #include "vm/freelist.h" |
11 #include "vm/heap.h" | 11 #include "vm/heap.h" |
12 #include "vm/isolate.h" | 12 #include "vm/isolate.h" |
13 #include "vm/object.h" | 13 #include "vm/object.h" |
14 #include "vm/raw_object.h" | 14 #include "vm/raw_object.h" |
15 #include "vm/stack_frame.h" | 15 #include "vm/stack_frame.h" |
16 | 16 |
17 namespace dart { | 17 namespace dart { |
18 | 18 |
19 DEFINE_FLAG(bool, verify_on_transition, false, "Verify on dart <==> VM."); | 19 DEFINE_FLAG(bool, verify_on_transition, false, "Verify on dart <==> VM."); |
20 | 20 |
21 | 21 |
22 void VerifyPointersVisitor::VisitPointers(RawObject** first, RawObject** last) { | 22 void VerifyPointersVisitor::VisitPointers(RawObject** first, RawObject** last) { |
23 for (RawObject** current = first; current <= last; current++) { | 23 for (RawObject** current = first; current <= last; current++) { |
24 RawObject* raw_obj = *current; | 24 RawObject* raw_obj = *current; |
25 if (raw_obj->IsHeapObject()) { | 25 if (raw_obj->IsHeapObject()) { |
26 // Skip visits of FreeListElements. | |
27 if (FreeListElement::IsSpecialClass(raw_obj)) { | |
28 // Only the class of the free list element should ever be visited. | |
29 ASSERT(first == last); | |
30 return; | |
31 } | |
32 uword obj_addr = RawObject::ToAddr(raw_obj); | 26 uword obj_addr = RawObject::ToAddr(raw_obj); |
33 if (!Isolate::Current()->heap()->Contains(obj_addr) && | 27 if (!Isolate::Current()->heap()->Contains(obj_addr) && |
34 !Dart::vm_isolate()->heap()->Contains(obj_addr)) { | 28 !Dart::vm_isolate()->heap()->Contains(obj_addr)) { |
35 FATAL1("Invalid object pointer encountered 0x%lx\n", obj_addr); | 29 FATAL1("Invalid object pointer encountered 0x%lx\n", obj_addr); |
36 } | 30 } |
37 raw_obj->Validate(isolate_); | 31 raw_obj->Validate(isolate_); |
38 } | 32 } |
39 } | 33 } |
40 } | 34 } |
41 | 35 |
(...skipping 14 matching lines...) Expand all Loading... |
56 isolate->VisitObjectPointers(&visitor, | 50 isolate->VisitObjectPointers(&visitor, |
57 false, // skip prologue weak handles | 51 false, // skip prologue weak handles |
58 StackFrameIterator::kValidateFrames); | 52 StackFrameIterator::kValidateFrames); |
59 VerifyWeakPointersVisitor weak_visitor(&visitor); | 53 VerifyWeakPointersVisitor weak_visitor(&visitor); |
60 // Visit weak handles and prologue weak handles. | 54 // Visit weak handles and prologue weak handles. |
61 isolate->VisitWeakPersistentHandles(&weak_visitor, | 55 isolate->VisitWeakPersistentHandles(&weak_visitor, |
62 true); // visit prologue weak handles | 56 true); // visit prologue weak handles |
63 } | 57 } |
64 | 58 |
65 } // namespace dart | 59 } // namespace dart |
OLD | NEW |