| 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 19 matching lines...) Expand all Loading... |
| 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 for (WeakSelector sel = static_cast<WeakSelector>(0); | 40 for (int sel = 0; |
| 41 sel < kNumWeakSelectors; | 41 sel < kNumWeakSelectors; |
| 42 sel++) { | 42 sel++) { |
| 43 new_weak_tables_[sel] = new WeakTable(0); | 43 new_weak_tables_[sel] = new WeakTable(0); |
| 44 old_weak_tables_[sel] = new WeakTable(0); | 44 old_weak_tables_[sel] = new WeakTable(0); |
| 45 } | 45 } |
| 46 new_space_ = new Scavenger(this, | 46 new_space_ = new Scavenger(this, |
| 47 (FLAG_new_gen_heap_size * MB), | 47 (FLAG_new_gen_heap_size * MB), |
| 48 kNewObjectAlignmentOffset); | 48 kNewObjectAlignmentOffset); |
| 49 old_space_ = new PageSpace(this, (FLAG_old_gen_heap_size * MB)); | 49 old_space_ = new PageSpace(this, (FLAG_old_gen_heap_size * MB)); |
| 50 stats_.num_ = 0; | 50 stats_.num_ = 0; |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 510 heap->DisableGrowthControl(); | 510 heap->DisableGrowthControl(); |
| 511 } | 511 } |
| 512 | 512 |
| 513 | 513 |
| 514 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { | 514 NoHeapGrowthControlScope::~NoHeapGrowthControlScope() { |
| 515 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); | 515 Heap* heap = reinterpret_cast<Isolate*>(isolate())->heap(); |
| 516 heap->SetGrowthControlState(current_growth_controller_state_); | 516 heap->SetGrowthControlState(current_growth_controller_state_); |
| 517 } | 517 } |
| 518 | 518 |
| 519 } // namespace dart | 519 } // namespace dart |
| OLD | NEW |