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/address_sanitizer.h" | 7 #include "platform/address_sanitizer.h" |
8 #include "platform/assert.h" | 8 #include "platform/assert.h" |
9 #include "vm/compiler_stats.h" | 9 #include "vm/compiler_stats.h" |
10 #include "vm/gc_marker.h" | 10 #include "vm/gc_marker.h" |
(...skipping 831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
842 } | 842 } |
843 } | 843 } |
844 } | 844 } |
845 | 845 |
846 | 846 |
847 void PageSpace::MarkSweep(bool invoke_api_callbacks) { | 847 void PageSpace::MarkSweep(bool invoke_api_callbacks) { |
848 Thread* thread = Thread::Current(); | 848 Thread* thread = Thread::Current(); |
849 Isolate* isolate = heap_->isolate(); | 849 Isolate* isolate = heap_->isolate(); |
850 ASSERT(isolate == Isolate::Current()); | 850 ASSERT(isolate == Isolate::Current()); |
851 | 851 |
| 852 const int64_t pre_safe_point = OS::GetCurrentMonotonicMicros(); |
| 853 |
852 // Wait for pending tasks to complete and then account for the driver task. | 854 // Wait for pending tasks to complete and then account for the driver task. |
853 { | 855 { |
854 MonitorLocker locker(tasks_lock()); | 856 MonitorLocker locker(tasks_lock()); |
855 while (tasks() > 0) { | 857 while (tasks() > 0) { |
856 locker.WaitWithSafepointCheck(thread); | 858 locker.WaitWithSafepointCheck(thread); |
857 } | 859 } |
858 set_tasks(1); | 860 set_tasks(1); |
859 } | 861 } |
860 // Ensure that all threads for this isolate are at a safepoint (either | 862 // Ensure that all threads for this isolate are at a safepoint (either |
861 // stopped or in native code). We have guards around Newgen GC and oldgen GC | 863 // stopped or in native code). We have guards around Newgen GC and oldgen GC |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
984 | 986 |
985 // Make code pages read-only. | 987 // Make code pages read-only. |
986 WriteProtectCode(true); | 988 WriteProtectCode(true); |
987 | 989 |
988 int64_t end = OS::GetCurrentMonotonicMicros(); | 990 int64_t end = OS::GetCurrentMonotonicMicros(); |
989 | 991 |
990 // Record signals for growth control. Include size of external allocations. | 992 // Record signals for growth control. Include size of external allocations. |
991 page_space_controller_.EvaluateGarbageCollection( | 993 page_space_controller_.EvaluateGarbageCollection( |
992 usage_before, GetCurrentUsage(), start, end); | 994 usage_before, GetCurrentUsage(), start, end); |
993 | 995 |
| 996 heap_->RecordTime(kSafePoint, start - pre_safe_point); |
994 heap_->RecordTime(kMarkObjects, mid1 - start); | 997 heap_->RecordTime(kMarkObjects, mid1 - start); |
995 heap_->RecordTime(kResetFreeLists, mid2 - mid1); | 998 heap_->RecordTime(kResetFreeLists, mid2 - mid1); |
996 heap_->RecordTime(kSweepPages, mid3 - mid2); | 999 heap_->RecordTime(kSweepPages, mid3 - mid2); |
997 heap_->RecordTime(kSweepLargePages, end - mid3); | 1000 heap_->RecordTime(kSweepLargePages, end - mid3); |
998 | 1001 |
999 if (FLAG_print_free_list_after_gc) { | 1002 if (FLAG_print_free_list_after_gc) { |
1000 OS::Print("Data Freelist (after GC):\n"); | 1003 OS::Print("Data Freelist (after GC):\n"); |
1001 freelist_[HeapPage::kData].Print(); | 1004 freelist_[HeapPage::kData].Print(); |
1002 OS::Print("Executable Freelist (after GC):\n"); | 1005 OS::Print("Executable Freelist (after GC):\n"); |
1003 freelist_[HeapPage::kExecutable].Print(); | 1006 freelist_[HeapPage::kExecutable].Print(); |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1295 return 0; | 1298 return 0; |
1296 } else { | 1299 } else { |
1297 ASSERT(total_time >= gc_time); | 1300 ASSERT(total_time >= gc_time); |
1298 int result = static_cast<int>( | 1301 int result = static_cast<int>( |
1299 (static_cast<double>(gc_time) / static_cast<double>(total_time)) * 100); | 1302 (static_cast<double>(gc_time) / static_cast<double>(total_time)) * 100); |
1300 return result; | 1303 return result; |
1301 } | 1304 } |
1302 } | 1305 } |
1303 | 1306 |
1304 } // namespace dart | 1307 } // namespace dart |
OLD | NEW |