| 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/isolate.h" | 10 #include "vm/isolate.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 Heap::Heap(Isolate* isolate, | 29 Heap::Heap(Isolate* isolate, |
| 30 intptr_t max_new_gen_semi_words, | 30 intptr_t max_new_gen_semi_words, |
| 31 intptr_t max_old_gen_words, | 31 intptr_t max_old_gen_words, |
| 32 intptr_t max_external_words) | 32 intptr_t max_external_words) |
| 33 : isolate_(isolate), | 33 : isolate_(isolate), |
| 34 new_space_(this, max_new_gen_semi_words, kNewObjectAlignmentOffset), | 34 new_space_(this, max_new_gen_semi_words, kNewObjectAlignmentOffset), |
| 35 old_space_(this, max_old_gen_words, max_external_words), | 35 old_space_(this, max_old_gen_words, max_external_words), |
| 36 barrier_(new Monitor()), | 36 barrier_(new Monitor()), |
| 37 barrier_done_(new Monitor()), | 37 barrier_done_(new Monitor()), |
| 38 finalization_tasks_lock_(new Monitor()), | |
| 39 finalization_tasks_(0), | |
| 40 read_only_(false), | 38 read_only_(false), |
| 41 gc_new_space_in_progress_(false), | 39 gc_new_space_in_progress_(false), |
| 42 gc_old_space_in_progress_(false) { | 40 gc_old_space_in_progress_(false) { |
| 43 for (int sel = 0; | 41 for (int sel = 0; |
| 44 sel < kNumWeakSelectors; | 42 sel < kNumWeakSelectors; |
| 45 sel++) { | 43 sel++) { |
| 46 new_weak_tables_[sel] = new WeakTable(); | 44 new_weak_tables_[sel] = new WeakTable(); |
| 47 old_weak_tables_[sel] = new WeakTable(); | 45 old_weak_tables_[sel] = new WeakTable(); |
| 48 } | 46 } |
| 49 stats_.num_ = 0; | 47 stats_.num_ = 0; |
| 50 } | 48 } |
| 51 | 49 |
| 52 | 50 |
| 53 Heap::~Heap() { | 51 Heap::~Heap() { |
| 54 delete barrier_; | 52 delete barrier_; |
| 55 delete barrier_done_; | 53 delete barrier_done_; |
| 56 delete finalization_tasks_lock_; | |
| 57 | 54 |
| 58 for (int sel = 0; | 55 for (int sel = 0; |
| 59 sel < kNumWeakSelectors; | 56 sel < kNumWeakSelectors; |
| 60 sel++) { | 57 sel++) { |
| 61 delete new_weak_tables_[sel]; | 58 delete new_weak_tables_[sel]; |
| 62 delete old_weak_tables_[sel]; | 59 delete old_weak_tables_[sel]; |
| 63 } | 60 } |
| 64 } | 61 } |
| 65 | 62 |
| 66 | 63 |
| (...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 874 Dart::vm_isolate()->heap()->WriteProtect(false); | 871 Dart::vm_isolate()->heap()->WriteProtect(false); |
| 875 } | 872 } |
| 876 | 873 |
| 877 | 874 |
| 878 WritableVMIsolateScope::~WritableVMIsolateScope() { | 875 WritableVMIsolateScope::~WritableVMIsolateScope() { |
| 879 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 876 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
| 880 Dart::vm_isolate()->heap()->WriteProtect(true); | 877 Dart::vm_isolate()->heap()->WriteProtect(true); |
| 881 } | 878 } |
| 882 | 879 |
| 883 } // namespace dart | 880 } // namespace dart |
| OLD | NEW |