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

Side by Side Diff: src/incremental-marking.cc

Issue 391413006: Track history of events in GCTracer. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Clean-ups Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/incremental-marking.h ('k') | test/cctest/cctest.gyp » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/incremental-marking.h" 7 #include "src/incremental-marking.h"
8 8
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
11 #include "src/conversions.h" 11 #include "src/conversions.h"
12 #include "src/objects-visiting.h" 12 #include "src/objects-visiting.h"
13 #include "src/objects-visiting-inl.h" 13 #include "src/objects-visiting-inl.h"
14 14
15 namespace v8 { 15 namespace v8 {
16 namespace internal { 16 namespace internal {
17 17
18 18
19 IncrementalMarking::IncrementalMarking(Heap* heap) 19 IncrementalMarking::IncrementalMarking(Heap* heap)
20 : heap_(heap), 20 : heap_(heap),
21 state_(STOPPED), 21 state_(STOPPED),
22 marking_deque_memory_(NULL), 22 marking_deque_memory_(NULL),
23 marking_deque_memory_committed_(false), 23 marking_deque_memory_committed_(false),
24 steps_count_(0), 24 steps_count_(0),
25 steps_took_(0),
26 longest_step_(0.0),
27 old_generation_space_available_at_start_of_incremental_(0), 25 old_generation_space_available_at_start_of_incremental_(0),
28 old_generation_space_used_at_start_of_incremental_(0), 26 old_generation_space_used_at_start_of_incremental_(0),
29 steps_count_since_last_gc_(0),
30 steps_took_since_last_gc_(0),
31 should_hurry_(false), 27 should_hurry_(false),
32 marking_speed_(0), 28 marking_speed_(0),
33 allocated_(0), 29 allocated_(0),
34 no_marking_scope_depth_(0), 30 no_marking_scope_depth_(0),
35 unscanned_bytes_of_large_object_(0) { 31 unscanned_bytes_of_large_object_(0) {
36 } 32 }
37 33
38 34
39 void IncrementalMarking::TearDown() { 35 void IncrementalMarking::TearDown() {
40 delete marking_deque_memory_; 36 delete marking_deque_memory_;
(...skipping 611 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 MarkBit mark_bit = Marking::MarkBitFrom(obj); 648 MarkBit mark_bit = Marking::MarkBitFrom(obj);
653 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); 649 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
654 ASSERT(Marking::IsGrey(mark_bit) || 650 ASSERT(Marking::IsGrey(mark_bit) ||
655 (obj->IsFiller() && Marking::IsWhite(mark_bit)) || 651 (obj->IsFiller() && Marking::IsWhite(mark_bit)) ||
656 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) && 652 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) &&
657 Marking::IsBlack(mark_bit))); 653 Marking::IsBlack(mark_bit)));
658 #endif 654 #endif
659 } 655 }
660 } 656 }
661 marking_deque_.set_top(new_top); 657 marking_deque_.set_top(new_top);
662
663 steps_took_since_last_gc_ = 0;
664 steps_count_since_last_gc_ = 0;
665 } 658 }
666 659
667 660
668 void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) { 661 void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) {
669 MarkBit map_mark_bit = Marking::MarkBitFrom(map); 662 MarkBit map_mark_bit = Marking::MarkBitFrom(map);
670 if (Marking::IsWhite(map_mark_bit)) { 663 if (Marking::IsWhite(map_mark_bit)) {
671 WhiteToGreyAndPush(map, map_mark_bit); 664 WhiteToGreyAndPush(map, map_mark_bit);
672 } 665 }
673 666
674 IncrementalMarkingMarkingVisitor::IterateBody(map, obj); 667 IncrementalMarkingMarkingVisitor::IterateBody(map, obj);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { 882 if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
890 bytes_scanned_ = 0; 883 bytes_scanned_ = 0;
891 StartMarking(PREVENT_COMPACTION); 884 StartMarking(PREVENT_COMPACTION);
892 } 885 }
893 } else if (state_ == MARKING) { 886 } else if (state_ == MARKING) {
894 ProcessMarkingDeque(bytes_to_process); 887 ProcessMarkingDeque(bytes_to_process);
895 if (marking_deque_.IsEmpty()) MarkingComplete(action); 888 if (marking_deque_.IsEmpty()) MarkingComplete(action);
896 } 889 }
897 890
898 steps_count_++; 891 steps_count_++;
899 steps_count_since_last_gc_++;
900 892
901 bool speed_up = false; 893 bool speed_up = false;
902 894
903 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { 895 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) {
904 if (FLAG_trace_gc) { 896 if (FLAG_trace_gc) {
905 PrintPID("Speed up marking after %d steps\n", 897 PrintPID("Speed up marking after %d steps\n",
906 static_cast<int>(kMarkingSpeedAccellerationInterval)); 898 static_cast<int>(kMarkingSpeedAccellerationInterval));
907 } 899 }
908 speed_up = true; 900 speed_up = true;
909 } 901 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
958 if (FLAG_trace_gc) { 950 if (FLAG_trace_gc) {
959 PrintPID("Marking speed increased to %d\n", marking_speed_); 951 PrintPID("Marking speed increased to %d\n", marking_speed_);
960 } 952 }
961 } 953 }
962 } 954 }
963 955
964 if (FLAG_trace_incremental_marking || FLAG_trace_gc || 956 if (FLAG_trace_incremental_marking || FLAG_trace_gc ||
965 FLAG_print_cumulative_gc_stat) { 957 FLAG_print_cumulative_gc_stat) {
966 double end = base::OS::TimeCurrentMillis(); 958 double end = base::OS::TimeCurrentMillis();
967 double delta = (end - start); 959 double delta = (end - start);
968 longest_step_ = Max(longest_step_, delta); 960 heap_->tracer()->AddIncrementalMarkingStep(delta);
969 steps_took_ += delta;
970 steps_took_since_last_gc_ += delta;
971 heap_->AddMarkingTime(delta); 961 heap_->AddMarkingTime(delta);
972 } 962 }
973 } 963 }
974 964
975 965
976 void IncrementalMarking::ResetStepCounters() { 966 void IncrementalMarking::ResetStepCounters() {
977 steps_count_ = 0; 967 steps_count_ = 0;
978 steps_took_ = 0;
979 longest_step_ = 0.0;
980 old_generation_space_available_at_start_of_incremental_ = 968 old_generation_space_available_at_start_of_incremental_ =
981 SpaceLeftInOldSpace(); 969 SpaceLeftInOldSpace();
982 old_generation_space_used_at_start_of_incremental_ = 970 old_generation_space_used_at_start_of_incremental_ =
983 heap_->PromotedTotalSize(); 971 heap_->PromotedTotalSize();
984 steps_count_since_last_gc_ = 0;
985 steps_took_since_last_gc_ = 0;
986 bytes_rescanned_ = 0; 972 bytes_rescanned_ = 0;
987 marking_speed_ = kInitialMarkingSpeed; 973 marking_speed_ = kInitialMarkingSpeed;
988 bytes_scanned_ = 0; 974 bytes_scanned_ = 0;
989 write_barriers_invoked_since_last_step_ = 0; 975 write_barriers_invoked_since_last_step_ = 0;
990 } 976 }
991 977
992 978
993 int64_t IncrementalMarking::SpaceLeftInOldSpace() { 979 int64_t IncrementalMarking::SpaceLeftInOldSpace() {
994 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); 980 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects();
995 } 981 }
996 982
997 } } // namespace v8::internal 983 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/incremental-marking.h ('k') | test/cctest/cctest.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698