| 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 13 matching lines...) Expand all Loading... |
| 24 #include "vm/virtual_memory.h" | 24 #include "vm/virtual_memory.h" |
| 25 #include "vm/weak_table.h" | 25 #include "vm/weak_table.h" |
| 26 | 26 |
| 27 namespace dart { | 27 namespace dart { |
| 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 barrier_(new Monitor()), |
| 35 barrier_done_(new Monitor()), |
| 34 new_space_(this, max_new_gen_semi_words, kNewObjectAlignmentOffset), | 36 new_space_(this, max_new_gen_semi_words, kNewObjectAlignmentOffset), |
| 35 old_space_(this, max_old_gen_words, max_external_words), | 37 old_space_(this, max_old_gen_words, max_external_words), |
| 36 read_only_(false), | 38 read_only_(false), |
| 37 gc_new_space_in_progress_(false), | 39 gc_new_space_in_progress_(false), |
| 38 gc_old_space_in_progress_(false), | 40 gc_old_space_in_progress_(false), |
| 39 pretenure_policy_(0) { | 41 pretenure_policy_(0) { |
| 40 for (int sel = 0; | 42 for (int sel = 0; |
| 41 sel < kNumWeakSelectors; | 43 sel < kNumWeakSelectors; |
| 42 sel++) { | 44 sel++) { |
| 43 new_weak_tables_[sel] = new WeakTable(); | 45 new_weak_tables_[sel] = new WeakTable(); |
| 44 old_weak_tables_[sel] = new WeakTable(); | 46 old_weak_tables_[sel] = new WeakTable(); |
| 45 } | 47 } |
| 46 stats_.num_ = 0; | 48 stats_.num_ = 0; |
| 47 } | 49 } |
| 48 | 50 |
| 49 | 51 |
| 50 Heap::~Heap() { | 52 Heap::~Heap() { |
| 53 delete barrier_; |
| 54 delete barrier_done_; |
| 55 |
| 51 for (int sel = 0; | 56 for (int sel = 0; |
| 52 sel < kNumWeakSelectors; | 57 sel < kNumWeakSelectors; |
| 53 sel++) { | 58 sel++) { |
| 54 delete new_weak_tables_[sel]; | 59 delete new_weak_tables_[sel]; |
| 55 delete old_weak_tables_[sel]; | 60 delete old_weak_tables_[sel]; |
| 56 } | 61 } |
| 57 } | 62 } |
| 58 | 63 |
| 59 | 64 |
| 60 uword Heap::AllocateNew(intptr_t size) { | 65 uword Heap::AllocateNew(intptr_t size) { |
| (...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 831 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_); | 836 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_); |
| 832 } | 837 } |
| 833 | 838 |
| 834 | 839 |
| 835 WritableVMIsolateScope::~WritableVMIsolateScope() { | 840 WritableVMIsolateScope::~WritableVMIsolateScope() { |
| 836 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 841 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
| 837 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_); | 842 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_); |
| 838 } | 843 } |
| 839 | 844 |
| 840 } // namespace dart | 845 } // namespace dart |
| OLD | NEW |