| 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 | 10 |
| 10 namespace dart { | 11 namespace dart { |
| 11 | 12 |
| 12 // Forward declarations. | 13 // Forward declarations. |
| 13 class Isolate; | 14 class Isolate; |
| 14 class RawObject; | 15 class RawObject; |
| 15 | 16 |
| 16 // An object pointer visitor interface. | 17 // An object pointer visitor interface. |
| 17 class ObjectPointerVisitor { | 18 class ObjectPointerVisitor { |
| 18 public: | 19 public: |
| 19 explicit ObjectPointerVisitor(Isolate* isolate) : isolate_(isolate) {} | 20 explicit ObjectPointerVisitor(Isolate* isolate) : isolate_(isolate) {} |
| 20 virtual ~ObjectPointerVisitor() {} | 21 virtual ~ObjectPointerVisitor() {} |
| 21 | 22 |
| 22 Isolate* isolate() const { return isolate_; } | 23 Isolate* isolate() const { return isolate_; } |
| 23 | 24 |
| 24 // Range of pointers to visit 'first' <= pointer <= 'last'. | 25 // Range of pointers to visit 'first' <= pointer <= 'last'. |
| 25 virtual void VisitPointers(RawObject** first, RawObject** last) = 0; | 26 virtual void VisitPointers(RawObject** first, RawObject** last) = 0; |
| 26 | 27 |
| 28 virtual bool visit_function_code() const { return true; } |
| 29 virtual GrowableArray<RawFunction*>* skipped_code_functions() { |
| 30 return NULL; |
| 31 } |
| 32 |
| 27 // 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'. |
| 28 void VisitPointers(RawObject** p, intptr_t len) { | 34 void VisitPointers(RawObject** p, intptr_t len) { |
| 29 VisitPointers(p, (p + len - 1)); | 35 VisitPointers(p, (p + len - 1)); |
| 30 } | 36 } |
| 31 | 37 |
| 32 void VisitPointer(RawObject** p) { VisitPointers(p , p); } | 38 void VisitPointer(RawObject** p) { VisitPointers(p , p); } |
| 33 | 39 |
| 34 private: | 40 private: |
| 35 Isolate* isolate_; | 41 Isolate* isolate_; |
| 36 | 42 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 68 | 74 |
| 69 private: | 75 private: |
| 70 Isolate* isolate_; | 76 Isolate* isolate_; |
| 71 | 77 |
| 72 DISALLOW_IMPLICIT_CONSTRUCTORS(FindObjectVisitor); | 78 DISALLOW_IMPLICIT_CONSTRUCTORS(FindObjectVisitor); |
| 73 }; | 79 }; |
| 74 | 80 |
| 75 } // namespace dart | 81 } // namespace dart |
| 76 | 82 |
| 77 #endif // VM_VISITOR_H_ | 83 #endif // VM_VISITOR_H_ |
| OLD | NEW |