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

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

Issue 1838373002: Remove unnecessary isolate argument from some visitors (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Cleanup Created 4 years, 8 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
« no previous file with comments | « runtime/vm/verifier.cc ('k') | no next file » | 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_VISITOR_H_ 5 #ifndef VM_VISITOR_H_
6 #define VM_VISITOR_H_ 6 #define VM_VISITOR_H_
7 7
8 #include "vm/allocation.h" 8 #include "vm/allocation.h"
9 #include "vm/globals.h" 9 #include "vm/globals.h"
10 #include "vm/growable_array.h" 10 #include "vm/growable_array.h"
11 11
12 namespace dart { 12 namespace dart {
13 13
14 // Forward declarations. 14 // Forward declarations.
15 class Isolate; 15 class Isolate;
16 class RawObject; 16 class RawObject;
17 17
18 // An object pointer visitor interface. 18 // An object pointer visitor interface.
19 class ObjectPointerVisitor { 19 class ObjectPointerVisitor {
20 public: 20 public:
21 explicit ObjectPointerVisitor(Isolate* isolate) : isolate_(isolate) {} 21 explicit ObjectPointerVisitor(Isolate* isolate) : isolate_(isolate) { }
22 virtual ~ObjectPointerVisitor() {} 22 virtual ~ObjectPointerVisitor() { }
23 23
24 Isolate* isolate() const { return isolate_; } 24 Isolate* isolate() const { return isolate_; }
25 25
26 // Range of pointers to visit 'first' <= pointer <= 'last'. 26 // Range of pointers to visit 'first' <= pointer <= 'last'.
27 virtual void VisitPointers(RawObject** first, RawObject** last) = 0; 27 virtual void VisitPointers(RawObject** first, RawObject** last) = 0;
28 28
29 virtual bool visit_function_code() const { return true; } 29 virtual bool visit_function_code() const { return true; }
30 virtual void add_skipped_code_function(RawFunction* funct) { 30 virtual void add_skipped_code_function(RawFunction* funct) {
31 UNREACHABLE(); 31 UNREACHABLE();
32 } 32 }
33 // len argument is the number of pointers to visit starting from 'p'. 33 // len argument is the number of pointers to visit starting from 'p'.
34 void VisitPointers(RawObject** p, intptr_t len) { 34 void VisitPointers(RawObject** p, intptr_t len) {
35 VisitPointers(p, (p + len - 1)); 35 VisitPointers(p, (p + len - 1));
36 } 36 }
37 37
38 void VisitPointer(RawObject** p) { VisitPointers(p , p); } 38 void VisitPointer(RawObject** p) { VisitPointers(p , p); }
39 39
40 private: 40 private:
41 Isolate* isolate_; 41 Isolate* isolate_;
42 NoSafepointScope no_safepoints_; 42 NoSafepointScope no_safepoints_;
43 43
44 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectPointerVisitor); 44 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectPointerVisitor);
45 }; 45 };
46 46
47 47
48 // An object visitor interface. 48 // An object visitor interface.
49 class ObjectVisitor { 49 class ObjectVisitor {
50 public: 50 public:
51 explicit ObjectVisitor(Isolate* isolate) : isolate_(isolate) {} 51 ObjectVisitor() { }
52 52
53 virtual ~ObjectVisitor() {} 53 virtual ~ObjectVisitor() { }
54
55 Isolate* isolate() const { return isolate_; }
56 54
57 // Invoked for each object. 55 // Invoked for each object.
58 virtual void VisitObject(RawObject* obj) = 0; 56 virtual void VisitObject(RawObject* obj) = 0;
59 57
60 private: 58 private:
61 Isolate* isolate_;
62
63 DISALLOW_COPY_AND_ASSIGN(ObjectVisitor); 59 DISALLOW_COPY_AND_ASSIGN(ObjectVisitor);
64 }; 60 };
65 61
66 62
67 // An object finder visitor interface. 63 // An object finder visitor interface.
68 class FindObjectVisitor { 64 class FindObjectVisitor {
69 public: 65 public:
70 explicit FindObjectVisitor(Isolate* isolate) : isolate_(isolate) {} 66 FindObjectVisitor() { }
71 virtual ~FindObjectVisitor() {} 67 virtual ~FindObjectVisitor() { }
72 68
73 // Allow to specify a address filter. 69 // Allow to specify a address filter.
74 virtual uword filter_addr() const { return 0; } 70 virtual uword filter_addr() const { return 0; }
75 bool VisitRange(uword begin_addr, uword end_addr) const { 71 bool VisitRange(uword begin_addr, uword end_addr) const {
76 uword addr = filter_addr(); 72 uword addr = filter_addr();
77 return (addr == 0) || ((begin_addr <= addr) && (addr < end_addr)); 73 return (addr == 0) || ((begin_addr <= addr) && (addr < end_addr));
78 } 74 }
79 75
80 // Check if object matches find condition. 76 // Check if object matches find condition.
81 virtual bool FindObject(RawObject* obj) const = 0; 77 virtual bool FindObject(RawObject* obj) const = 0;
82 78
83 private: 79 private:
84 Isolate* isolate_; 80 DISALLOW_COPY_AND_ASSIGN(FindObjectVisitor);
85
86 DISALLOW_IMPLICIT_CONSTRUCTORS(FindObjectVisitor);
87 }; 81 };
88 82
89 } // namespace dart 83 } // namespace dart
90 84
91 #endif // VM_VISITOR_H_ 85 #endif // VM_VISITOR_H_
OLDNEW
« no previous file with comments | « runtime/vm/verifier.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698