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

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

Issue 2088223002: [heap] Modernize all *Page iterators to be proper C++ iterators (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Unify w/ LargePageIterator Created 4 years, 6 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/snapshot/deserializer.cc ('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 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"
11 #include "src/isolate.h" 11 #include "src/isolate.h"
12 12
13 namespace v8 { 13 namespace v8 {
14 namespace internal { 14 namespace internal {
15 namespace heap { 15 namespace heap {
16 16
17 void SealCurrentObjects(Heap* heap) { 17 void SealCurrentObjects(Heap* heap) {
18 heap->CollectAllGarbage(); 18 heap->CollectAllGarbage();
19 heap->CollectAllGarbage(); 19 heap->CollectAllGarbage();
20 heap->mark_compact_collector()->EnsureSweepingCompleted(); 20 heap->mark_compact_collector()->EnsureSweepingCompleted();
21 PageIterator it(heap->old_space());
22 heap->old_space()->EmptyAllocationInfo(); 21 heap->old_space()->EmptyAllocationInfo();
23 while (it.has_next()) { 22 for (Page* page : *heap->old_space()) {
24 Page* page = it.next();
25 page->MarkNeverAllocateForTesting(); 23 page->MarkNeverAllocateForTesting();
26 } 24 }
27 } 25 }
28 26
29 int FixedArrayLenFromSize(int size) { 27 int FixedArrayLenFromSize(int size) {
30 return (size - FixedArray::kHeaderSize) / kPointerSize; 28 return (size - FixedArray::kHeaderSize) / kPointerSize;
31 } 29 }
32 30
33 std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size, 31 std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size,
34 PretenureFlag tenure, 32 PretenureFlag tenure,
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
136 } 134 }
137 135
138 void SimulateFullSpace(v8::internal::PagedSpace* space) { 136 void SimulateFullSpace(v8::internal::PagedSpace* space) {
139 space->EmptyAllocationInfo(); 137 space->EmptyAllocationInfo();
140 space->ResetFreeList(); 138 space->ResetFreeList();
141 space->ClearStats(); 139 space->ClearStats();
142 } 140 }
143 141
144 void AbandonCurrentlyFreeMemory(PagedSpace* space) { 142 void AbandonCurrentlyFreeMemory(PagedSpace* space) {
145 space->EmptyAllocationInfo(); 143 space->EmptyAllocationInfo();
146 PageIterator pit(space); 144 for (Page* page : *space) {
147 while (pit.has_next()) { 145 page->MarkNeverAllocateForTesting();
148 pit.next()->MarkNeverAllocateForTesting();
149 } 146 }
150 } 147 }
151 148
152 void GcAndSweep(Heap* heap, AllocationSpace space) { 149 void GcAndSweep(Heap* heap, AllocationSpace space) {
153 heap->CollectGarbage(space); 150 heap->CollectGarbage(space);
154 if (heap->mark_compact_collector()->sweeping_in_progress()) { 151 if (heap->mark_compact_collector()->sweeping_in_progress()) {
155 heap->mark_compact_collector()->EnsureSweepingCompleted(); 152 heap->mark_compact_collector()->EnsureSweepingCompleted();
156 } 153 }
157 } 154 }
158 155
159 } // namespace heap 156 } // namespace heap
160 } // namespace internal 157 } // namespace internal
161 } // namespace v8 158 } // namespace v8
OLDNEW
« no previous file with comments | « src/snapshot/deserializer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698