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

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

Issue 1012593004: Repeatedly overapproximate the weak closure as long as we make progress (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 5 years, 9 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') | no next file » | 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/heap/incremental-marking.h" 7 #include "src/heap/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"
(...skipping 12 matching lines...) Expand all
23 old_generation_space_available_at_start_of_incremental_(0), 23 old_generation_space_available_at_start_of_incremental_(0),
24 old_generation_space_used_at_start_of_incremental_(0), 24 old_generation_space_used_at_start_of_incremental_(0),
25 should_hurry_(false), 25 should_hurry_(false),
26 marking_speed_(0), 26 marking_speed_(0),
27 allocated_(0), 27 allocated_(0),
28 idle_marking_delay_counter_(0), 28 idle_marking_delay_counter_(0),
29 no_marking_scope_depth_(0), 29 no_marking_scope_depth_(0),
30 unscanned_bytes_of_large_object_(0), 30 unscanned_bytes_of_large_object_(0),
31 was_activated_(false), 31 was_activated_(false),
32 weak_closure_was_overapproximated_(false), 32 weak_closure_was_overapproximated_(false),
33 weak_closure_approximation_rounds_(0),
33 request_type_(COMPLETE_MARKING) {} 34 request_type_(COMPLETE_MARKING) {}
34 35
35 36
36 void IncrementalMarking::RecordWriteSlow(HeapObject* obj, Object** slot, 37 void IncrementalMarking::RecordWriteSlow(HeapObject* obj, Object** slot,
37 Object* value) { 38 Object* value) {
38 if (BaseRecordWrite(obj, slot, value) && slot != NULL) { 39 if (BaseRecordWrite(obj, slot, value) && slot != NULL) {
39 MarkBit obj_bit = Marking::MarkBitFrom(obj); 40 MarkBit obj_bit = Marking::MarkBitFrom(obj);
40 if (Marking::IsBlack(obj_bit)) { 41 if (Marking::IsBlack(obj_bit)) {
41 // Object is not going to be rescanned we need to record the slot. 42 // Object is not going to be rescanned we need to record the slot.
42 heap_->mark_compact_collector()->RecordSlot(HeapObject::RawField(obj, 0), 43 heap_->mark_compact_collector()->RecordSlot(HeapObject::RawField(obj, 0),
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 if (FLAG_trace_incremental_marking) { 543 if (FLAG_trace_incremental_marking) {
543 PrintF("[IncrementalMarking] Running\n"); 544 PrintF("[IncrementalMarking] Running\n");
544 } 545 }
545 } 546 }
546 547
547 548
548 void IncrementalMarking::MarkObjectGroups() { 549 void IncrementalMarking::MarkObjectGroups() {
549 DCHECK(FLAG_overapproximate_weak_closure); 550 DCHECK(FLAG_overapproximate_weak_closure);
550 DCHECK(!weak_closure_was_overapproximated_); 551 DCHECK(!weak_closure_was_overapproximated_);
551 552
552 GCTracer::Scope gc_scope(heap_->tracer(), 553 int old_marking_deque_top =
553 GCTracer::Scope::MC_INCREMENTAL_WEAKCLOSURE); 554 heap_->mark_compact_collector()->marking_deque()->top();
554 555
555 heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkObject); 556 heap_->mark_compact_collector()->MarkImplicitRefGroups(&MarkObject);
556 557
557 IncrementalMarkingRootMarkingVisitor visitor(this); 558 IncrementalMarkingRootMarkingVisitor visitor(this);
558 heap_->isolate()->global_handles()->IterateObjectGroups( 559 heap_->isolate()->global_handles()->IterateObjectGroups(
559 &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap); 560 &visitor, &MarkCompactCollector::IsUnmarkedHeapObjectWithHeap);
560 561
562 int marking_progress =
563 abs(old_marking_deque_top -
564 heap_->mark_compact_collector()->marking_deque()->top());
565
566 ++weak_closure_approximation_rounds_;
567 if ((weak_closure_approximation_rounds_ >=
568 FLAG_max_object_groups_marking_rounds) ||
569 (marking_progress < FLAG_min_progress_during_object_groups_marking)) {
570 weak_closure_was_overapproximated_ = true;
571 }
572
561 heap_->isolate()->global_handles()->RemoveImplicitRefGroups(); 573 heap_->isolate()->global_handles()->RemoveImplicitRefGroups();
562 heap_->isolate()->global_handles()->RemoveObjectGroups(); 574 heap_->isolate()->global_handles()->RemoveObjectGroups();
563
564 weak_closure_was_overapproximated_ = true;
565 } 575 }
566 576
567 577
568 void IncrementalMarking::PrepareForScavenge() { 578 void IncrementalMarking::PrepareForScavenge() {
569 if (!IsMarking()) return; 579 if (!IsMarking()) return;
570 NewSpacePageIterator it(heap_->new_space()->FromSpaceStart(), 580 NewSpacePageIterator it(heap_->new_space()->FromSpaceStart(),
571 heap_->new_space()->FromSpaceEnd()); 581 heap_->new_space()->FromSpaceEnd());
572 while (it.has_next()) { 582 while (it.has_next()) {
573 Bitmap::Clear(it.next()); 583 Bitmap::Clear(it.next());
574 } 584 }
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 if (action == GC_VIA_STACK_GUARD) { 822 if (action == GC_VIA_STACK_GUARD) {
813 request_type_ = COMPLETE_MARKING; 823 request_type_ = COMPLETE_MARKING;
814 heap_->isolate()->stack_guard()->RequestGC(); 824 heap_->isolate()->stack_guard()->RequestGC();
815 } 825 }
816 } 826 }
817 827
818 828
819 void IncrementalMarking::Epilogue() { 829 void IncrementalMarking::Epilogue() {
820 was_activated_ = false; 830 was_activated_ = false;
821 weak_closure_was_overapproximated_ = false; 831 weak_closure_was_overapproximated_ = false;
832 weak_closure_approximation_rounds_ = 0;
822 } 833 }
823 834
824 835
825 void IncrementalMarking::OldSpaceStep(intptr_t allocated) { 836 void IncrementalMarking::OldSpaceStep(intptr_t allocated) {
826 if (IsStopped() && ShouldActivate()) { 837 if (IsStopped() && ShouldActivate()) {
827 // TODO(hpayer): Let's play safe for now, but compaction should be 838 // TODO(hpayer): Let's play safe for now, but compaction should be
828 // in principle possible. 839 // in principle possible.
829 Start(PREVENT_COMPACTION); 840 Start(PREVENT_COMPACTION);
830 } else { 841 } else {
831 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD); 842 Step(allocated * kFastMarking / kInitialMarkingSpeed, GC_VIA_STACK_GUARD);
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
1018 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { 1029 void IncrementalMarking::IncrementIdleMarkingDelayCounter() {
1019 idle_marking_delay_counter_++; 1030 idle_marking_delay_counter_++;
1020 } 1031 }
1021 1032
1022 1033
1023 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1034 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1024 idle_marking_delay_counter_ = 0; 1035 idle_marking_delay_counter_ = 0;
1025 } 1036 }
1026 } 1037 }
1027 } // namespace v8::internal 1038 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/incremental-marking.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698