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

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

Issue 10696029: Implement a 2-pass heap verification algorithm. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: rebase Created 8 years, 5 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 DECLARE_FLAG(bool, verify_on_transition); 15 DECLARE_FLAG(bool, verify_on_transition);
16 16
17 #define VERIFY_ON_TRANSITION \ 17 #define VERIFY_ON_TRANSITION \
18 if (FLAG_verify_on_transition) { \ 18 if (FLAG_verify_on_transition) { \
19 VerifyPointersVisitor::VerifyPointers(); \ 19 VerifyPointersVisitor::VerifyPointers(); \
20 Isolate::Current()->heap()->Verify(); \ 20 Isolate::Current()->heap()->Verify(); \
21 } \ 21 } \
22 22
23 23
24 // Forward declarations. 24 // Forward declarations.
25 class Isolate; 25 class Isolate;
26 class ObjectSet;
26 class RawObject; 27 class RawObject;
27 28
29 class VerifyObjectVisitor : public ObjectVisitor {
30 public:
31 VerifyObjectVisitor(Isolate* isolate, ObjectSet* allocated_set)
32 : ObjectVisitor(isolate),
33 allocated_set_(allocated_set) {
34 }
35
36 virtual void VisitObject(RawObject* obj);
37
38 private:
39 ObjectSet* allocated_set_;
40
41 DISALLOW_COPY_AND_ASSIGN(VerifyObjectVisitor);
42 };
43
28 // A sample object pointer visitor implementation which verifies that 44 // A sample object pointer visitor implementation which verifies that
29 // the pointers visited are contained in the isolate heap. 45 // the pointers visited are contained in the isolate heap.
30 class VerifyPointersVisitor : public ObjectPointerVisitor { 46 class VerifyPointersVisitor : public ObjectPointerVisitor {
31 public: 47 public:
32 explicit VerifyPointersVisitor(Isolate* isolate) 48 explicit VerifyPointersVisitor(Isolate* isolate, ObjectSet* allocated_set)
33 : ObjectPointerVisitor(isolate) { 49 : ObjectPointerVisitor(isolate),
50 allocated_set_(allocated_set) {
34 } 51 }
35 52
36 virtual void VisitPointers(RawObject** first, RawObject** last); 53 virtual void VisitPointers(RawObject** first, RawObject** last);
37 54
38 static void VerifyPointers(); 55 static void VerifyPointers();
39 56
40 private: 57 private:
58 ObjectSet* allocated_set_;
59
41 DISALLOW_COPY_AND_ASSIGN(VerifyPointersVisitor); 60 DISALLOW_COPY_AND_ASSIGN(VerifyPointersVisitor);
42 }; 61 };
43 62
44 class VerifyWeakPointersVisitor : public HandleVisitor { 63 class VerifyWeakPointersVisitor : public HandleVisitor {
45 public: 64 public:
46 explicit VerifyWeakPointersVisitor(VerifyPointersVisitor* visitor) 65 explicit VerifyWeakPointersVisitor(VerifyPointersVisitor* visitor)
47 : visitor_(visitor) { 66 : visitor_(visitor) {
48 } 67 }
49 68
50 virtual void VisitHandle(uword addr); 69 virtual void VisitHandle(uword addr);
51 70
52 private: 71 private:
53 ObjectPointerVisitor* visitor_; 72 ObjectPointerVisitor* visitor_;
54 73
74 ObjectSet* allocated_set;
75
55 DISALLOW_COPY_AND_ASSIGN(VerifyWeakPointersVisitor); 76 DISALLOW_COPY_AND_ASSIGN(VerifyWeakPointersVisitor);
56 }; 77 };
57 78
58 } // namespace dart 79 } // namespace dart
59 80
60 #endif // VM_VERIFIER_H_ 81 #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