Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(215)

Side by Side Diff: runtime/vm/pages.cc

Issue 1212943010: Safer interface for heap iteration. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix release mode. Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/pages.h ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 pages_tail_(NULL), 153 pages_tail_(NULL),
154 exec_pages_(NULL), 154 exec_pages_(NULL),
155 exec_pages_tail_(NULL), 155 exec_pages_tail_(NULL),
156 large_pages_(NULL), 156 large_pages_(NULL),
157 bump_top_(0), 157 bump_top_(0),
158 bump_end_(0), 158 bump_end_(0),
159 max_capacity_in_words_(max_capacity_in_words), 159 max_capacity_in_words_(max_capacity_in_words),
160 max_external_in_words_(max_external_in_words), 160 max_external_in_words_(max_external_in_words),
161 tasks_lock_(new Monitor()), 161 tasks_lock_(new Monitor()),
162 tasks_(0), 162 tasks_(0),
163 #if defined(DEBUG)
164 is_iterating_(false),
165 #endif
163 page_space_controller_(heap, 166 page_space_controller_(heap,
164 FLAG_old_gen_growth_space_ratio, 167 FLAG_old_gen_growth_space_ratio,
165 FLAG_old_gen_growth_rate, 168 FLAG_old_gen_growth_rate,
166 FLAG_old_gen_growth_time_ratio), 169 FLAG_old_gen_growth_time_ratio),
167 gc_time_micros_(0), 170 gc_time_micros_(0),
168 collections_(0) { 171 collections_(0) {
169 } 172 }
170 173
171 174
172 PageSpace::~PageSpace() { 175 PageSpace::~PageSpace() {
(...skipping 598 matching lines...) Expand 10 before | Expand all | Expand 10 after
771 774
772 if (FLAG_print_free_list_before_gc) { 775 if (FLAG_print_free_list_before_gc) {
773 OS::Print("Data Freelist (before GC):\n"); 776 OS::Print("Data Freelist (before GC):\n");
774 freelist_[HeapPage::kData].Print(); 777 freelist_[HeapPage::kData].Print();
775 OS::Print("Executable Freelist (before GC):\n"); 778 OS::Print("Executable Freelist (before GC):\n");
776 freelist_[HeapPage::kExecutable].Print(); 779 freelist_[HeapPage::kExecutable].Print();
777 } 780 }
778 781
779 if (FLAG_verify_before_gc) { 782 if (FLAG_verify_before_gc) {
780 OS::PrintErr("Verifying before marking..."); 783 OS::PrintErr("Verifying before marking...");
781 heap_->Verify(); 784 heap_->VerifyGC();
782 OS::PrintErr(" done.\n"); 785 OS::PrintErr(" done.\n");
783 } 786 }
784 787
785 const int64_t start = OS::GetCurrentTimeMicros(); 788 const int64_t start = OS::GetCurrentTimeMicros();
786 789
787 // Make code pages writable. 790 // Make code pages writable.
788 WriteProtectCode(false); 791 WriteProtectCode(false);
789 792
790 // Save old value before GCMarker visits the weak persistent handles. 793 // Save old value before GCMarker visits the weak persistent handles.
791 SpaceUsage usage_before = GetCurrentUsage(); 794 SpaceUsage usage_before = GetCurrentUsage();
(...skipping 11 matching lines...) Expand all
803 // Reset the freelists and setup sweeping. 806 // Reset the freelists and setup sweeping.
804 freelist_[HeapPage::kData].Reset(); 807 freelist_[HeapPage::kData].Reset();
805 freelist_[HeapPage::kExecutable].Reset(); 808 freelist_[HeapPage::kExecutable].Reset();
806 809
807 int64_t mid2 = OS::GetCurrentTimeMicros(); 810 int64_t mid2 = OS::GetCurrentTimeMicros();
808 int64_t mid3 = 0; 811 int64_t mid3 = 0;
809 812
810 { 813 {
811 if (FLAG_verify_before_gc) { 814 if (FLAG_verify_before_gc) {
812 OS::PrintErr("Verifying before sweeping..."); 815 OS::PrintErr("Verifying before sweeping...");
813 heap_->Verify(kAllowMarked); 816 heap_->VerifyGC(kAllowMarked);
814 OS::PrintErr(" done.\n"); 817 OS::PrintErr(" done.\n");
815 } 818 }
816 GCSweeper sweeper; 819 GCSweeper sweeper;
817 820
818 // During stop-the-world phases we should use bulk lock when adding elements 821 // During stop-the-world phases we should use bulk lock when adding elements
819 // to the free list. 822 // to the free list.
820 MutexLocker mld(freelist_[HeapPage::kData].mutex()); 823 MutexLocker mld(freelist_[HeapPage::kData].mutex());
821 MutexLocker mle(freelist_[HeapPage::kExecutable].mutex()); 824 MutexLocker mle(freelist_[HeapPage::kExecutable].mutex());
822 825
823 // Large and executable pages are always swept immediately. 826 // Large and executable pages are always swept immediately.
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
864 if (page_in_use) { 867 if (page_in_use) {
865 prev_page = page; 868 prev_page = page;
866 } else { 869 } else {
867 FreePage(page, prev_page); 870 FreePage(page, prev_page);
868 } 871 }
869 // Advance to the next page. 872 // Advance to the next page.
870 page = next_page; 873 page = next_page;
871 } 874 }
872 if (FLAG_verify_after_gc) { 875 if (FLAG_verify_after_gc) {
873 OS::PrintErr("Verifying after sweeping..."); 876 OS::PrintErr("Verifying after sweeping...");
874 heap_->Verify(kForbidMarked); 877 heap_->VerifyGC(kForbidMarked);
875 OS::PrintErr(" done.\n"); 878 OS::PrintErr(" done.\n");
876 } 879 }
877 } else { 880 } else {
878 // Start the concurrent sweeper task now. 881 // Start the concurrent sweeper task now.
879 GCSweeper::SweepConcurrent( 882 GCSweeper::SweepConcurrent(
880 isolate, pages_, pages_tail_, &freelist_[HeapPage::kData]); 883 isolate, pages_, pages_tail_, &freelist_[HeapPage::kData]);
881 } 884 }
882 } 885 }
883 886
884 // Make code pages read-only. 887 // Make code pages read-only.
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
1134 return 0; 1137 return 0;
1135 } else { 1138 } else {
1136 ASSERT(total_time >= gc_time); 1139 ASSERT(total_time >= gc_time);
1137 int result = static_cast<int>((static_cast<double>(gc_time) / 1140 int result = static_cast<int>((static_cast<double>(gc_time) /
1138 static_cast<double>(total_time)) * 100); 1141 static_cast<double>(total_time)) * 100);
1139 return result; 1142 return result;
1140 } 1143 }
1141 } 1144 }
1142 1145
1143 } // namespace dart 1146 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/pages.h ('k') | runtime/vm/snapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698