OLD | NEW |
---|---|
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 10 matching lines...) Expand all Loading... | |
21 state_(STOPPED), | 21 state_(STOPPED), |
22 steps_count_(0), | 22 steps_count_(0), |
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 | 33 |
33 | 34 |
34 void IncrementalMarking::RecordWriteSlow(HeapObject* obj, Object** slot, | 35 void IncrementalMarking::RecordWriteSlow(HeapObject* obj, Object** slot, |
35 Object* value) { | 36 Object* value) { |
36 if (BaseRecordWrite(obj, slot, value) && slot != NULL) { | 37 if (BaseRecordWrite(obj, slot, value) && slot != NULL) { |
37 MarkBit obj_bit = Marking::MarkBitFrom(obj); | 38 MarkBit obj_bit = Marking::MarkBitFrom(obj); |
38 if (Marking::IsBlack(obj_bit)) { | 39 if (Marking::IsBlack(obj_bit)) { |
39 // Object is not going to be rescanned we need to record the slot. | 40 // Object is not going to be rescanned we need to record the slot. |
40 heap_->mark_compact_collector()->RecordSlot(HeapObject::RawField(obj, 0), | 41 heap_->mark_compact_collector()->RecordSlot(HeapObject::RawField(obj, 0), |
41 slot, value); | 42 slot, value); |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 } | 489 } |
489 DCHECK(FLAG_incremental_marking); | 490 DCHECK(FLAG_incremental_marking); |
490 DCHECK(FLAG_incremental_marking_steps); | 491 DCHECK(FLAG_incremental_marking_steps); |
491 DCHECK(state_ == STOPPED); | 492 DCHECK(state_ == STOPPED); |
492 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); | 493 DCHECK(heap_->gc_state() == Heap::NOT_IN_GC); |
493 DCHECK(!heap_->isolate()->serializer_enabled()); | 494 DCHECK(!heap_->isolate()->serializer_enabled()); |
494 | 495 |
495 ResetStepCounters(); | 496 ResetStepCounters(); |
496 | 497 |
497 was_activated_ = true; | 498 was_activated_ = true; |
499 weak_closure_was_overapproximated_ = false; | |
Hannes Payer (out of office)
2015/02/03 17:40:11
Can we do that in the gc epilogue?
jochen (gone - plz use gerrit)
2015/02/09 16:03:43
Done
| |
498 | 500 |
499 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { | 501 if (!heap_->mark_compact_collector()->sweeping_in_progress()) { |
500 StartMarking(flag); | 502 StartMarking(flag); |
501 } else { | 503 } else { |
502 if (FLAG_trace_incremental_marking) { | 504 if (FLAG_trace_incremental_marking) { |
503 PrintF("[IncrementalMarking] Start sweeping.\n"); | 505 PrintF("[IncrementalMarking] Start sweeping.\n"); |
504 } | 506 } |
505 state_ = SWEEPING; | 507 state_ = SWEEPING; |
506 } | 508 } |
507 | 509 |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
765 ResetStepCounters(); | 767 ResetStepCounters(); |
766 PatchIncrementalMarkingRecordWriteStubs(heap_, | 768 PatchIncrementalMarkingRecordWriteStubs(heap_, |
767 RecordWriteStub::STORE_BUFFER_ONLY); | 769 RecordWriteStub::STORE_BUFFER_ONLY); |
768 DeactivateIncrementalWriteBarrier(); | 770 DeactivateIncrementalWriteBarrier(); |
769 DCHECK(heap_->mark_compact_collector()->marking_deque()->IsEmpty()); | 771 DCHECK(heap_->mark_compact_collector()->marking_deque()->IsEmpty()); |
770 heap_->isolate()->stack_guard()->ClearGC(); | 772 heap_->isolate()->stack_guard()->ClearGC(); |
771 } | 773 } |
772 | 774 |
773 | 775 |
774 void IncrementalMarking::MarkingComplete(CompletionAction action) { | 776 void IncrementalMarking::MarkingComplete(CompletionAction action) { |
775 state_ = COMPLETE; | |
776 // We will set the stack guard to request a GC now. This will mean the rest | 777 // We will set the stack guard to request a GC now. This will mean the rest |
777 // of the GC gets performed as soon as possible (we can't do a GC here in a | 778 // of the GC gets performed as soon as possible (we can't do a GC here in a |
778 // record-write context). If a few things get allocated between now and then | 779 // record-write context). If a few things get allocated between now and then |
779 // that shouldn't make us do a scavenge and keep being incremental, so we set | 780 // that shouldn't make us do a scavenge and keep being incremental, so we set |
780 // the should-hurry flag to indicate that there can't be much work left to do. | 781 // the should-hurry flag to indicate that there can't be much work left to do. |
781 set_should_hurry(true); | 782 set_should_hurry(true); |
783 if (FLAG_overapproximate_weak_closure && | |
784 !weak_closure_was_overapproximated_ && action == GC_VIA_STACK_GUARD) { | |
785 if (FLAG_trace_incremental_marking) { | |
Hannes Payer (out of office)
2015/02/03 17:40:11
Can we add a separate method for that and dispatch
jochen (gone - plz use gerrit)
2015/02/09 16:03:43
done
jochen (gone - plz use gerrit)
2015/02/09 16:03:43
done
| |
786 PrintF( | |
787 "[IncrementalMarking] requesting weak closure overapproximation.\n"); | |
788 } | |
789 heap_->isolate()->stack_guard()->RequestGC(); | |
790 return; | |
791 } | |
792 state_ = COMPLETE; | |
782 if (FLAG_trace_incremental_marking) { | 793 if (FLAG_trace_incremental_marking) { |
783 PrintF("[IncrementalMarking] Complete (normal).\n"); | 794 PrintF("[IncrementalMarking] Complete (normal).\n"); |
784 } | 795 } |
785 if (action == GC_VIA_STACK_GUARD) { | 796 if (action == GC_VIA_STACK_GUARD) { |
786 heap_->isolate()->stack_guard()->RequestGC(); | 797 heap_->isolate()->stack_guard()->RequestGC(); |
787 } | 798 } |
788 } | 799 } |
789 | 800 |
790 | 801 |
791 void IncrementalMarking::Epilogue() { was_activated_ = false; } | 802 void IncrementalMarking::Epilogue() { was_activated_ = false; } |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
981 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { | 992 void IncrementalMarking::IncrementIdleMarkingDelayCounter() { |
982 idle_marking_delay_counter_++; | 993 idle_marking_delay_counter_++; |
983 } | 994 } |
984 | 995 |
985 | 996 |
986 void IncrementalMarking::ClearIdleMarkingDelayCounter() { | 997 void IncrementalMarking::ClearIdleMarkingDelayCounter() { |
987 idle_marking_delay_counter_ = 0; | 998 idle_marking_delay_counter_ = 0; |
988 } | 999 } |
989 } | 1000 } |
990 } // namespace v8::internal | 1001 } // namespace v8::internal |
OLD | NEW |