OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/allocation.h" | 9 #include "vm/allocation.h" |
10 #include "vm/flags.h" | 10 #include "vm/flags.h" |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 // traversal through the heap space continues. | 125 // traversal through the heap space continues. |
126 RawInstructions* FindObjectInCodeSpace(FindObjectVisitor* visitor); | 126 RawInstructions* FindObjectInCodeSpace(FindObjectVisitor* visitor); |
127 RawInstructions* FindObjectInStubCodeSpace(FindObjectVisitor* visitor); | 127 RawInstructions* FindObjectInStubCodeSpace(FindObjectVisitor* visitor); |
128 | 128 |
129 void CollectGarbage(Space space); | 129 void CollectGarbage(Space space); |
130 void CollectGarbage(Space space, ApiCallbacks api_callbacks); | 130 void CollectGarbage(Space space, ApiCallbacks api_callbacks); |
131 void CollectAllGarbage(); | 131 void CollectAllGarbage(); |
132 | 132 |
133 // Enables growth control on the page space heaps. This should be | 133 // Enables growth control on the page space heaps. This should be |
134 // called before any user code is executed. | 134 // called before any user code is executed. |
135 void EnableGrowthControl(); | 135 void EnableGrowthControl() { SetGrowthControlState(true); } |
| 136 void DisableGrowthControl() { SetGrowthControlState(false); } |
| 137 void SetGrowthControlState(bool state); |
| 138 bool GrowthControlState(); |
136 | 139 |
137 // Protect access to the heap. | 140 // Protect access to the heap. |
138 void WriteProtect(bool read_only); | 141 void WriteProtect(bool read_only); |
139 | 142 |
140 // Accessors for inlined allocation in generated code. | 143 // Accessors for inlined allocation in generated code. |
141 uword TopAddress(); | 144 uword TopAddress(); |
142 uword EndAddress(); | 145 uword EndAddress(); |
143 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } | 146 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } |
144 | 147 |
145 // Initialize the heap and register it with the isolate. | 148 // Initialize the heap and register it with the isolate. |
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 }; | 270 }; |
268 #else // defined(DEBUG) | 271 #else // defined(DEBUG) |
269 class NoGCScope : public ValueObject { | 272 class NoGCScope : public ValueObject { |
270 public: | 273 public: |
271 NoGCScope() {} | 274 NoGCScope() {} |
272 private: | 275 private: |
273 DISALLOW_COPY_AND_ASSIGN(NoGCScope); | 276 DISALLOW_COPY_AND_ASSIGN(NoGCScope); |
274 }; | 277 }; |
275 #endif // defined(DEBUG) | 278 #endif // defined(DEBUG) |
276 | 279 |
| 280 |
| 281 class NoHeapGrowthControlScope : public StackResource { |
| 282 public: |
| 283 NoHeapGrowthControlScope(); |
| 284 ~NoHeapGrowthControlScope(); |
| 285 private: |
| 286 bool current_growth_controller_state_; |
| 287 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
| 288 }; |
| 289 |
277 } // namespace dart | 290 } // namespace dart |
278 | 291 |
279 #endif // VM_HEAP_H_ | 292 #endif // VM_HEAP_H_ |
OLD | NEW |