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

Side by Side Diff: runtime/vm/verifier.h

Issue 630933002: Check mark bit when verifying heap. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 months 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
« no previous file with comments | « runtime/vm/scavenger.cc ('k') | runtime/vm/verifier.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef VM_VERIFIER_H_ 5 #ifndef VM_VERIFIER_H_
6 #define VM_VERIFIER_H_ 6 #define VM_VERIFIER_H_
7 7
8 #include "vm/flags.h" 8 #include "vm/flags.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/handles.h" 10 #include "vm/handles.h"
11 #include "vm/visitor.h" 11 #include "vm/visitor.h"
12 12
13 namespace dart { 13 namespace dart {
14 14
15 // Forward declarations. 15 // Forward declarations.
16 class Isolate; 16 class Isolate;
17 class ObjectSet; 17 class ObjectSet;
18 class RawObject; 18 class RawObject;
19 19
20
21 enum MarkExpectation {
22 kForbidMarked,
23 kAllowMarked,
24 kRequireMarked
25 };
26
27
20 class VerifyObjectVisitor : public ObjectVisitor { 28 class VerifyObjectVisitor : public ObjectVisitor {
21 public: 29 public:
22 VerifyObjectVisitor(Isolate* isolate, ObjectSet* allocated_set) 30 VerifyObjectVisitor(Isolate* isolate,
31 ObjectSet* allocated_set,
32 MarkExpectation mark_expectation)
23 : ObjectVisitor(isolate), 33 : ObjectVisitor(isolate),
24 allocated_set_(allocated_set) { 34 allocated_set_(allocated_set),
35 mark_expectation_(mark_expectation) {
25 } 36 }
26 37
27 virtual void VisitObject(RawObject* obj); 38 virtual void VisitObject(RawObject* obj);
28 39
29 private: 40 private:
30 ObjectSet* allocated_set_; 41 ObjectSet* allocated_set_;
42 MarkExpectation mark_expectation_;
31 43
32 DISALLOW_COPY_AND_ASSIGN(VerifyObjectVisitor); 44 DISALLOW_COPY_AND_ASSIGN(VerifyObjectVisitor);
33 }; 45 };
34 46
35 // A sample object pointer visitor implementation which verifies that 47 // A sample object pointer visitor implementation which verifies that
36 // the pointers visited are contained in the isolate heap. 48 // the pointers visited are contained in the isolate heap.
37 class VerifyPointersVisitor : public ObjectPointerVisitor { 49 class VerifyPointersVisitor : public ObjectPointerVisitor {
38 public: 50 public:
39 explicit VerifyPointersVisitor(Isolate* isolate, ObjectSet* allocated_set) 51 explicit VerifyPointersVisitor(Isolate* isolate, ObjectSet* allocated_set)
40 : ObjectPointerVisitor(isolate), 52 : ObjectPointerVisitor(isolate),
41 allocated_set_(allocated_set) { 53 allocated_set_(allocated_set) {
42 } 54 }
43 55
44 virtual void VisitPointers(RawObject** first, RawObject** last); 56 virtual void VisitPointers(RawObject** first, RawObject** last);
45 57
46 static void VerifyPointers(); 58 static void VerifyPointers(MarkExpectation mark_expectation = kForbidMarked);
47 59
48 private: 60 private:
49 ObjectSet* allocated_set_; 61 ObjectSet* allocated_set_;
50 62
51 DISALLOW_COPY_AND_ASSIGN(VerifyPointersVisitor); 63 DISALLOW_COPY_AND_ASSIGN(VerifyPointersVisitor);
52 }; 64 };
53 65
54 class VerifyWeakPointersVisitor : public HandleVisitor { 66 class VerifyWeakPointersVisitor : public HandleVisitor {
55 public: 67 public:
56 explicit VerifyWeakPointersVisitor(VerifyPointersVisitor* visitor) 68 explicit VerifyWeakPointersVisitor(VerifyPointersVisitor* visitor)
57 : HandleVisitor(Isolate::Current()), 69 : HandleVisitor(Isolate::Current()),
58 visitor_(visitor) { 70 visitor_(visitor) {
59 } 71 }
60 72
61 virtual void VisitHandle(uword addr); 73 virtual void VisitHandle(uword addr);
62 74
63 private: 75 private:
64 ObjectPointerVisitor* visitor_; 76 ObjectPointerVisitor* visitor_;
65 77
66 ObjectSet* allocated_set; 78 ObjectSet* allocated_set;
67 79
68 DISALLOW_COPY_AND_ASSIGN(VerifyWeakPointersVisitor); 80 DISALLOW_COPY_AND_ASSIGN(VerifyWeakPointersVisitor);
69 }; 81 };
70 82
71 } // namespace dart 83 } // namespace dart
72 84
73 #endif // VM_VERIFIER_H_ 85 #endif // VM_VERIFIER_H_
OLDNEW
« no previous file with comments | « runtime/vm/scavenger.cc ('k') | runtime/vm/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698