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

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

Issue 631013002: Avoid verifying heap while sweeper is running. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 6 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « runtime/vm/pages.cc ('k') | no next file » | 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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/scavenger.h" 5 #include "vm/scavenger.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 790
791 791
792 void Scavenger::Scavenge(bool invoke_api_callbacks) { 792 void Scavenger::Scavenge(bool invoke_api_callbacks) {
793 // Scavenging is not reentrant. Make sure that is the case. 793 // Scavenging is not reentrant. Make sure that is the case.
794 ASSERT(!scavenging_); 794 ASSERT(!scavenging_);
795 scavenging_ = true; 795 scavenging_ = true;
796 Isolate* isolate = heap_->isolate(); 796 Isolate* isolate = heap_->isolate();
797 PageSpace* page_space = heap_->old_space(); 797 PageSpace* page_space = heap_->old_space();
798 NoHandleScope no_handles(isolate); 798 NoHandleScope no_handles(isolate);
799 799
800 if (FLAG_verify_before_gc) { 800 // TODO(koda): Make verification more compatible with concurrent sweep.
801 if (FLAG_verify_before_gc && !FLAG_concurrent_sweep) {
801 OS::PrintErr("Verifying before Scavenge..."); 802 OS::PrintErr("Verifying before Scavenge...");
802 // TODO(koda): Check whether sweeper is actually running. 803 heap_->Verify(kForbidMarked);
803 heap_->Verify(FLAG_concurrent_sweep ? kAllowMarked : kForbidMarked);
804 OS::PrintErr(" done.\n"); 804 OS::PrintErr(" done.\n");
805 } 805 }
806 806
807 // Prepare for a scavenge. 807 // Prepare for a scavenge.
808 SpaceUsage usage_before = GetCurrentUsage(); 808 SpaceUsage usage_before = GetCurrentUsage();
809 intptr_t promo_candidate_words = 809 intptr_t promo_candidate_words =
810 (survivor_end_ - FirstObjectStart()) / kWordSize; 810 (survivor_end_ - FirstObjectStart()) / kWordSize;
811 Prologue(isolate, invoke_api_callbacks); 811 Prologue(isolate, invoke_api_callbacks);
812 const bool prologue_weak_are_strong = !invoke_api_callbacks; 812 const bool prologue_weak_are_strong = !invoke_api_callbacks;
813 813
(...skipping 16 matching lines...) Expand all
830 // Scavenge finished. Run accounting and epilogue. 830 // Scavenge finished. Run accounting and epilogue.
831 int64_t end = OS::GetCurrentTimeMicros(); 831 int64_t end = OS::GetCurrentTimeMicros();
832 heap_->RecordTime(kProcessToSpace, middle - start); 832 heap_->RecordTime(kProcessToSpace, middle - start);
833 heap_->RecordTime(kIterateWeaks, end - middle); 833 heap_->RecordTime(kIterateWeaks, end - middle);
834 stats_history_.Add(ScavengeStats(start, end, 834 stats_history_.Add(ScavengeStats(start, end,
835 usage_before, GetCurrentUsage(), 835 usage_before, GetCurrentUsage(),
836 promo_candidate_words, 836 promo_candidate_words,
837 visitor.bytes_promoted() >> kWordSizeLog2)); 837 visitor.bytes_promoted() >> kWordSizeLog2));
838 Epilogue(isolate, &visitor, invoke_api_callbacks); 838 Epilogue(isolate, &visitor, invoke_api_callbacks);
839 839
840 if (FLAG_verify_after_gc) { 840 // TODO(koda): Make verification more compatible with concurrent sweep.
841 if (FLAG_verify_after_gc && !FLAG_concurrent_sweep) {
841 OS::PrintErr("Verifying after Scavenge..."); 842 OS::PrintErr("Verifying after Scavenge...");
842 // TODO(koda): Check whether sweeper is actually running. 843 heap_->Verify(kForbidMarked);
843 heap_->Verify(FLAG_concurrent_sweep ? kAllowMarked : kForbidMarked);
844 OS::PrintErr(" done.\n"); 844 OS::PrintErr(" done.\n");
845 } 845 }
846 846
847 // Done scavenging. Reset the marker. 847 // Done scavenging. Reset the marker.
848 ASSERT(scavenging_); 848 ASSERT(scavenging_);
849 scavenging_ = false; 849 scavenging_ = false;
850 } 850 }
851 851
852 852
853 void Scavenger::WriteProtect(bool read_only) { 853 void Scavenger::WriteProtect(bool read_only) {
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
890 } 890 }
891 891
892 892
893 void Scavenger::FreeExternal(intptr_t size) { 893 void Scavenger::FreeExternal(intptr_t size) {
894 ASSERT(size >= 0); 894 ASSERT(size >= 0);
895 external_size_ -= size; 895 external_size_ -= size;
896 ASSERT(external_size_ >= 0); 896 ASSERT(external_size_ >= 0);
897 } 897 }
898 898
899 } // namespace dart 899 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/pages.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698