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

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

Issue 414743002: Revert "Track history of events in GCTracer." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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),
25 old_generation_space_available_at_start_of_incremental_(0), 27 old_generation_space_available_at_start_of_incremental_(0),
26 old_generation_space_used_at_start_of_incremental_(0), 28 old_generation_space_used_at_start_of_incremental_(0),
29 steps_count_since_last_gc_(0),
30 steps_took_since_last_gc_(0),
27 should_hurry_(false), 31 should_hurry_(false),
28 marking_speed_(0), 32 marking_speed_(0),
29 allocated_(0), 33 allocated_(0),
30 no_marking_scope_depth_(0), 34 no_marking_scope_depth_(0),
31 unscanned_bytes_of_large_object_(0) { 35 unscanned_bytes_of_large_object_(0) {}
32 }
33 36
34 37
35 void IncrementalMarking::TearDown() { 38 void IncrementalMarking::TearDown() {
36 delete marking_deque_memory_; 39 delete marking_deque_memory_;
37 } 40 }
38 41
39 42
40 void IncrementalMarking::RecordWriteSlow(HeapObject* obj, 43 void IncrementalMarking::RecordWriteSlow(HeapObject* obj,
41 Object** slot, 44 Object** slot,
42 Object* value) { 45 Object* value) {
(...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after
648 MarkBit mark_bit = Marking::MarkBitFrom(obj); 651 MarkBit mark_bit = Marking::MarkBitFrom(obj);
649 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); 652 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
650 ASSERT(Marking::IsGrey(mark_bit) || 653 ASSERT(Marking::IsGrey(mark_bit) ||
651 (obj->IsFiller() && Marking::IsWhite(mark_bit)) || 654 (obj->IsFiller() && Marking::IsWhite(mark_bit)) ||
652 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) && 655 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) &&
653 Marking::IsBlack(mark_bit))); 656 Marking::IsBlack(mark_bit)));
654 #endif 657 #endif
655 } 658 }
656 } 659 }
657 marking_deque_.set_top(new_top); 660 marking_deque_.set_top(new_top);
661
662 steps_took_since_last_gc_ = 0;
663 steps_count_since_last_gc_ = 0;
658 } 664 }
659 665
660 666
661 void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) { 667 void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) {
662 MarkBit map_mark_bit = Marking::MarkBitFrom(map); 668 MarkBit map_mark_bit = Marking::MarkBitFrom(map);
663 if (Marking::IsWhite(map_mark_bit)) { 669 if (Marking::IsWhite(map_mark_bit)) {
664 WhiteToGreyAndPush(map, map_mark_bit); 670 WhiteToGreyAndPush(map, map_mark_bit);
665 } 671 }
666 672
667 IncrementalMarkingMarkingVisitor::IterateBody(map, obj); 673 IncrementalMarkingMarkingVisitor::IterateBody(map, obj);
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { 888 if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
883 bytes_scanned_ = 0; 889 bytes_scanned_ = 0;
884 StartMarking(PREVENT_COMPACTION); 890 StartMarking(PREVENT_COMPACTION);
885 } 891 }
886 } else if (state_ == MARKING) { 892 } else if (state_ == MARKING) {
887 ProcessMarkingDeque(bytes_to_process); 893 ProcessMarkingDeque(bytes_to_process);
888 if (marking_deque_.IsEmpty()) MarkingComplete(action); 894 if (marking_deque_.IsEmpty()) MarkingComplete(action);
889 } 895 }
890 896
891 steps_count_++; 897 steps_count_++;
898 steps_count_since_last_gc_++;
892 899
893 bool speed_up = false; 900 bool speed_up = false;
894 901
895 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { 902 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) {
896 if (FLAG_trace_gc) { 903 if (FLAG_trace_gc) {
897 PrintPID("Speed up marking after %d steps\n", 904 PrintPID("Speed up marking after %d steps\n",
898 static_cast<int>(kMarkingSpeedAccellerationInterval)); 905 static_cast<int>(kMarkingSpeedAccellerationInterval));
899 } 906 }
900 speed_up = true; 907 speed_up = true;
901 } 908 }
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
950 if (FLAG_trace_gc) { 957 if (FLAG_trace_gc) {
951 PrintPID("Marking speed increased to %d\n", marking_speed_); 958 PrintPID("Marking speed increased to %d\n", marking_speed_);
952 } 959 }
953 } 960 }
954 } 961 }
955 962
956 if (FLAG_trace_incremental_marking || FLAG_trace_gc || 963 if (FLAG_trace_incremental_marking || FLAG_trace_gc ||
957 FLAG_print_cumulative_gc_stat) { 964 FLAG_print_cumulative_gc_stat) {
958 double end = base::OS::TimeCurrentMillis(); 965 double end = base::OS::TimeCurrentMillis();
959 double delta = (end - start); 966 double delta = (end - start);
960 heap_->tracer()->AddIncrementalMarkingStep(delta); 967 longest_step_ = Max(longest_step_, delta);
968 steps_took_ += delta;
969 steps_took_since_last_gc_ += delta;
961 heap_->AddMarkingTime(delta); 970 heap_->AddMarkingTime(delta);
962 } 971 }
963 } 972 }
964 973
965 974
966 void IncrementalMarking::ResetStepCounters() { 975 void IncrementalMarking::ResetStepCounters() {
967 steps_count_ = 0; 976 steps_count_ = 0;
977 steps_took_ = 0;
978 longest_step_ = 0.0;
968 old_generation_space_available_at_start_of_incremental_ = 979 old_generation_space_available_at_start_of_incremental_ =
969 SpaceLeftInOldSpace(); 980 SpaceLeftInOldSpace();
970 old_generation_space_used_at_start_of_incremental_ = 981 old_generation_space_used_at_start_of_incremental_ =
971 heap_->PromotedTotalSize(); 982 heap_->PromotedTotalSize();
983 steps_count_since_last_gc_ = 0;
984 steps_took_since_last_gc_ = 0;
972 bytes_rescanned_ = 0; 985 bytes_rescanned_ = 0;
973 marking_speed_ = kInitialMarkingSpeed; 986 marking_speed_ = kInitialMarkingSpeed;
974 bytes_scanned_ = 0; 987 bytes_scanned_ = 0;
975 write_barriers_invoked_since_last_step_ = 0; 988 write_barriers_invoked_since_last_step_ = 0;
976 } 989 }
977 990
978 991
979 int64_t IncrementalMarking::SpaceLeftInOldSpace() { 992 int64_t IncrementalMarking::SpaceLeftInOldSpace() {
980 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects(); 993 return heap_->MaxOldGenerationSize() - heap_->PromotedSpaceSizeOfObjects();
981 } 994 }
982 995
983 } } // namespace v8::internal 996 } } // 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