| 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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 page = large_pages_; | 812 page = large_pages_; |
| 813 while (page != NULL) { | 813 while (page != NULL) { |
| 814 if (page->type() == HeapPage::kExecutable && !page->is_image_page()) { | 814 if (page->type() == HeapPage::kExecutable && !page->is_image_page()) { |
| 815 page->WriteProtect(read_only); | 815 page->WriteProtect(read_only); |
| 816 } | 816 } |
| 817 page = page->next(); | 817 page = page->next(); |
| 818 } | 818 } |
| 819 } | 819 } |
| 820 } | 820 } |
| 821 | 821 |
| 822 void PageSpace::MarkSweep(bool invoke_api_callbacks) { | 822 void PageSpace::MarkSweep() { |
| 823 Thread* thread = Thread::Current(); | 823 Thread* thread = Thread::Current(); |
| 824 Isolate* isolate = heap_->isolate(); | 824 Isolate* isolate = heap_->isolate(); |
| 825 ASSERT(isolate == Isolate::Current()); | 825 ASSERT(isolate == Isolate::Current()); |
| 826 | 826 |
| 827 const int64_t pre_wait_for_sweepers = OS::GetCurrentMonotonicMicros(); | 827 const int64_t pre_wait_for_sweepers = OS::GetCurrentMonotonicMicros(); |
| 828 | 828 |
| 829 // Wait for pending tasks to complete and then account for the driver task. | 829 // Wait for pending tasks to complete and then account for the driver task. |
| 830 { | 830 { |
| 831 MonitorLocker locker(tasks_lock()); | 831 MonitorLocker locker(tasks_lock()); |
| 832 while (tasks() > 0) { | 832 while (tasks() > 0) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 871 SpaceUsage usage_before = GetCurrentUsage(); | 871 SpaceUsage usage_before = GetCurrentUsage(); |
| 872 | 872 |
| 873 // Mark all reachable old-gen objects. | 873 // Mark all reachable old-gen objects. |
| 874 #if defined(PRODUCT) | 874 #if defined(PRODUCT) |
| 875 bool collect_code = FLAG_collect_code && ShouldCollectCode(); | 875 bool collect_code = FLAG_collect_code && ShouldCollectCode(); |
| 876 #else | 876 #else |
| 877 bool collect_code = FLAG_collect_code && ShouldCollectCode() && | 877 bool collect_code = FLAG_collect_code && ShouldCollectCode() && |
| 878 !isolate->HasAttemptedReload(); | 878 !isolate->HasAttemptedReload(); |
| 879 #endif // !defined(PRODUCT) | 879 #endif // !defined(PRODUCT) |
| 880 GCMarker marker(heap_); | 880 GCMarker marker(heap_); |
| 881 marker.MarkObjects(isolate, this, invoke_api_callbacks, collect_code); | 881 marker.MarkObjects(isolate, this, collect_code); |
| 882 usage_.used_in_words = marker.marked_words(); | 882 usage_.used_in_words = marker.marked_words(); |
| 883 | 883 |
| 884 int64_t mid1 = OS::GetCurrentMonotonicMicros(); | 884 int64_t mid1 = OS::GetCurrentMonotonicMicros(); |
| 885 | 885 |
| 886 // Abandon the remainder of the bump allocation block. | 886 // Abandon the remainder of the bump allocation block. |
| 887 AbandonBumpAllocation(); | 887 AbandonBumpAllocation(); |
| 888 // Reset the freelists and setup sweeping. | 888 // Reset the freelists and setup sweeping. |
| 889 freelist_[HeapPage::kData].Reset(); | 889 freelist_[HeapPage::kData].Reset(); |
| 890 freelist_[HeapPage::kExecutable].Reset(); | 890 freelist_[HeapPage::kExecutable].Reset(); |
| 891 | 891 |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1276 return 0; | 1276 return 0; |
| 1277 } else { | 1277 } else { |
| 1278 ASSERT(total_time >= gc_time); | 1278 ASSERT(total_time >= gc_time); |
| 1279 int result = static_cast<int>( | 1279 int result = static_cast<int>( |
| 1280 (static_cast<double>(gc_time) / static_cast<double>(total_time)) * 100); | 1280 (static_cast<double>(gc_time) / static_cast<double>(total_time)) * 100); |
| 1281 return result; | 1281 return result; |
| 1282 } | 1282 } |
| 1283 } | 1283 } |
| 1284 | 1284 |
| 1285 } // namespace dart | 1285 } // namespace dart |
| OLD | NEW |