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 #include "vm/heap.h" | 5 #include "vm/heap.h" |
6 | 6 |
7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
8 #include "platform/utils.h" | 8 #include "platform/utils.h" |
9 #include "vm/flags.h" | 9 #include "vm/flags.h" |
10 #include "vm/heap_histogram.h" | 10 #include "vm/heap_histogram.h" |
(...skipping 17 matching lines...) Expand all Loading... |
28 "Enables heap verification before GC."); | 28 "Enables heap verification before GC."); |
29 DEFINE_FLAG(bool, verify_after_gc, false, | 29 DEFINE_FLAG(bool, verify_after_gc, false, |
30 "Enables heap verification after GC."); | 30 "Enables heap verification after GC."); |
31 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation."); | 31 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation."); |
32 DEFINE_FLAG(int, new_gen_heap_size, 32, "new gen heap size in MB," | 32 DEFINE_FLAG(int, new_gen_heap_size, 32, "new gen heap size in MB," |
33 "e.g: --new_gen_heap_size=64 allocates a 64MB new gen heap"); | 33 "e.g: --new_gen_heap_size=64 allocates a 64MB new gen heap"); |
34 DEFINE_FLAG(int, old_gen_heap_size, Heap::kHeapSizeInMB, | 34 DEFINE_FLAG(int, old_gen_heap_size, Heap::kHeapSizeInMB, |
35 "old gen heap size in MB," | 35 "old gen heap size in MB," |
36 "e.g: --old_gen_heap_size=1024 allocates a 1024MB old gen heap"); | 36 "e.g: --old_gen_heap_size=1024 allocates a 1024MB old gen heap"); |
37 | 37 |
38 Heap::Heap() : read_only_(false), gc_in_progress_(false) { | 38 Heap::Heap() : read_only_(false), gc_in_progress_(false), |
| 39 object_id_ring_table_(NULL), object_id_ring_table_size_(0) { |
39 new_space_ = new Scavenger(this, | 40 new_space_ = new Scavenger(this, |
40 (FLAG_new_gen_heap_size * MB), | 41 (FLAG_new_gen_heap_size * MB), |
41 kNewObjectAlignmentOffset); | 42 kNewObjectAlignmentOffset); |
42 old_space_ = new PageSpace(this, (FLAG_old_gen_heap_size * MB)); | 43 old_space_ = new PageSpace(this, (FLAG_old_gen_heap_size * MB)); |
43 stats_.num_ = 0; | 44 stats_.num_ = 0; |
44 } | 45 } |
45 | 46 |
46 | 47 |
47 Heap::~Heap() { | 48 Heap::~Heap() { |
48 delete new_space_; | 49 delete new_space_; |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
497 heap->DisableGrowthControl(); | 498 heap->DisableGrowthControl(); |
498 } | 499 } |
499 | 500 |
500 | 501 |
501 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { | 502 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
502 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 503 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
503 heap->SetGrowthControlState(current_growth_controller_state_); | 504 heap->SetGrowthControlState(current_growth_controller_state_); |
504 } | 505 } |
505 | 506 |
506 } // namespace dart | 507 } // namespace dart |
OLD | NEW |