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

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

Issue 630933002: Check mark bit when verifying heap. (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') | runtime/vm/verifier.h » ('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) 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 10 matching lines...) Expand all
21 #include "vm/weak_table.h" 21 #include "vm/weak_table.h"
22 22
23 namespace dart { 23 namespace dart {
24 24
25 DEFINE_FLAG(int, early_tenuring_threshold, 66, 25 DEFINE_FLAG(int, early_tenuring_threshold, 66,
26 "When more than this percentage of promotion candidates survive, " 26 "When more than this percentage of promotion candidates survive, "
27 "promote all survivors of next scavenge."); 27 "promote all survivors of next scavenge.");
28 DEFINE_FLAG(int, new_gen_garbage_threshold, 90, 28 DEFINE_FLAG(int, new_gen_garbage_threshold, 90,
29 "Grow new gen when less than this percentage is garbage."); 29 "Grow new gen when less than this percentage is garbage.");
30 DEFINE_FLAG(int, new_gen_growth_factor, 4, "Grow new gen by this factor."); 30 DEFINE_FLAG(int, new_gen_growth_factor, 4, "Grow new gen by this factor.");
31 DECLARE_FLAG(bool, concurrent_sweep);
31 32
32 // Scavenger uses RawObject::kMarkBit to distinguish forwaded and non-forwarded 33 // Scavenger uses RawObject::kMarkBit to distinguish forwaded and non-forwarded
33 // objects. The kMarkBit does not intersect with the target address because of 34 // objects. The kMarkBit does not intersect with the target address because of
34 // object alignment. 35 // object alignment.
35 enum { 36 enum {
36 kForwardingMask = 1 << RawObject::kMarkBit, 37 kForwardingMask = 1 << RawObject::kMarkBit,
37 kNotForwarded = 0, 38 kNotForwarded = 0,
38 kForwarded = kForwardingMask, 39 kForwarded = kForwardingMask,
39 }; 40 };
40 41
(...skipping 750 matching lines...) Expand 10 before | Expand all | Expand 10 after
791 void Scavenger::Scavenge(bool invoke_api_callbacks) { 792 void Scavenger::Scavenge(bool invoke_api_callbacks) {
792 // Scavenging is not reentrant. Make sure that is the case. 793 // Scavenging is not reentrant. Make sure that is the case.
793 ASSERT(!scavenging_); 794 ASSERT(!scavenging_);
794 scavenging_ = true; 795 scavenging_ = true;
795 Isolate* isolate = heap_->isolate(); 796 Isolate* isolate = heap_->isolate();
796 PageSpace* page_space = heap_->old_space(); 797 PageSpace* page_space = heap_->old_space();
797 NoHandleScope no_handles(isolate); 798 NoHandleScope no_handles(isolate);
798 799
799 if (FLAG_verify_before_gc) { 800 if (FLAG_verify_before_gc) {
800 OS::PrintErr("Verifying before Scavenge..."); 801 OS::PrintErr("Verifying before Scavenge...");
801 heap_->Verify(); 802 // TODO(koda): Check whether sweeper is actually running.
803 heap_->Verify(FLAG_concurrent_sweep ? kAllowMarked : kForbidMarked);
802 OS::PrintErr(" done.\n"); 804 OS::PrintErr(" done.\n");
803 } 805 }
804 806
805 // Prepare for a scavenge. 807 // Prepare for a scavenge.
806 SpaceUsage usage_before = GetCurrentUsage(); 808 SpaceUsage usage_before = GetCurrentUsage();
807 intptr_t promo_candidate_words = 809 intptr_t promo_candidate_words =
808 (survivor_end_ - FirstObjectStart()) / kWordSize; 810 (survivor_end_ - FirstObjectStart()) / kWordSize;
809 Prologue(isolate, invoke_api_callbacks); 811 Prologue(isolate, invoke_api_callbacks);
810 const bool prologue_weak_are_strong = !invoke_api_callbacks; 812 const bool prologue_weak_are_strong = !invoke_api_callbacks;
811 813
(...skipping 18 matching lines...) Expand all
830 heap_->RecordTime(kProcessToSpace, middle - start); 832 heap_->RecordTime(kProcessToSpace, middle - start);
831 heap_->RecordTime(kIterateWeaks, end - middle); 833 heap_->RecordTime(kIterateWeaks, end - middle);
832 stats_history_.Add(ScavengeStats(start, end, 834 stats_history_.Add(ScavengeStats(start, end,
833 usage_before, GetCurrentUsage(), 835 usage_before, GetCurrentUsage(),
834 promo_candidate_words, 836 promo_candidate_words,
835 visitor.bytes_promoted() >> kWordSizeLog2)); 837 visitor.bytes_promoted() >> kWordSizeLog2));
836 Epilogue(isolate, &visitor, invoke_api_callbacks); 838 Epilogue(isolate, &visitor, invoke_api_callbacks);
837 839
838 if (FLAG_verify_after_gc) { 840 if (FLAG_verify_after_gc) {
839 OS::PrintErr("Verifying after Scavenge..."); 841 OS::PrintErr("Verifying after Scavenge...");
840 heap_->Verify(); 842 // TODO(koda): Check whether sweeper is actually running.
843 heap_->Verify(FLAG_concurrent_sweep ? kAllowMarked : kForbidMarked);
841 OS::PrintErr(" done.\n"); 844 OS::PrintErr(" done.\n");
842 } 845 }
843 846
844 // Done scavenging. Reset the marker. 847 // Done scavenging. Reset the marker.
845 ASSERT(scavenging_); 848 ASSERT(scavenging_);
846 scavenging_ = false; 849 scavenging_ = false;
847 } 850 }
848 851
849 852
850 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
887 } 890 }
888 891
889 892
890 void Scavenger::FreeExternal(intptr_t size) { 893 void Scavenger::FreeExternal(intptr_t size) {
891 ASSERT(size >= 0); 894 ASSERT(size >= 0);
892 external_size_ -= size; 895 external_size_ -= size;
893 ASSERT(external_size_ >= 0); 896 ASSERT(external_size_ >= 0);
894 } 897 }
895 898
896 } // namespace dart 899 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/pages.cc ('k') | runtime/vm/verifier.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698