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

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

Issue 2853323003: [heap] Prepare IncrementalMarking::VisitObject for concurrent marking. (Closed)
Patch Set: Created 3 years, 7 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/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/concurrent-marking.h" 10 #include "src/heap/concurrent-marking.h"
(...skipping 779 matching lines...) Expand 10 before | Expand all | Expand 10 after
790 (MemoryChunk::FromAddress(obj->address()) 790 (MemoryChunk::FromAddress(obj->address())
791 ->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) && 791 ->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) &&
792 ObjectMarking::IsBlack<kAtomicity>(obj, marking_state(obj)))); 792 ObjectMarking::IsBlack<kAtomicity>(obj, marking_state(obj))));
793 // Skip one word filler objects that appear on the 793 // Skip one word filler objects that appear on the
794 // stack when we perform in place array shift. 794 // stack when we perform in place array shift.
795 return (obj->map() == filler_map) ? nullptr : obj; 795 return (obj->map() == filler_map) ? nullptr : obj;
796 } 796 }
797 }); 797 });
798 } 798 }
799 799
800 bool IncrementalMarking::IsFixedArrayWithProgressBar(HeapObject* obj) {
801 if (!obj->IsFixedArray()) return false;
802 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
803 return chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR);
804 }
800 805
801 void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) { 806 void IncrementalMarking::VisitObject(Map* map, HeapObject* obj, int size) {
802 WhiteToGreyAndPush(map);
803
804 IncrementalMarkingMarkingVisitor::IterateBody(map, obj);
805
806 #if ENABLE_SLOW_DCHECKS 807 #if ENABLE_SLOW_DCHECKS
807 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj, marking_state(obj)); 808 MarkBit mark_bit = ObjectMarking::MarkBitFrom(obj, marking_state(obj));
808 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address()); 809 MemoryChunk* chunk = MemoryChunk::FromAddress(obj->address());
809 SLOW_DCHECK(Marking::IsGrey<kAtomicity>(mark_bit) || 810 SLOW_DCHECK(Marking::IsGrey<kAtomicity>(mark_bit) ||
810 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) && 811 (chunk->IsFlagSet(MemoryChunk::HAS_PROGRESS_BAR) &&
811 Marking::IsBlack<kAtomicity>(mark_bit))); 812 Marking::IsBlack<kAtomicity>(mark_bit)));
812 #endif 813 #endif
813 ObjectMarking::GreyToBlack<kAtomicity>(obj, marking_state(obj)); 814 if (ObjectMarking::GreyToBlack<kAtomicity>(obj, marking_state(obj))) {
Michael Lippautz 2017/05/03 07:51:49 GreyToWhite? Otherwise WhiteToGreyAndPush will be
ulan 2017/05/03 09:03:54 WhiteToGreyAndPush applies to the map. The object
Michael Lippautz 2017/05/03 10:05:39 Thanks :)
815 WhiteToGreyAndPush(map);
816 IncrementalMarkingMarkingVisitor::IterateBody(map, obj);
817 } else if (IsFixedArrayWithProgressBar(obj)) {
818 DCHECK(ObjectMarking::IsBlack<kAtomicity>(obj, marking_state(obj)));
819 IncrementalMarkingMarkingVisitor::VisitFixedArrayIncremental(map, obj);
820 }
814 } 821 }
815 822
816 intptr_t IncrementalMarking::ProcessMarkingDeque( 823 intptr_t IncrementalMarking::ProcessMarkingDeque(
817 intptr_t bytes_to_process, ForceCompletionAction completion) { 824 intptr_t bytes_to_process, ForceCompletionAction completion) {
818 intptr_t bytes_processed = 0; 825 intptr_t bytes_processed = 0;
819 while (!marking_deque()->IsEmpty() && (bytes_processed < bytes_to_process || 826 while (!marking_deque()->IsEmpty() && (bytes_processed < bytes_to_process ||
820 completion == FORCE_COMPLETION)) { 827 completion == FORCE_COMPLETION)) {
821 HeapObject* obj = marking_deque()->Pop(); 828 HeapObject* obj = marking_deque()->Pop();
822 829
823 // Left trimming may result in white, grey, or black filler objects on the 830 // Left trimming may result in white, grey, or black filler objects on the
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after
1154 idle_marking_delay_counter_++; 1161 idle_marking_delay_counter_++;
1155 } 1162 }
1156 1163
1157 1164
1158 void IncrementalMarking::ClearIdleMarkingDelayCounter() { 1165 void IncrementalMarking::ClearIdleMarkingDelayCounter() {
1159 idle_marking_delay_counter_ = 0; 1166 idle_marking_delay_counter_ = 0;
1160 } 1167 }
1161 1168
1162 } // namespace internal 1169 } // namespace internal
1163 } // namespace v8 1170 } // namespace v8
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