| 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 18 matching lines...) Expand all Loading... |
| 29 "Enables heap verification before GC."); | 29 "Enables heap verification before GC."); |
| 30 DEFINE_FLAG(bool, verify_after_gc, false, | 30 DEFINE_FLAG(bool, verify_after_gc, false, |
| 31 "Enables heap verification after GC."); | 31 "Enables heap verification after GC."); |
| 32 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation."); | 32 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation."); |
| 33 DEFINE_FLAG(int, new_gen_heap_size, 32, "new gen heap size in MB," | 33 DEFINE_FLAG(int, new_gen_heap_size, 32, "new gen heap size in MB," |
| 34 "e.g: --new_gen_heap_size=64 allocates a 64MB new gen heap"); | 34 "e.g: --new_gen_heap_size=64 allocates a 64MB new gen heap"); |
| 35 DEFINE_FLAG(int, old_gen_heap_size, Heap::kHeapSizeInMB, | 35 DEFINE_FLAG(int, old_gen_heap_size, Heap::kHeapSizeInMB, |
| 36 "old gen heap size in MB," | 36 "old gen heap size in MB," |
| 37 "e.g: --old_gen_heap_size=1024 allocates a 1024MB old gen heap"); | 37 "e.g: --old_gen_heap_size=1024 allocates a 1024MB old gen heap"); |
| 38 | 38 |
| 39 Heap::Heap() : read_only_(false), gc_in_progress_(false) { | 39 Heap::Heap() : read_only_(false), gc_in_progress_(false), |
| 40 object_id_ring_table_(NULL), object_id_ring_table_size_(0) { |
| 40 for (int sel = 0; | 41 for (int sel = 0; |
| 41 sel < kNumWeakSelectors; | 42 sel < kNumWeakSelectors; |
| 42 sel++) { | 43 sel++) { |
| 43 new_weak_tables_[sel] = new WeakTable(); | 44 new_weak_tables_[sel] = new WeakTable(); |
| 44 old_weak_tables_[sel] = new WeakTable(); | 45 old_weak_tables_[sel] = new WeakTable(); |
| 45 } | 46 } |
| 46 new_space_ = new Scavenger(this, | 47 new_space_ = new Scavenger(this, |
| 47 (FLAG_new_gen_heap_size * MB), | 48 (FLAG_new_gen_heap_size * MB), |
| 48 kNewObjectAlignmentOffset); | 49 kNewObjectAlignmentOffset); |
| 49 old_space_ = new PageSpace(this, (FLAG_old_gen_heap_size * MB)); | 50 old_space_ = new PageSpace(this, (FLAG_old_gen_heap_size * MB)); |
| (...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 heap->DisableGrowthControl(); | 517 heap->DisableGrowthControl(); |
| 517 } | 518 } |
| 518 | 519 |
| 519 | 520 |
| 520 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { | 521 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
| 521 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 522 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
| 522 heap->SetGrowthControlState(current_growth_controller_state_); | 523 heap->SetGrowthControlState(current_growth_controller_state_); |
| 523 } | 524 } |
| 524 | 525 |
| 525 } // namespace dart | 526 } // namespace dart |
| OLD | NEW |