| 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 RUNTIME_VM_VISITOR_H_ | 5 #ifndef RUNTIME_VM_VISITOR_H_ |
| 6 #define RUNTIME_VM_VISITOR_H_ | 6 #define RUNTIME_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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 | 36 |
| 37 void VisitPointer(RawObject** p) { VisitPointers(p, p); } | 37 void VisitPointer(RawObject** p) { VisitPointers(p, p); } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 Isolate* isolate_; | 40 Isolate* isolate_; |
| 41 NoSafepointScope no_safepoints_; | 41 NoSafepointScope no_safepoints_; |
| 42 | 42 |
| 43 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectPointerVisitor); | 43 DISALLOW_IMPLICIT_CONSTRUCTORS(ObjectPointerVisitor); |
| 44 }; | 44 }; |
| 45 | 45 |
| 46 | |
| 47 // An object visitor interface. | 46 // An object visitor interface. |
| 48 class ObjectVisitor { | 47 class ObjectVisitor { |
| 49 public: | 48 public: |
| 50 ObjectVisitor() {} | 49 ObjectVisitor() {} |
| 51 | 50 |
| 52 virtual ~ObjectVisitor() {} | 51 virtual ~ObjectVisitor() {} |
| 53 | 52 |
| 54 // Invoked for each object. | 53 // Invoked for each object. |
| 55 virtual void VisitObject(RawObject* obj) = 0; | 54 virtual void VisitObject(RawObject* obj) = 0; |
| 56 | 55 |
| 57 private: | 56 private: |
| 58 DISALLOW_COPY_AND_ASSIGN(ObjectVisitor); | 57 DISALLOW_COPY_AND_ASSIGN(ObjectVisitor); |
| 59 }; | 58 }; |
| 60 | 59 |
| 61 | |
| 62 // An object finder visitor interface. | 60 // An object finder visitor interface. |
| 63 class FindObjectVisitor { | 61 class FindObjectVisitor { |
| 64 public: | 62 public: |
| 65 FindObjectVisitor() {} | 63 FindObjectVisitor() {} |
| 66 virtual ~FindObjectVisitor() {} | 64 virtual ~FindObjectVisitor() {} |
| 67 | 65 |
| 68 // Allow to specify a address filter. | 66 // Allow to specify a address filter. |
| 69 virtual uword filter_addr() const { return 0; } | 67 virtual uword filter_addr() const { return 0; } |
| 70 bool VisitRange(uword begin_addr, uword end_addr) const { | 68 bool VisitRange(uword begin_addr, uword end_addr) const { |
| 71 uword addr = filter_addr(); | 69 uword addr = filter_addr(); |
| 72 return (addr == 0) || ((begin_addr <= addr) && (addr < end_addr)); | 70 return (addr == 0) || ((begin_addr <= addr) && (addr < end_addr)); |
| 73 } | 71 } |
| 74 | 72 |
| 75 // Check if object matches find condition. | 73 // Check if object matches find condition. |
| 76 virtual bool FindObject(RawObject* obj) const = 0; | 74 virtual bool FindObject(RawObject* obj) const = 0; |
| 77 | 75 |
| 78 private: | 76 private: |
| 79 DISALLOW_COPY_AND_ASSIGN(FindObjectVisitor); | 77 DISALLOW_COPY_AND_ASSIGN(FindObjectVisitor); |
| 80 }; | 78 }; |
| 81 | 79 |
| 82 } // namespace dart | 80 } // namespace dart |
| 83 | 81 |
| 84 #endif // RUNTIME_VM_VISITOR_H_ | 82 #endif // RUNTIME_VM_VISITOR_H_ |
| OLD | NEW |