| 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" |
| 11 #include "vm/lockers.h" | 11 #include "vm/lockers.h" |
| 12 #include "vm/object.h" | 12 #include "vm/object.h" |
| 13 #include "vm/object_set.h" | 13 #include "vm/object_set.h" |
| 14 #include "vm/os.h" | 14 #include "vm/os.h" |
| 15 #include "vm/pages.h" | 15 #include "vm/pages.h" |
| 16 #include "vm/raw_object.h" | 16 #include "vm/raw_object.h" |
| 17 #include "vm/scavenger.h" | 17 #include "vm/scavenger.h" |
| 18 #include "vm/service.h" | 18 #include "vm/service.h" |
| 19 #include "vm/service_event.h" | 19 #include "vm/service_event.h" |
| 20 #include "vm/stack_frame.h" | 20 #include "vm/stack_frame.h" |
| 21 #include "vm/tags.h" | 21 #include "vm/tags.h" |
| 22 #include "vm/timeline.h" | 22 #include "vm/timeline.h" |
| 23 #include "vm/verifier.h" | 23 #include "vm/verifier.h" |
| 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 DEFINE_FLAG(bool, disable_alloc_stubs_after_gc, false, "Stress testing flag."); | |
| 30 DEFINE_FLAG(bool, gc_at_alloc, false, "GC at every allocation."); | |
| 31 DEFINE_FLAG(int, new_gen_ext_limit, 64, | |
| 32 "maximum total external size (MB) in new gen before triggering GC"); | |
| 33 DEFINE_FLAG(int, pretenure_interval, 10, | |
| 34 "Back off pretenuring after this many cycles."); | |
| 35 DEFINE_FLAG(int, pretenure_threshold, 98, | |
| 36 "Trigger pretenuring when this many percent are promoted."); | |
| 37 DEFINE_FLAG(int, verbose_gc_hdr, 40, "Print verbose GC header interval."); | |
| 38 DEFINE_FLAG(bool, verify_after_gc, false, | |
| 39 "Enables heap verification after GC."); | |
| 40 DEFINE_FLAG(bool, verify_before_gc, false, | |
| 41 "Enables heap verification before GC."); | |
| 42 | |
| 43 | |
| 44 Heap::Heap(Isolate* isolate, | 29 Heap::Heap(Isolate* isolate, |
| 45 intptr_t max_new_gen_semi_words, | 30 intptr_t max_new_gen_semi_words, |
| 46 intptr_t max_old_gen_words, | 31 intptr_t max_old_gen_words, |
| 47 intptr_t max_external_words) | 32 intptr_t max_external_words) |
| 48 : isolate_(isolate), | 33 : isolate_(isolate), |
| 49 new_space_(this, max_new_gen_semi_words, kNewObjectAlignmentOffset), | 34 new_space_(this, max_new_gen_semi_words, kNewObjectAlignmentOffset), |
| 50 old_space_(this, max_old_gen_words, max_external_words), | 35 old_space_(this, max_old_gen_words, max_external_words), |
| 51 read_only_(false), | 36 read_only_(false), |
| 52 gc_new_space_in_progress_(false), | 37 gc_new_space_in_progress_(false), |
| 53 gc_old_space_in_progress_(false), | 38 gc_old_space_in_progress_(false), |
| (...skipping 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 842 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_); | 827 Dart::vm_isolate()->heap()->WriteProtect(false, include_code_pages_); |
| 843 } | 828 } |
| 844 | 829 |
| 845 | 830 |
| 846 WritableVMIsolateScope::~WritableVMIsolateScope() { | 831 WritableVMIsolateScope::~WritableVMIsolateScope() { |
| 847 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); | 832 ASSERT(Dart::vm_isolate()->heap()->UsedInWords(Heap::kNew) == 0); |
| 848 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_); | 833 Dart::vm_isolate()->heap()->WriteProtect(true, include_code_pages_); |
| 849 } | 834 } |
| 850 | 835 |
| 851 } // namespace dart | 836 } // namespace dart |
| OLD | NEW |