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

Side by Side Diff: vm/verifier.h

Issue 10271032: - Add extra checking when validating objects. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/runtime/
Patch Set: Created 8 years, 7 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 | « vm/stub_code_x64.cc ('k') | 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 RawObject; 26 class RawObject;
26 27
27 // A sample object pointer visitor implementation which verifies that 28 // A sample object pointer visitor implementation which verifies that
28 // the pointers visited are contained in the isolate heap. 29 // the pointers visited are contained in the isolate heap.
29 class VerifyPointersVisitor : public ObjectPointerVisitor { 30 class VerifyPointersVisitor : public ObjectPointerVisitor {
30 public: 31 public:
31 VerifyPointersVisitor() {} 32 explicit VerifyPointersVisitor(Isolate* isolate) : isolate_(isolate) {}
32 33
33 virtual void VisitPointers(RawObject** first, RawObject** last); 34 virtual void VisitPointers(RawObject** first, RawObject** last);
34 35
35 static void VerifyPointers(); 36 static void VerifyPointers();
36 37
37 private: 38 private:
39 Isolate* isolate_;
40
38 DISALLOW_COPY_AND_ASSIGN(VerifyPointersVisitor); 41 DISALLOW_COPY_AND_ASSIGN(VerifyPointersVisitor);
39 }; 42 };
40 43
41 class VerifyWeakPointersVisitor : public HandleVisitor { 44 class VerifyWeakPointersVisitor : public HandleVisitor {
42 public: 45 public:
43 explicit VerifyWeakPointersVisitor(VerifyPointersVisitor* visitor) 46 explicit VerifyWeakPointersVisitor(VerifyPointersVisitor* visitor)
44 : visitor_(visitor) { 47 : visitor_(visitor) {
45 } 48 }
46 49
47 virtual void VisitHandle(uword addr); 50 virtual void VisitHandle(uword addr);
48 51
49 private: 52 private:
50 ObjectPointerVisitor* visitor_; 53 ObjectPointerVisitor* visitor_;
51 54
52 DISALLOW_COPY_AND_ASSIGN(VerifyWeakPointersVisitor); 55 DISALLOW_COPY_AND_ASSIGN(VerifyWeakPointersVisitor);
53 }; 56 };
54 57
55 } // namespace dart 58 } // namespace dart
56 59
57 #endif // VM_VERIFIER_H_ 60 #endif // VM_VERIFIER_H_
OLDNEW
« no previous file with comments | « vm/stub_code_x64.cc ('k') | vm/verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698