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" |
(...skipping 16 matching lines...) Expand all Loading... |
27 if (FreeListElement::IsSpecialClass(raw_obj)) { | 27 if (FreeListElement::IsSpecialClass(raw_obj)) { |
28 // Only the class of the free list element should ever be visited. | 28 // Only the class of the free list element should ever be visited. |
29 ASSERT(first == last); | 29 ASSERT(first == last); |
30 return; | 30 return; |
31 } | 31 } |
32 uword obj_addr = RawObject::ToAddr(raw_obj); | 32 uword obj_addr = RawObject::ToAddr(raw_obj); |
33 if (!Isolate::Current()->heap()->Contains(obj_addr) && | 33 if (!Isolate::Current()->heap()->Contains(obj_addr) && |
34 !Dart::vm_isolate()->heap()->Contains(obj_addr)) { | 34 !Dart::vm_isolate()->heap()->Contains(obj_addr)) { |
35 FATAL1("Invalid object pointer encountered 0x%lx\n", obj_addr); | 35 FATAL1("Invalid object pointer encountered 0x%lx\n", obj_addr); |
36 } | 36 } |
37 raw_obj->Validate(isolate_); | 37 raw_obj->Validate(isolate()); |
38 } | 38 } |
39 } | 39 } |
40 } | 40 } |
41 | 41 |
42 | 42 |
43 void VerifyWeakPointersVisitor::VisitHandle(uword addr) { | 43 void VerifyWeakPointersVisitor::VisitHandle(uword addr) { |
44 FinalizablePersistentHandle* handle = | 44 FinalizablePersistentHandle* handle = |
45 reinterpret_cast<FinalizablePersistentHandle*>(addr); | 45 reinterpret_cast<FinalizablePersistentHandle*>(addr); |
46 RawObject* raw_obj = handle->raw(); | 46 RawObject* raw_obj = handle->raw(); |
47 visitor_->VisitPointer(&raw_obj); | 47 visitor_->VisitPointer(&raw_obj); |
48 } | 48 } |
49 | 49 |
50 | 50 |
51 void VerifyPointersVisitor::VerifyPointers() { | 51 void VerifyPointersVisitor::VerifyPointers() { |
52 NoGCScope no_gc; | 52 NoGCScope no_gc; |
53 Isolate* isolate = Isolate::Current(); | 53 Isolate* isolate = Isolate::Current(); |
54 VerifyPointersVisitor visitor(isolate); | 54 VerifyPointersVisitor visitor(isolate); |
55 // Visit all strongly reachable objects. | 55 // Visit all strongly reachable objects. |
56 isolate->VisitObjectPointers(&visitor, | 56 isolate->VisitObjectPointers(&visitor, |
57 false, // skip prologue weak handles | 57 false, // skip prologue weak handles |
58 StackFrameIterator::kValidateFrames); | 58 StackFrameIterator::kValidateFrames); |
59 VerifyWeakPointersVisitor weak_visitor(&visitor); | 59 VerifyWeakPointersVisitor weak_visitor(&visitor); |
60 // Visit weak handles and prologue weak handles. | 60 // Visit weak handles and prologue weak handles. |
61 isolate->VisitWeakPersistentHandles(&weak_visitor, | 61 isolate->VisitWeakPersistentHandles(&weak_visitor, |
62 true); // visit prologue weak handles | 62 true); // visit prologue weak handles |
63 } | 63 } |
64 | 64 |
65 } // namespace dart | 65 } // namespace dart |
OLD | NEW |