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

Side by Side Diff: test/cctest/heap/heap-utils.cc

Issue 2304123003: [heap] Refactor incremental marking step. (Closed)
Patch Set: another fix of the test Created 4 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/spaces.cc ('k') | test/cctest/heap/test-heap.cc » ('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 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 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 "test/cctest/heap/heap-utils.h" 5 #include "test/cctest/heap/heap-utils.h"
6 6
7 #include "src/factory.h" 7 #include "src/factory.h"
8 #include "src/heap/heap-inl.h" 8 #include "src/heap/heap-inl.h"
9 #include "src/heap/incremental-marking.h" 9 #include "src/heap/incremental-marking.h"
10 #include "src/heap/mark-compact.h" 10 #include "src/heap/mark-compact.h"
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 } 134 }
135 135
136 void SimulateFullSpace(v8::internal::NewSpace* space, 136 void SimulateFullSpace(v8::internal::NewSpace* space,
137 std::vector<Handle<FixedArray>>* out_handles) { 137 std::vector<Handle<FixedArray>>* out_handles) {
138 heap::FillCurrentPage(space, out_handles); 138 heap::FillCurrentPage(space, out_handles);
139 while (heap::FillUpOnePage(space, out_handles) || space->AddFreshPage()) { 139 while (heap::FillUpOnePage(space, out_handles) || space->AddFreshPage()) {
140 } 140 }
141 } 141 }
142 142
143 void SimulateIncrementalMarking(i::Heap* heap, bool force_completion) { 143 void SimulateIncrementalMarking(i::Heap* heap, bool force_completion) {
144 i::IncrementalMarking* marking = heap->incremental_marking();
144 i::MarkCompactCollector* collector = heap->mark_compact_collector(); 145 i::MarkCompactCollector* collector = heap->mark_compact_collector();
145 i::IncrementalMarking* marking = heap->incremental_marking();
146 if (collector->sweeping_in_progress()) { 146 if (collector->sweeping_in_progress()) {
147 collector->EnsureSweepingCompleted(); 147 collector->EnsureSweepingCompleted();
148 } 148 }
149 CHECK(marking->IsMarking() || marking->IsStopped()); 149 if (marking->IsSweeping()) {
150 marking->FinalizeSweeping();
151 }
152 CHECK(marking->IsMarking() || marking->IsStopped() || marking->IsComplete());
150 if (marking->IsStopped()) { 153 if (marking->IsStopped()) {
151 heap->StartIncrementalMarking(); 154 heap->StartIncrementalMarking();
152 } 155 }
153 CHECK(marking->IsMarking()); 156 CHECK(marking->IsMarking() || marking->IsComplete());
154 if (!force_completion) return; 157 if (!force_completion) return;
155 158
156 while (!marking->IsComplete()) { 159 while (!marking->IsComplete()) {
157 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD); 160 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD,
161 i::IncrementalMarking::FORCE_COMPLETION);
158 if (marking->IsReadyToOverApproximateWeakClosure()) { 162 if (marking->IsReadyToOverApproximateWeakClosure()) {
159 marking->FinalizeIncrementally(); 163 marking->FinalizeIncrementally();
160 } 164 }
161 } 165 }
162 CHECK(marking->IsComplete()); 166 CHECK(marking->IsComplete());
163 } 167 }
164 168
165 void SimulateFullSpace(v8::internal::PagedSpace* space) { 169 void SimulateFullSpace(v8::internal::PagedSpace* space) {
166 space->EmptyAllocationInfo(); 170 space->EmptyAllocationInfo();
167 space->ResetFreeList(); 171 space->ResetFreeList();
(...skipping 10 matching lines...) Expand all
178 void GcAndSweep(Heap* heap, AllocationSpace space) { 182 void GcAndSweep(Heap* heap, AllocationSpace space) {
179 heap->CollectGarbage(space); 183 heap->CollectGarbage(space);
180 if (heap->mark_compact_collector()->sweeping_in_progress()) { 184 if (heap->mark_compact_collector()->sweeping_in_progress()) {
181 heap->mark_compact_collector()->EnsureSweepingCompleted(); 185 heap->mark_compact_collector()->EnsureSweepingCompleted();
182 } 186 }
183 } 187 }
184 188
185 } // namespace heap 189 } // namespace heap
186 } // namespace internal 190 } // namespace internal
187 } // namespace v8 191 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.cc ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698