OLD | NEW |
---|---|
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, 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 "vm/assert.h" | 7 #include "vm/assert.h" |
8 #include "vm/dart.h" | 8 #include "vm/dart.h" |
9 #include "vm/dart_api_state.h" | |
9 #include "vm/freelist.h" | 10 #include "vm/freelist.h" |
10 #include "vm/heap.h" | 11 #include "vm/heap.h" |
11 #include "vm/isolate.h" | 12 #include "vm/isolate.h" |
12 #include "vm/object.h" | 13 #include "vm/object.h" |
13 #include "vm/raw_object.h" | 14 #include "vm/raw_object.h" |
14 #include "vm/stack_frame.h" | 15 #include "vm/stack_frame.h" |
15 | 16 |
16 namespace dart { | 17 namespace dart { |
17 | 18 |
18 DEFINE_FLAG(bool, verify_on_transition, false, "Verify on dart <==> VM."); | 19 DEFINE_FLAG(bool, verify_on_transition, false, "Verify on dart <==> VM."); |
(...skipping 13 matching lines...) Expand all Loading... | |
32 if (!Isolate::Current()->heap()->Contains(obj_addr) && | 33 if (!Isolate::Current()->heap()->Contains(obj_addr) && |
33 !Dart::vm_isolate()->heap()->Contains(obj_addr)) { | 34 !Dart::vm_isolate()->heap()->Contains(obj_addr)) { |
34 FATAL1("Invalid object pointer encountered 0x%lx\n", obj_addr); | 35 FATAL1("Invalid object pointer encountered 0x%lx\n", obj_addr); |
35 } | 36 } |
36 raw_obj->Validate(); | 37 raw_obj->Validate(); |
37 } | 38 } |
38 } | 39 } |
39 } | 40 } |
40 | 41 |
41 | 42 |
43 void VerifyWeakPointersVisitor::VisitHandle(uword* addr) { | |
44 WeakPersistentHandle* handle = reinterpret_cast<WeakPersistentHandle*>(addr); | |
45 RawObject* raw_obj = handle->raw(); | |
46 visitor_->VisitPointer(&raw_obj); | |
47 } | |
48 | |
49 | |
42 void VerifyPointersVisitor::VerifyPointers() { | 50 void VerifyPointersVisitor::VerifyPointers() { |
43 NoGCScope no_gc; | 51 NoGCScope no_gc; |
44 VerifyPointersVisitor visitor; | 52 VerifyPointersVisitor visitor; |
45 Isolate::Current()->VisitObjectPointers(&visitor, | 53 Isolate::Current()->VisitObjectPointers(&visitor, |
Ivan Posva
2012/01/12 23:30:38
Isolate* isolate = Isolate::Current();
isolate->Vi
cshapiro
2012/01/13 01:30:03
Thanks, much cleaner. Done.
| |
46 StackFrameIterator::kValidateFrames); | 54 StackFrameIterator::kValidateFrames); |
55 VerifyWeakPointersVisitor weak_visitor(&visitor); | |
56 Isolate::Current()->VisitWeakPersistentHandles(&weak_visitor); | |
47 } | 57 } |
48 | 58 |
49 } // namespace dart | 59 } // namespace dart |
OLD | NEW |