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" |
11 #include "vm/globals.h" | 11 #include "vm/globals.h" |
12 #include "vm/pages.h" | 12 #include "vm/pages.h" |
13 #include "vm/scavenger.h" | 13 #include "vm/scavenger.h" |
14 | 14 |
15 namespace dart { | 15 namespace dart { |
16 | 16 |
17 // Forward declarations. | 17 // Forward declarations. |
18 class HeapTrace; | |
19 class Isolate; | 18 class Isolate; |
20 class ObjectPointerVisitor; | 19 class ObjectPointerVisitor; |
21 class ObjectSet; | 20 class ObjectSet; |
22 class VirtualMemory; | 21 class VirtualMemory; |
23 | 22 |
24 DECLARE_FLAG(bool, verbose_gc); | 23 DECLARE_FLAG(bool, verbose_gc); |
25 DECLARE_FLAG(bool, verify_before_gc); | 24 DECLARE_FLAG(bool, verify_before_gc); |
26 DECLARE_FLAG(bool, verify_after_gc); | 25 DECLARE_FLAG(bool, verify_after_gc); |
27 DECLARE_FLAG(bool, gc_at_alloc); | 26 DECLARE_FLAG(bool, gc_at_alloc); |
28 | 27 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
144 uword TopAddress(); | 143 uword TopAddress(); |
145 uword EndAddress(); | 144 uword EndAddress(); |
146 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } | 145 static intptr_t new_space_offset() { return OFFSET_OF(Heap, new_space_); } |
147 | 146 |
148 // Initialize the heap and register it with the isolate. | 147 // Initialize the heap and register it with the isolate. |
149 static void Init(Isolate* isolate); | 148 static void Init(Isolate* isolate); |
150 | 149 |
151 // Verify that all pointers in the heap point to the heap. | 150 // Verify that all pointers in the heap point to the heap. |
152 bool Verify() const; | 151 bool Verify() const; |
153 | 152 |
154 // Accessor function to get the HeapTrace used for tracing. There | |
155 // should only ever be one of these per isolate | |
156 HeapTrace* trace() const { return heap_trace_; } | |
157 | |
158 // Print heap sizes. | 153 // Print heap sizes. |
159 void PrintSizes() const; | 154 void PrintSizes() const; |
160 | 155 |
161 // Return amount of memory used and capacity in a space. | 156 // Return amount of memory used and capacity in a space. |
162 intptr_t Used(Space space) const; | 157 intptr_t Used(Space space) const; |
163 intptr_t Capacity(Space space) const; | 158 intptr_t Capacity(Space space) const; |
164 | 159 |
165 // Returns the [lowest, highest) addresses in the heap. | 160 // Returns the [lowest, highest) addresses in the heap. |
166 void StartEndAddress(uword* start, uword* end) const; | 161 void StartEndAddress(uword* start, uword* end) const; |
167 | 162 |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 void RecordAfterGC(); | 234 void RecordAfterGC(); |
240 void PrintStats(); | 235 void PrintStats(); |
241 | 236 |
242 // The different spaces used for allocation. | 237 // The different spaces used for allocation. |
243 Scavenger* new_space_; | 238 Scavenger* new_space_; |
244 PageSpace* old_space_; | 239 PageSpace* old_space_; |
245 | 240 |
246 // GC stats collection. | 241 // GC stats collection. |
247 GCStats stats_; | 242 GCStats stats_; |
248 | 243 |
249 // The active heap trace. | |
250 HeapTrace* heap_trace_; | |
251 | |
252 // This heap is in read-only mode: No allocation is allowed. | 244 // This heap is in read-only mode: No allocation is allowed. |
253 bool read_only_; | 245 bool read_only_; |
254 | 246 |
255 // GC on the heap is in progress. | 247 // GC on the heap is in progress. |
256 bool gc_in_progress_; | 248 bool gc_in_progress_; |
257 | 249 |
258 friend class GCTestHelper; | 250 friend class GCTestHelper; |
259 DISALLOW_COPY_AND_ASSIGN(Heap); | 251 DISALLOW_COPY_AND_ASSIGN(Heap); |
260 }; | 252 }; |
261 | 253 |
(...skipping 21 matching lines...) Expand all Loading... |
283 NoHeapGrowthControlScope(); | 275 NoHeapGrowthControlScope(); |
284 ~NoHeapGrowthControlScope(); | 276 ~NoHeapGrowthControlScope(); |
285 private: | 277 private: |
286 bool current_growth_controller_state_; | 278 bool current_growth_controller_state_; |
287 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 279 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
288 }; | 280 }; |
289 | 281 |
290 } // namespace dart | 282 } // namespace dart |
291 | 283 |
292 #endif // VM_HEAP_H_ | 284 #endif // VM_HEAP_H_ |
OLD | NEW |