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

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 allspaces iterator and fix style issues 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
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, heap, 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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
533 531
534 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { 532 if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
535 StartMarking(); 533 StartMarking();
536 } else { 534 } else {
537 if (FLAG_trace_incremental_marking) { 535 if (FLAG_trace_incremental_marking) {
538 PrintF("[IncrementalMarking] Start sweeping.\n"); 536 PrintF("[IncrementalMarking] Start sweeping.\n");
539 } 537 }
540 state_ = SWEEPING; 538 state_ = SWEEPING;
541 } 539 }
542 540
543 heap_->new_space()->AddInlineAllocationObserver(&observer_); 541 heap_->new_space()->AddAllocationObserver(&observer_);
544 542
545 incremental_marking_job()->Start(heap_); 543 incremental_marking_job()->Start(heap_);
546 } 544 }
547 545
548 546
549 void IncrementalMarking::StartMarking() { 547 void IncrementalMarking::StartMarking() {
550 if (FLAG_trace_incremental_marking) { 548 if (FLAG_trace_incremental_marking) {
551 PrintF("[IncrementalMarking] Start marking\n"); 549 PrintF("[IncrementalMarking] Start marking\n");
552 } 550 }
553 551
(...skipping 377 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 } 929 }
932 } 930 }
933 931
934 932
935 void IncrementalMarking::Stop() { 933 void IncrementalMarking::Stop() {
936 if (IsStopped()) return; 934 if (IsStopped()) return;
937 if (FLAG_trace_incremental_marking) { 935 if (FLAG_trace_incremental_marking) {
938 PrintF("[IncrementalMarking] Stopping.\n"); 936 PrintF("[IncrementalMarking] Stopping.\n");
939 } 937 }
940 938
941 heap_->new_space()->RemoveInlineAllocationObserver(&observer_); 939 heap_->new_space()->RemoveAllocationObserver(&observer_);
942 IncrementalMarking::set_should_hurry(false); 940 IncrementalMarking::set_should_hurry(false);
943 ResetStepCounters(); 941 ResetStepCounters();
944 if (IsMarking()) { 942 if (IsMarking()) {
945 PatchIncrementalMarkingRecordWriteStubs(heap_, 943 PatchIncrementalMarkingRecordWriteStubs(heap_,
946 RecordWriteStub::STORE_BUFFER_ONLY); 944 RecordWriteStub::STORE_BUFFER_ONLY);
947 DeactivateIncrementalWriteBarrier(); 945 DeactivateIncrementalWriteBarrier();
948 } 946 }
949 heap_->isolate()->stack_guard()->ClearGC(); 947 heap_->isolate()->stack_guard()->ClearGC();
950 state_ = STOPPED; 948 state_ = STOPPED;
951 is_compacting_ = false; 949 is_compacting_ = false;
(...skipping 273 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { 1223 void IncrementalMarking::IncrementIdleMarkingDelayCounter() {
1226 idle_marking_delay_counter_++; 1224 idle_marking_delay_counter_++;
1227 } 1225 }
1228 1226
1229 1227
1230 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1228 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1231 idle_marking_delay_counter_ = 0; 1229 idle_marking_delay_counter_ = 0;
1232 } 1230 }
1233 } // namespace internal 1231 } // namespace internal
1234 } // namespace v8 1232 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698