| OLD | NEW |
| 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/globals.h" | 8 #include "vm/globals.h" |
| 9 #include "vm/growable_array.h" | 9 #include "vm/growable_array.h" |
| 10 | 10 |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 DISALLOW_COPY_AND_ASSIGN(ObjectVisitor); | 62 DISALLOW_COPY_AND_ASSIGN(ObjectVisitor); |
| 63 }; | 63 }; |
| 64 | 64 |
| 65 | 65 |
| 66 // An object finder visitor interface. | 66 // An object finder visitor interface. |
| 67 class FindObjectVisitor { | 67 class FindObjectVisitor { |
| 68 public: | 68 public: |
| 69 explicit FindObjectVisitor(Isolate* isolate) : isolate_(isolate) {} | 69 explicit FindObjectVisitor(Isolate* isolate) : isolate_(isolate) {} |
| 70 virtual ~FindObjectVisitor() {} | 70 virtual ~FindObjectVisitor() {} |
| 71 | 71 |
| 72 // Allow to specify a address filter. |
| 73 virtual uword filter_addr() const { return 0; } |
| 74 bool VisitRange(uword begin_addr, uword end_addr) const { |
| 75 uword addr = filter_addr(); |
| 76 return (addr == 0) || ((begin_addr <= addr) && (addr < end_addr)); |
| 77 } |
| 78 |
| 72 // Check if object matches find condition. | 79 // Check if object matches find condition. |
| 73 virtual bool FindObject(RawObject* obj) = 0; | 80 virtual bool FindObject(RawObject* obj) const = 0; |
| 74 | 81 |
| 75 private: | 82 private: |
| 76 Isolate* isolate_; | 83 Isolate* isolate_; |
| 77 | 84 |
| 78 DISALLOW_IMPLICIT_CONSTRUCTORS(FindObjectVisitor); | 85 DISALLOW_IMPLICIT_CONSTRUCTORS(FindObjectVisitor); |
| 79 }; | 86 }; |
| 80 | 87 |
| 81 } // namespace dart | 88 } // namespace dart |
| 82 | 89 |
| 83 #endif // VM_VISITOR_H_ | 90 #endif // VM_VISITOR_H_ |
| OLD | NEW |