OLD | NEW |
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 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 } | 186 } |
187 } | 187 } |
188 | 188 |
189 void GcAndSweep(Heap* heap, AllocationSpace space) { | 189 void GcAndSweep(Heap* heap, AllocationSpace space) { |
190 heap->CollectGarbage(space, GarbageCollectionReason::kTesting); | 190 heap->CollectGarbage(space, GarbageCollectionReason::kTesting); |
191 if (heap->mark_compact_collector()->sweeping_in_progress()) { | 191 if (heap->mark_compact_collector()->sweeping_in_progress()) { |
192 heap->mark_compact_collector()->EnsureSweepingCompleted(); | 192 heap->mark_compact_collector()->EnsureSweepingCompleted(); |
193 } | 193 } |
194 } | 194 } |
195 | 195 |
| 196 void ForceEvacuationCandidate(Page* page) { |
| 197 CHECK(FLAG_manual_evacuation_candidates_selection); |
| 198 page->SetFlag(MemoryChunk::FORCE_EVACUATION_CANDIDATE_FOR_TESTING); |
| 199 PagedSpace* space = static_cast<PagedSpace*>(page->owner()); |
| 200 Address top = space->top(); |
| 201 Address limit = space->limit(); |
| 202 if (top < limit && Page::FromAllocationAreaAddress(top) == page) { |
| 203 // Create filler object to keep page iterable if it was iterable. |
| 204 int remaining = static_cast<int>(limit - top); |
| 205 space->heap()->CreateFillerObjectAt(top, remaining, |
| 206 ClearRecordedSlots::kNo); |
| 207 space->SetTopAndLimit(nullptr, nullptr); |
| 208 } |
| 209 } |
| 210 |
196 } // namespace heap | 211 } // namespace heap |
197 } // namespace internal | 212 } // namespace internal |
198 } // namespace v8 | 213 } // namespace v8 |
OLD | NEW |