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/heap/incremental-marking.cc

Issue 1625753002: Allocation sampling for paged/lo spaces (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: USE for DCHECK only variable Created 4 years, 10 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 | « src/heap/incremental-marking.h ('k') | src/heap/spaces.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 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/heap/incremental-marking.h" 5 #include "src/heap/incremental-marking.h"
6 6
7 #include "src/code-stubs.h" 7 #include "src/code-stubs.h"
8 #include "src/compilation-cache.h" 8 #include "src/compilation-cache.h"
9 #include "src/conversions.h" 9 #include "src/conversions.h"
10 #include "src/heap/gc-idle-time-handler.h" 10 #include "src/heap/gc-idle-time-handler.h"
11 #include "src/heap/gc-tracer.h" 11 #include "src/heap/gc-tracer.h"
12 #include "src/heap/mark-compact-inl.h" 12 #include "src/heap/mark-compact-inl.h"
13 #include "src/heap/objects-visiting.h" 13 #include "src/heap/objects-visiting.h"
14 #include "src/heap/objects-visiting-inl.h" 14 #include "src/heap/objects-visiting-inl.h"
15 #include "src/v8.h" 15 #include "src/v8.h"
16 16
17 namespace v8 { 17 namespace v8 {
18 namespace internal { 18 namespace internal {
19 19
20 IncrementalMarking::StepActions IncrementalMarking::IdleStepActions() { 20 IncrementalMarking::StepActions IncrementalMarking::IdleStepActions() {
21 return StepActions(IncrementalMarking::NO_GC_VIA_STACK_GUARD, 21 return StepActions(IncrementalMarking::NO_GC_VIA_STACK_GUARD,
22 IncrementalMarking::FORCE_MARKING, 22 IncrementalMarking::FORCE_MARKING,
23 IncrementalMarking::DO_NOT_FORCE_COMPLETION); 23 IncrementalMarking::DO_NOT_FORCE_COMPLETION);
24 } 24 }
25 25
26
27 IncrementalMarking::IncrementalMarking(Heap* heap) 26 IncrementalMarking::IncrementalMarking(Heap* heap)
28 : heap_(heap), 27 : heap_(heap),
29 observer_(*this, kAllocatedThreshold), 28 observer_(*this, kAllocatedThreshold),
30 state_(STOPPED), 29 state_(STOPPED),
31 is_compacting_(false), 30 is_compacting_(false),
32 steps_count_(0), 31 steps_count_(0),
33 old_generation_space_available_at_start_of_incremental_(0), 32 old_generation_space_available_at_start_of_incremental_(0),
34 old_generation_space_used_at_start_of_incremental_(0), 33 old_generation_space_used_at_start_of_incremental_(0),
35 bytes_rescanned_(0), 34 bytes_rescanned_(0),
36 should_hurry_(false), 35 should_hurry_(false),
37 marking_speed_(0), 36 marking_speed_(0),
38 bytes_scanned_(0), 37 bytes_scanned_(0),
39 allocated_(0), 38 allocated_(0),
40 write_barriers_invoked_since_last_step_(0), 39 write_barriers_invoked_since_last_step_(0),
41 idle_marking_delay_counter_(0), 40 idle_marking_delay_counter_(0),
42 no_marking_scope_depth_(0), 41 no_marking_scope_depth_(0),
43 unscanned_bytes_of_large_object_(0), 42 unscanned_bytes_of_large_object_(0),
44 was_activated_(false), 43 was_activated_(false),
45 finalize_marking_completed_(false), 44 finalize_marking_completed_(false),
46 incremental_marking_finalization_rounds_(0), 45 incremental_marking_finalization_rounds_(0),
47 request_type_(COMPLETE_MARKING) {} 46 request_type_(COMPLETE_MARKING) {}
48 47
49
50 bool IncrementalMarking::BaseRecordWrite(HeapObject* obj, Object* value) { 48 bool IncrementalMarking::BaseRecordWrite(HeapObject* obj, Object* value) {
51 HeapObject* value_heap_obj = HeapObject::cast(value); 49 HeapObject* value_heap_obj = HeapObject::cast(value);
52 MarkBit value_bit = Marking::MarkBitFrom(value_heap_obj); 50 MarkBit value_bit = Marking::MarkBitFrom(value_heap_obj);
53 DCHECK(!Marking::IsImpossible(value_bit)); 51 DCHECK(!Marking::IsImpossible(value_bit));
54 52
55 MarkBit obj_bit = Marking::MarkBitFrom(obj); 53 MarkBit obj_bit = Marking::MarkBitFrom(obj);
56 DCHECK(!Marking::IsImpossible(obj_bit)); 54 DCHECK(!Marking::IsImpossible(obj_bit));
57 bool is_black = Marking::IsBlack(obj_bit); 55 bool is_black = Marking::IsBlack(obj_bit);
58 56
59 if (is_black && Marking::IsWhite(value_bit)) { 57 if (is_black && Marking::IsWhite(value_bit)) {
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 540
543 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { 541 if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
544 StartMarking(); 542 StartMarking();
545 } else { 543 } else {
546 if (FLAG_trace_incremental_marking) { 544 if (FLAG_trace_incremental_marking) {
547 PrintF("[IncrementalMarking] Start sweeping.\n"); 545 PrintF("[IncrementalMarking] Start sweeping.\n");
548 } 546 }
549 state_ = SWEEPING; 547 state_ = SWEEPING;
550 } 548 }
551 549
552 heap_->new_space()->AddInlineAllocationObserver(&observer_); 550 heap_->new_space()->AddAllocationObserver(&observer_);
553 551
554 incremental_marking_job()->Start(heap_); 552 incremental_marking_job()->Start(heap_);
555 } 553 }
556 554
557 555
558 void IncrementalMarking::StartMarking() { 556 void IncrementalMarking::StartMarking() {
559 if (FLAG_trace_incremental_marking) { 557 if (FLAG_trace_incremental_marking) {
560 PrintF("[IncrementalMarking] Start marking\n"); 558 PrintF("[IncrementalMarking] Start marking\n");
561 } 559 }
562 560
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 } 944 }
947 } 945 }
948 946
949 947
950 void IncrementalMarking::Stop() { 948 void IncrementalMarking::Stop() {
951 if (IsStopped()) return; 949 if (IsStopped()) return;
952 if (FLAG_trace_incremental_marking) { 950 if (FLAG_trace_incremental_marking) {
953 PrintF("[IncrementalMarking] Stopping.\n"); 951 PrintF("[IncrementalMarking] Stopping.\n");
954 } 952 }
955 953
956 heap_->new_space()->RemoveInlineAllocationObserver(&observer_); 954 heap_->new_space()->RemoveAllocationObserver(&observer_);
957 IncrementalMarking::set_should_hurry(false); 955 IncrementalMarking::set_should_hurry(false);
958 ResetStepCounters(); 956 ResetStepCounters();
959 if (IsMarking()) { 957 if (IsMarking()) {
960 PatchIncrementalMarkingRecordWriteStubs(heap_, 958 PatchIncrementalMarkingRecordWriteStubs(heap_,
961 RecordWriteStub::STORE_BUFFER_ONLY); 959 RecordWriteStub::STORE_BUFFER_ONLY);
962 DeactivateIncrementalWriteBarrier(); 960 DeactivateIncrementalWriteBarrier();
963 } 961 }
964 heap_->isolate()->stack_guard()->ClearGC(); 962 heap_->isolate()->stack_guard()->ClearGC();
965 state_ = STOPPED; 963 state_ = STOPPED;
966 is_compacting_ = false; 964 is_compacting_ = false;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1240 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { 1238 void IncrementalMarking::IncrementIdleMarkingDelayCounter() {
1241 idle_marking_delay_counter_++; 1239 idle_marking_delay_counter_++;
1242 } 1240 }
1243 1241
1244 1242
1245 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1243 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1246 idle_marking_delay_counter_ = 0; 1244 idle_marking_delay_counter_ = 0;
1247 } 1245 }
1248 } // namespace internal 1246 } // namespace internal
1249 } // namespace v8 1247 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.h ('k') | src/heap/spaces.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698