| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, | 163 marking->Step(i::MB, i::IncrementalMarking::NO_GC_VIA_STACK_GUARD, |
| 164 i::IncrementalMarking::FORCE_COMPLETION, i::StepOrigin::kV8); | 164 i::IncrementalMarking::FORCE_COMPLETION, i::StepOrigin::kV8); |
| 165 if (marking->IsReadyToOverApproximateWeakClosure()) { | 165 if (marking->IsReadyToOverApproximateWeakClosure()) { |
| 166 marking->FinalizeIncrementally(); | 166 marking->FinalizeIncrementally(); |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 CHECK(marking->IsComplete()); | 169 CHECK(marking->IsComplete()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 void SimulateFullSpace(v8::internal::PagedSpace* space) { | 172 void SimulateFullSpace(v8::internal::PagedSpace* space) { |
| 173 i::MarkCompactCollector* collector = space->heap()->mark_compact_collector(); |
| 174 if (collector->sweeping_in_progress()) { |
| 175 collector->EnsureSweepingCompleted(); |
| 176 } |
| 173 space->EmptyAllocationInfo(); | 177 space->EmptyAllocationInfo(); |
| 174 space->ResetFreeList(); | 178 space->ResetFreeList(); |
| 175 space->ClearStats(); | 179 space->ClearStats(); |
| 176 } | 180 } |
| 177 | 181 |
| 178 void AbandonCurrentlyFreeMemory(PagedSpace* space) { | 182 void AbandonCurrentlyFreeMemory(PagedSpace* space) { |
| 179 space->EmptyAllocationInfo(); | 183 space->EmptyAllocationInfo(); |
| 180 for (Page* page : *space) { | 184 for (Page* page : *space) { |
| 181 page->MarkNeverAllocateForTesting(); | 185 page->MarkNeverAllocateForTesting(); |
| 182 } | 186 } |
| 183 } | 187 } |
| 184 | 188 |
| 185 void GcAndSweep(Heap* heap, AllocationSpace space) { | 189 void GcAndSweep(Heap* heap, AllocationSpace space) { |
| 186 heap->CollectGarbage(space, GarbageCollectionReason::kTesting); | 190 heap->CollectGarbage(space, GarbageCollectionReason::kTesting); |
| 187 if (heap->mark_compact_collector()->sweeping_in_progress()) { | 191 if (heap->mark_compact_collector()->sweeping_in_progress()) { |
| 188 heap->mark_compact_collector()->EnsureSweepingCompleted(); | 192 heap->mark_compact_collector()->EnsureSweepingCompleted(); |
| 189 } | 193 } |
| 190 } | 194 } |
| 191 | 195 |
| 192 } // namespace heap | 196 } // namespace heap |
| 193 } // namespace internal | 197 } // namespace internal |
| 194 } // namespace v8 | 198 } // namespace v8 |
| OLD | NEW |