| 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_HEAP_H_ | 5 #ifndef VM_HEAP_H_ |
| 6 #define VM_HEAP_H_ | 6 #define VM_HEAP_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
| 10 #include "vm/globals.h" | 10 #include "vm/globals.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 ObjectPointerVisitor; | 16 class ObjectPointerVisitor; |
| 17 class PageSpace; | 17 class PageSpace; |
| 18 class Scavenger; | 18 class Scavenger; |
| 19 class VirtualMemory; | 19 class VirtualMemory; |
| 20 | 20 |
| 21 DECLARE_FLAG(bool, verbose_gc); | 21 DECLARE_FLAG(bool, verbose_gc); |
| 22 DECLARE_FLAG(bool, verify_before_gc); |
| 23 DECLARE_FLAG(bool, verify_after_gc); |
| 22 DECLARE_FLAG(bool, gc_at_alloc); | 24 DECLARE_FLAG(bool, gc_at_alloc); |
| 23 | 25 |
| 24 class Heap { | 26 class Heap { |
| 25 public: | 27 public: |
| 26 enum Space { | 28 enum Space { |
| 27 kNew, | 29 kNew, |
| 28 kOld, | 30 kOld, |
| 29 kExecutable | 31 kExecutable |
| 30 }; | 32 }; |
| 31 | 33 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 49 return 0; | 51 return 0; |
| 50 } | 52 } |
| 51 | 53 |
| 52 // Heap contains the specified address. | 54 // Heap contains the specified address. |
| 53 bool Contains(uword addr) const; | 55 bool Contains(uword addr) const; |
| 54 bool CodeContains(uword addr) const; | 56 bool CodeContains(uword addr) const; |
| 55 | 57 |
| 56 // Visit all pointers in the space. | 58 // Visit all pointers in the space. |
| 57 void IterateNewPointers(ObjectPointerVisitor* visitor); | 59 void IterateNewPointers(ObjectPointerVisitor* visitor); |
| 58 void IterateOldPointers(ObjectPointerVisitor* visitor); | 60 void IterateOldPointers(ObjectPointerVisitor* visitor); |
| 61 void IterateCodePointers(ObjectPointerVisitor* visitor); |
| 59 | 62 |
| 60 void CollectGarbage(Space space); | 63 void CollectGarbage(Space space); |
| 61 void CollectAllGarbage(); | 64 void CollectAllGarbage(); |
| 62 | 65 |
| 63 // Accessors for inlined allocation in generated code. | 66 // Accessors for inlined allocation in generated code. |
| 64 uword TopAddress(); | 67 uword TopAddress(); |
| 65 uword EndAddress(); | 68 uword EndAddress(); |
| 66 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } | 69 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } |
| 67 | 70 |
| 68 // Initialize the heap and register it with the isolate. | 71 // Initialize the heap and register it with the isolate. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 public: | 103 public: |
| 101 NoGCScope() {} | 104 NoGCScope() {} |
| 102 private: | 105 private: |
| 103 DISALLOW_COPY_AND_ASSIGN(NoGCScope); | 106 DISALLOW_COPY_AND_ASSIGN(NoGCScope); |
| 104 }; | 107 }; |
| 105 #endif // defined(DEBUG) | 108 #endif // defined(DEBUG) |
| 106 | 109 |
| 107 } // namespace dart | 110 } // namespace dart |
| 108 | 111 |
| 109 #endif // VM_HEAP_H_ | 112 #endif // VM_HEAP_H_ |
| OLD | NEW |