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

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

Issue 1314853002: [heap] Make the current GCCallbackFlags are part of {Heap}. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 3 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') | test/cctest/cctest.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-tracer.h" 10 #include "src/heap/gc-tracer.h"
(...skipping 24 matching lines...) Expand all
35 marking_speed_(0), 35 marking_speed_(0),
36 bytes_scanned_(0), 36 bytes_scanned_(0),
37 allocated_(0), 37 allocated_(0),
38 write_barriers_invoked_since_last_step_(0), 38 write_barriers_invoked_since_last_step_(0),
39 idle_marking_delay_counter_(0), 39 idle_marking_delay_counter_(0),
40 no_marking_scope_depth_(0), 40 no_marking_scope_depth_(0),
41 unscanned_bytes_of_large_object_(0), 41 unscanned_bytes_of_large_object_(0),
42 was_activated_(false), 42 was_activated_(false),
43 weak_closure_was_overapproximated_(false), 43 weak_closure_was_overapproximated_(false),
44 weak_closure_approximation_rounds_(0), 44 weak_closure_approximation_rounds_(0),
45 request_type_(COMPLETE_MARKING), 45 request_type_(COMPLETE_MARKING) {}
46 gc_callback_flags_(kNoGCCallbackFlags) {}
47 46
48 47
49 void IncrementalMarking::RecordWriteSlow(HeapObject* obj, Object** slot, 48 void IncrementalMarking::RecordWriteSlow(HeapObject* obj, Object** slot,
50 Object* value) { 49 Object* value) {
51 if (BaseRecordWrite(obj, slot, value) && slot != NULL) { 50 if (BaseRecordWrite(obj, slot, value) && slot != NULL) {
52 MarkBit obj_bit = Marking::MarkBitFrom(obj); 51 MarkBit obj_bit = Marking::MarkBitFrom(obj);
53 if (Marking::IsBlack(obj_bit)) { 52 if (Marking::IsBlack(obj_bit)) {
54 // Object is not going to be rescanned we need to record the slot. 53 // Object is not going to be rescanned we need to record the slot.
55 heap_->mark_compact_collector()->RecordSlot(obj, slot, value); 54 heap_->mark_compact_collector()->RecordSlot(obj, slot, value);
56 } 55 }
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after
456 Object* e = stubs->ValueAt(i); 455 Object* e = stubs->ValueAt(i);
457 if (e->IsCode()) { 456 if (e->IsCode()) {
458 RecordWriteStub::Patch(Code::cast(e), mode); 457 RecordWriteStub::Patch(Code::cast(e), mode);
459 } 458 }
460 } 459 }
461 } 460 }
462 } 461 }
463 } 462 }
464 463
465 464
466 void IncrementalMarking::Start(int flags, 465 void IncrementalMarking::Start(const char* reason) {
467 const GCCallbackFlags gc_callback_flags,
468 const char* reason) {
469 if (FLAG_trace_incremental_marking) { 466 if (FLAG_trace_incremental_marking) {
470 PrintF("[IncrementalMarking] Start (%s)\n", 467 PrintF("[IncrementalMarking] Start (%s)\n",
471 (reason == nullptr) ? "unknown reason" : reason); 468 (reason == nullptr) ? "unknown reason" : reason);
472 } 469 }
473 DCHECK(FLAG_incremental_marking); 470 DCHECK(FLAG_incremental_marking);
474 DCHECK(state_ == STOPPED); 471 DCHECK(state_ == STOPPED);
475 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); 472 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC);
476 DCHECK(!heap_->isolate()->serializer_enabled()); 473 DCHECK(!heap_->isolate()->serializer_enabled());
477 474
478 ResetStepCounters(); 475 ResetStepCounters();
479 476
480 gc_callback_flags_ = gc_callback_flags;
481 was_activated_ = true; 477 was_activated_ = true;
482 478
483 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { 479 if (!heap_->mark_compact_collector()->sweeping_in_progress()) {
484 heap_->set_current_gc_flags(flags);
485 StartMarking(); 480 StartMarking();
486 } else { 481 } else {
487 if (FLAG_trace_incremental_marking) { 482 if (FLAG_trace_incremental_marking) {
488 PrintF("[IncrementalMarking] Start sweeping.\n"); 483 PrintF("[IncrementalMarking] Start sweeping.\n");
489 } 484 }
490 state_ = SWEEPING; 485 state_ = SWEEPING;
491 } 486 }
492 487
493 heap_->new_space()->LowerInlineAllocationLimit(kAllocatedThreshold); 488 heap_->new_space()->LowerInlineAllocationLimit(kAllocatedThreshold);
494 } 489 }
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 807
813 void IncrementalMarking::Epilogue() { 808 void IncrementalMarking::Epilogue() {
814 was_activated_ = false; 809 was_activated_ = false;
815 weak_closure_was_overapproximated_ = false; 810 weak_closure_was_overapproximated_ = false;
816 weak_closure_approximation_rounds_ = 0; 811 weak_closure_approximation_rounds_ = 0;
817 } 812 }
818 813
819 814
820 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { 815 void IncrementalMarking::OldSpaceStep(intptr_t allocated) {
821 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) { 816 if (IsStopped() && ShouldActivateEvenWithoutIdleNotification()) {
822 Start(Heap::kNoGCFlags, kNoGCCallbackFlags, "old space step"); 817 heap()->StartIncrementalMarking(Heap::kNoGCFlags, kNoGCCallbackFlags,
818 "old space step");
823 } else { 819 } else {
824 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); 820 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD);
825 } 821 }
826 } 822 }
827 823
828 824
829 void IncrementalMarking::SpeedUp() { 825 void IncrementalMarking::SpeedUp() {
830 bool speed_up = false; 826 bool speed_up = false;
831 827
832 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) { 828 if ((steps_count_ % kMarkingSpeedAccellerationInterval) == 0) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1015 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { 1011 void IncrementalMarking::IncrementIdleMarkingDelayCounter() {
1016 idle_marking_delay_counter_++; 1012 idle_marking_delay_counter_++;
1017 } 1013 }
1018 1014
1019 1015
1020 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1016 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1021 idle_marking_delay_counter_ = 0; 1017 idle_marking_delay_counter_ = 0;
1022 } 1018 }
1023 } // namespace internal 1019 } // namespace internal
1024 } // namespace v8 1020 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.h ('k') | test/cctest/cctest.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698