| 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/pages.h" | 5 #include "vm/pages.h" |
| 6 | 6 |
| 7 #include "platform/assert.h" | 7 #include "platform/assert.h" |
| 8 #include "vm/compiler_stats.h" | 8 #include "vm/compiler_stats.h" |
| 9 #include "vm/gc_marker.h" | 9 #include "vm/gc_marker.h" |
| 10 #include "vm/gc_sweeper.h" | 10 #include "vm/gc_sweeper.h" |
| 11 #include "vm/object.h" | 11 #include "vm/object.h" |
| 12 #include "vm/virtual_memory.h" | 12 #include "vm/virtual_memory.h" |
| 13 | 13 |
| 14 namespace dart { | 14 namespace dart { |
| 15 | 15 |
| 16 DEFINE_FLAG(int, heap_growth_space_ratio, 10, | 16 DEFINE_FLAG(int, heap_growth_space_ratio, 10, |
| 17 "The desired maximum percentage of free space after GC"); | 17 "The desired maximum percentage of free space after GC"); |
| 18 DEFINE_FLAG(int, heap_growth_time_ratio, 3, | 18 DEFINE_FLAG(int, heap_growth_time_ratio, 3, |
| 19 "The desired maximum percentage of time spent in GC"); | 19 "The desired maximum percentage of time spent in GC"); |
| 20 DEFINE_FLAG(int, heap_growth_rate, 4, | 20 DEFINE_FLAG(int, heap_growth_rate, 4, |
| 21 "The size the heap is grown, in heap pages"); | 21 "The size the heap is grown, in heap pages"); |
| 22 DEFINE_FLAG(bool, print_free_list_before_gc, false, | 22 DEFINE_FLAG(bool, print_free_list_before_gc, false, |
| 23 "Print free list statistics before a GC"); | 23 "Print free list statistics before a GC"); |
| 24 DEFINE_FLAG(bool, print_free_list_after_gc, false, | 24 DEFINE_FLAG(bool, print_free_list_after_gc, false, |
| 25 "Print free list statistics after a GC"); | 25 "Print free list statistics after a GC"); |
| 26 DEFINE_FLAG(bool, collect_code, true, | 26 DEFINE_FLAG(bool, collect_code, false, |
| 27 "Attempt to GC infrequently used code."); | 27 "Attempt to GC infrequently used code."); |
| 28 DEFINE_FLAG(int, code_collection_interval_in_us, 30000000, | 28 DEFINE_FLAG(int, code_collection_interval_in_us, 30000000, |
| 29 "Time between attempts to collect unused code."); | 29 "Time between attempts to collect unused code."); |
| 30 DEFINE_FLAG(bool, log_code_drop, false, | 30 DEFINE_FLAG(bool, log_code_drop, false, |
| 31 "Emit a log message when pointers to unused code are dropped."); | 31 "Emit a log message when pointers to unused code are dropped."); |
| 32 | 32 |
| 33 HeapPage* HeapPage::Initialize(VirtualMemory* memory, PageType type) { | 33 HeapPage* HeapPage::Initialize(VirtualMemory* memory, PageType type) { |
| 34 ASSERT(memory->size() > VirtualMemory::PageSize()); | 34 ASSERT(memory->size() > VirtualMemory::PageSize()); |
| 35 bool is_executable = (type == kExecutable); | 35 bool is_executable = (type == kExecutable); |
| 36 memory->Commit(is_executable); | 36 memory->Commit(is_executable); |
| (...skipping 618 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 655 return 0; | 655 return 0; |
| 656 } else { | 656 } else { |
| 657 ASSERT(total_time >= gc_time); | 657 ASSERT(total_time >= gc_time); |
| 658 int result= static_cast<int>((static_cast<double>(gc_time) / | 658 int result= static_cast<int>((static_cast<double>(gc_time) / |
| 659 static_cast<double>(total_time)) * 100); | 659 static_cast<double>(total_time)) * 100); |
| 660 return result; | 660 return result; |
| 661 } | 661 } |
| 662 } | 662 } |
| 663 | 663 |
| 664 } // namespace dart | 664 } // namespace dart |
| OLD | NEW |