| 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" |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 default: | 46 default: |
| 47 UNREACHABLE(); | 47 UNREACHABLE(); |
| 48 } | 48 } |
| 49 return 0; | 49 return 0; |
| 50 } | 50 } |
| 51 | 51 |
| 52 // Heap contains the specified address. | 52 // Heap contains the specified address. |
| 53 bool Contains(uword addr) const; | 53 bool Contains(uword addr) const; |
| 54 bool CodeContains(uword addr) const; | 54 bool CodeContains(uword addr) const; |
| 55 | 55 |
| 56 // Visit all pointers in the space. |
| 57 void IterateNewPointers(ObjectPointerVisitor* visitor); |
| 58 void IterateOldPointers(ObjectPointerVisitor* visitor); |
| 59 |
| 60 void CollectGarbage(Space space); |
| 61 void CollectAllGarbage(); |
| 62 |
| 63 // Accessors for inlined allocation in generated code. |
| 64 uword TopAddress(); |
| 65 uword EndAddress(); |
| 66 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } |
| 67 |
| 56 // Initialize the heap and register it with the isolate. | 68 // Initialize the heap and register it with the isolate. |
| 57 static void Init(Isolate* isolate); | 69 static void Init(Isolate* isolate); |
| 58 | 70 |
| 59 // Verify that all pointers in the heap point to the heap. | 71 // Verify that all pointers in the heap point to the heap. |
| 60 bool Verify() const; | 72 bool Verify() const; |
| 61 | 73 |
| 62 void IterateOldPointers(ObjectPointerVisitor* visitor); | |
| 63 | |
| 64 // Accessors for inlined allocation in generated code. | |
| 65 uword TopAddress(); | |
| 66 uword EndAddress(); | |
| 67 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } | |
| 68 | |
| 69 private: | 74 private: |
| 70 Heap(); | 75 Heap(); |
| 71 | 76 |
| 72 uword AllocateNew(intptr_t size); | 77 uword AllocateNew(intptr_t size); |
| 73 uword AllocateOld(intptr_t size); | 78 uword AllocateOld(intptr_t size); |
| 74 uword AllocateCode(intptr_t size); | 79 uword AllocateCode(intptr_t size); |
| 75 | 80 |
| 76 // The different spaces used for allocation. | 81 // The different spaces used for allocation. |
| 77 Scavenger* new_space_; | 82 Scavenger* new_space_; |
| 78 PageSpace* old_space_; | 83 PageSpace* old_space_; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 95 public: | 100 public: |
| 96 NoGCScope() {} | 101 NoGCScope() {} |
| 97 private: | 102 private: |
| 98 DISALLOW_COPY_AND_ASSIGN(NoGCScope); | 103 DISALLOW_COPY_AND_ASSIGN(NoGCScope); |
| 99 }; | 104 }; |
| 100 #endif // defined(DEBUG) | 105 #endif // defined(DEBUG) |
| 101 | 106 |
| 102 } // namespace dart | 107 } // namespace dart |
| 103 | 108 |
| 104 #endif // VM_HEAP_H_ | 109 #endif // VM_HEAP_H_ |
| OLD | NEW |