Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1)

Side by Side Diff: vm/verifier.cc

Issue 8898034: - Implement the old sweeper. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/freelist.h"
9 #include "vm/heap.h" 10 #include "vm/heap.h"
10 #include "vm/isolate.h" 11 #include "vm/isolate.h"
11 #include "vm/object.h" 12 #include "vm/object.h"
12 #include "vm/raw_object.h" 13 #include "vm/raw_object.h"
13 #include "vm/stack_frame.h" 14 #include "vm/stack_frame.h"
14 15
15 namespace dart { 16 namespace dart {
16 17
17 DEFINE_FLAG(bool, verify_on_transition, false, "Verify on dart <==> VM."); 18 DEFINE_FLAG(bool, verify_on_transition, false, "Verify on dart <==> VM.");
18 19
19 20
20 void VerifyPointersVisitor::VisitPointers(RawObject** first, RawObject** last) { 21 void VerifyPointersVisitor::VisitPointers(RawObject** first, RawObject** last) {
21 for (RawObject** current = first; current <= last; current++) { 22 for (RawObject** current = first; current <= last; current++) {
22 RawObject* raw_obj = *current; 23 RawObject* raw_obj = *current;
23 if (raw_obj->IsHeapObject()) { 24 if (raw_obj->IsHeapObject()) {
25 // Skip visits of FreeListElements.
26 if (FreeListElement::IsSpecialMap(raw_obj)) {
27 // Only the class of the free list element should ever be visited.
28 ASSERT(first == last);
29 return;
30 }
24 uword obj_addr = RawObject::ToAddr(raw_obj); 31 uword obj_addr = RawObject::ToAddr(raw_obj);
25 if (!Isolate::Current()->heap()->Contains(obj_addr) && 32 if (!Isolate::Current()->heap()->Contains(obj_addr) &&
26 !Dart::vm_isolate()->heap()->Contains(obj_addr)) { 33 !Dart::vm_isolate()->heap()->Contains(obj_addr)) {
27 FATAL1("Invalid object pointer encountered 0x%lx\n", obj_addr); 34 FATAL1("Invalid object pointer encountered 0x%lx\n", obj_addr);
28 } 35 }
29 raw_obj->Validate(); 36 raw_obj->Validate();
30 } 37 }
31 } 38 }
32 } 39 }
33 40
34 41
35 void VerifyPointersVisitor::VerifyPointers() { 42 void VerifyPointersVisitor::VerifyPointers() {
36 NoGCScope no_gc; 43 NoGCScope no_gc;
37 VerifyPointersVisitor visitor; 44 VerifyPointersVisitor visitor;
38 Isolate::Current()->VisitObjectPointers(&visitor, 45 Isolate::Current()->VisitObjectPointers(&visitor,
39 StackFrameIterator::kValidateFrames); 46 StackFrameIterator::kValidateFrames);
40 } 47 }
41 48
42 } // namespace dart 49 } // namespace dart
OLDNEW
« vm/pages.cc ('K') | « vm/raw_object.cc ('k') | vm/vm_sources.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698