Chromium Code Reviews| 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/lockers.h" | 11 #include "vm/lockers.h" |
| 12 #include "vm/object.h" | 12 #include "vm/object.h" |
| 13 #include "vm/os_thread.h" | 13 #include "vm/os_thread.h" |
| 14 #include "vm/thread_registry.h" | |
| 14 #include "vm/verified_memory.h" | 15 #include "vm/verified_memory.h" |
| 15 #include "vm/virtual_memory.h" | 16 #include "vm/virtual_memory.h" |
| 16 | 17 |
| 17 namespace dart { | 18 namespace dart { |
| 18 | 19 |
| 19 DEFINE_FLAG(int, heap_growth_rate, 0, | 20 DEFINE_FLAG(int, heap_growth_rate, 0, |
| 20 "The max number of pages the heap can grow at a time"); | 21 "The max number of pages the heap can grow at a time"); |
| 21 DEFINE_FLAG(int, old_gen_growth_space_ratio, 20, | 22 DEFINE_FLAG(int, old_gen_growth_space_ratio, 20, |
| 22 "The desired maximum percentage of free space after old gen GC"); | 23 "The desired maximum percentage of free space after old gen GC"); |
| 23 DEFINE_FLAG(int, old_gen_growth_time_ratio, 3, | 24 DEFINE_FLAG(int, old_gen_growth_time_ratio, 3, |
| (...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 761 | 762 |
| 762 // Wait for pending tasks to complete and then account for the driver task. | 763 // Wait for pending tasks to complete and then account for the driver task. |
| 763 { | 764 { |
| 764 MonitorLocker locker(tasks_lock()); | 765 MonitorLocker locker(tasks_lock()); |
| 765 while (tasks() > 0) { | 766 while (tasks() > 0) { |
| 766 locker.Wait(); | 767 locker.Wait(); |
| 767 } | 768 } |
| 768 set_tasks(1); | 769 set_tasks(1); |
| 769 } | 770 } |
| 770 | 771 |
| 772 isolate->thread_registry()->SafepointThreads(); | |
|
Ivan Posva
2015/08/25 23:27:15
// Ensure that all threads for this isolate are at
koda
2015/08/26 01:09:14
Done.
| |
| 773 | |
| 771 // Perform various cleanup that relies on no tasks interfering. | 774 // Perform various cleanup that relies on no tasks interfering. |
| 772 isolate->class_table()->FreeOldTables(); | 775 isolate->class_table()->FreeOldTables(); |
| 773 | 776 |
| 774 NoSafepointScope no_safepoints; | 777 NoSafepointScope no_safepoints; |
| 775 | 778 |
| 776 if (FLAG_print_free_list_before_gc) { | 779 if (FLAG_print_free_list_before_gc) { |
| 777 OS::Print("Data Freelist (before GC):\n"); | 780 OS::Print("Data Freelist (before GC):\n"); |
| 778 freelist_[HeapPage::kData].Print(); | 781 freelist_[HeapPage::kData].Print(); |
| 779 OS::Print("Executable Freelist (before GC):\n"); | 782 OS::Print("Executable Freelist (before GC):\n"); |
| 780 freelist_[HeapPage::kExecutable].Print(); | 783 freelist_[HeapPage::kExecutable].Print(); |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 900 heap_->RecordTime(kSweepPages, mid3 - mid2); | 903 heap_->RecordTime(kSweepPages, mid3 - mid2); |
| 901 heap_->RecordTime(kSweepLargePages, end - mid3); | 904 heap_->RecordTime(kSweepLargePages, end - mid3); |
| 902 | 905 |
| 903 if (FLAG_print_free_list_after_gc) { | 906 if (FLAG_print_free_list_after_gc) { |
| 904 OS::Print("Data Freelist (after GC):\n"); | 907 OS::Print("Data Freelist (after GC):\n"); |
| 905 freelist_[HeapPage::kData].Print(); | 908 freelist_[HeapPage::kData].Print(); |
| 906 OS::Print("Executable Freelist (after GC):\n"); | 909 OS::Print("Executable Freelist (after GC):\n"); |
| 907 freelist_[HeapPage::kExecutable].Print(); | 910 freelist_[HeapPage::kExecutable].Print(); |
| 908 } | 911 } |
| 909 | 912 |
| 913 isolate->thread_registry()->ResumeAllThreads(); | |
| 914 | |
| 910 // Done, reset the task count. | 915 // Done, reset the task count. |
| 911 { | 916 { |
| 912 MonitorLocker ml(tasks_lock()); | 917 MonitorLocker ml(tasks_lock()); |
| 913 set_tasks(tasks() - 1); | 918 set_tasks(tasks() - 1); |
| 914 ml.Notify(); | 919 ml.Notify(); |
| 915 } | 920 } |
| 916 } | 921 } |
| 917 | 922 |
| 918 | 923 |
| 919 uword PageSpace::TryAllocateDataBumpInternal(intptr_t size, | 924 uword PageSpace::TryAllocateDataBumpInternal(intptr_t size, |
| (...skipping 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1138 return 0; | 1143 return 0; |
| 1139 } else { | 1144 } else { |
| 1140 ASSERT(total_time >= gc_time); | 1145 ASSERT(total_time >= gc_time); |
| 1141 int result = static_cast<int>((static_cast<double>(gc_time) / | 1146 int result = static_cast<int>((static_cast<double>(gc_time) / |
| 1142 static_cast<double>(total_time)) * 100); | 1147 static_cast<double>(total_time)) * 100); |
| 1143 return result; | 1148 return result; |
| 1144 } | 1149 } |
| 1145 } | 1150 } |
| 1146 | 1151 |
| 1147 } // namespace dart | 1152 } // namespace dart |
| OLD | NEW |