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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 Heap::GCReason reason_; | 205 Heap::GCReason reason_; |
206 | 206 |
207 class Data : public ValueObject { | 207 class Data : public ValueObject { |
208 public: | 208 public: |
209 Data() {} | 209 Data() {} |
210 int64_t micros_; | 210 int64_t micros_; |
211 intptr_t new_used_; | 211 intptr_t new_used_; |
212 intptr_t new_capacity_; | 212 intptr_t new_capacity_; |
213 intptr_t old_used_; | 213 intptr_t old_used_; |
214 intptr_t old_capacity_; | 214 intptr_t old_capacity_; |
215 | 215 private: |
216 DISALLOW_COPY_AND_ASSIGN(Data); | 216 DISALLOW_COPY_AND_ASSIGN(Data); |
217 }; | 217 }; |
218 | 218 |
219 enum { | 219 enum { |
220 kDataEntries = 4 | 220 kDataEntries = 4 |
221 }; | 221 }; |
222 | 222 |
223 Data before_; | 223 Data before_; |
224 Data after_; | 224 Data after_; |
225 int64_t times_[kDataEntries]; | 225 int64_t times_[kDataEntries]; |
226 intptr_t data_[kDataEntries]; | 226 intptr_t data_[kDataEntries]; |
227 | 227 |
| 228 private: |
228 DISALLOW_COPY_AND_ASSIGN(GCStats); | 229 DISALLOW_COPY_AND_ASSIGN(GCStats); |
229 }; | 230 }; |
230 | 231 |
231 static const intptr_t kNewAllocatableSize = 256 * KB; | 232 static const intptr_t kNewAllocatableSize = 256 * KB; |
232 | 233 |
233 Heap(); | 234 Heap(); |
234 | 235 |
235 uword AllocateNew(intptr_t size); | 236 uword AllocateNew(intptr_t size); |
236 uword AllocateOld(intptr_t size, HeapPage::PageType type); | 237 uword AllocateOld(intptr_t size, HeapPage::PageType type); |
237 | 238 |
238 // GC stats collection. | 239 // GC stats collection. |
239 void RecordBeforeGC(Space space, GCReason reason); | 240 void RecordBeforeGC(Space space, GCReason reason); |
240 void RecordAfterGC(); | 241 void RecordAfterGC(); |
241 void PrintStats(); | 242 void PrintStats(); |
| 243 void UpdateObjectHistogram(); |
242 | 244 |
243 // The different spaces used for allocation. | 245 // The different spaces used for allocation. |
244 Scavenger* new_space_; | 246 Scavenger* new_space_; |
245 PageSpace* old_space_; | 247 PageSpace* old_space_; |
246 | 248 |
247 // GC stats collection. | 249 // GC stats collection. |
248 GCStats stats_; | 250 GCStats stats_; |
249 | 251 |
250 // This heap is in read-only mode: No allocation is allowed. | 252 // This heap is in read-only mode: No allocation is allowed. |
251 bool read_only_; | 253 bool read_only_; |
(...skipping 29 matching lines...) Expand all Loading... |
281 NoHeapGrowthControlScope(); | 283 NoHeapGrowthControlScope(); |
282 ~NoHeapGrowthControlScope(); | 284 ~NoHeapGrowthControlScope(); |
283 private: | 285 private: |
284 bool current_growth_controller_state_; | 286 bool current_growth_controller_state_; |
285 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); | 287 DISALLOW_COPY_AND_ASSIGN(NoHeapGrowthControlScope); |
286 }; | 288 }; |
287 | 289 |
288 } // namespace dart | 290 } // namespace dart |
289 | 291 |
290 #endif // VM_HEAP_H_ | 292 #endif // VM_HEAP_H_ |
OLD | NEW |