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

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

Issue 2278653003: Reland of "[heap] Switch to 500k pages" (Closed)
Patch Set: Rebase 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 | « test/cctest/heap/heap-utils.h ('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 10 matching lines...) Expand all
21 heap->old_space()->EmptyAllocationInfo(); 21 heap->old_space()->EmptyAllocationInfo();
22 for (Page* page : *heap->old_space()) { 22 for (Page* page : *heap->old_space()) {
23 page->MarkNeverAllocateForTesting(); 23 page->MarkNeverAllocateForTesting();
24 } 24 }
25 } 25 }
26 26
27 int FixedArrayLenFromSize(int size) { 27 int FixedArrayLenFromSize(int size) {
28 return (size - FixedArray::kHeaderSize) / kPointerSize; 28 return (size - FixedArray::kHeaderSize) / kPointerSize;
29 } 29 }
30 30
31 std::vector<Handle<FixedArray>> FillOldSpacePageWithFixedArrays(Heap* heap,
32 int remainder) {
33 std::vector<Handle<FixedArray>> handles;
34 Isolate* isolate = heap->isolate();
35 const int kArraySize = 128;
36 const int kArrayLen = heap::FixedArrayLenFromSize(kArraySize);
37 CHECK_EQ(Page::kAllocatableMemory % kArraySize, 0);
38 Handle<FixedArray> array;
39 for (size_t allocated = 0;
40 allocated != (Page::kAllocatableMemory - remainder);
41 allocated += array->Size()) {
42 if (allocated == (Page::kAllocatableMemory - kArraySize)) {
43 array = isolate->factory()->NewFixedArray(
44 heap::FixedArrayLenFromSize(kArraySize - remainder), TENURED);
45 CHECK_EQ(kArraySize - remainder, array->Size());
46 } else {
47 array = isolate->factory()->NewFixedArray(kArrayLen, TENURED);
48 CHECK_EQ(kArraySize, array->Size());
49 }
50 if (handles.empty()) {
51 // Check that allocations started on a new page.
52 CHECK_EQ(array->address(),
53 Page::FromAddress(array->address())->area_start());
54 }
55 handles.push_back(array);
56 }
57 return handles;
58 }
59
31 std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size, 60 std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size,
32 PretenureFlag tenure, 61 PretenureFlag tenure,
33 int object_size) { 62 int object_size) {
34 std::vector<Handle<FixedArray>> handles; 63 std::vector<Handle<FixedArray>> handles;
35 Isolate* isolate = heap->isolate(); 64 Isolate* isolate = heap->isolate();
36 int allocate_memory; 65 int allocate_memory;
37 int length; 66 int length;
38 int free_memory = padding_size; 67 int free_memory = padding_size;
39 if (tenure == i::TENURED) { 68 if (tenure == i::TENURED) {
40 heap->old_space()->EmptyAllocationInfo(); 69 heap->old_space()->EmptyAllocationInfo();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
149 void GcAndSweep(Heap* heap, AllocationSpace space) { 178 void GcAndSweep(Heap* heap, AllocationSpace space) {
150 heap->CollectGarbage(space); 179 heap->CollectGarbage(space);
151 if (heap->mark_compact_collector()->sweeping_in_progress()) { 180 if (heap->mark_compact_collector()->sweeping_in_progress()) {
152 heap->mark_compact_collector()->EnsureSweepingCompleted(); 181 heap->mark_compact_collector()->EnsureSweepingCompleted();
153 } 182 }
154 } 183 }
155 184
156 } // namespace heap 185 } // namespace heap
157 } // namespace internal 186 } // namespace internal
158 } // namespace v8 187 } // namespace v8
OLDNEW
« no previous file with comments | « test/cctest/heap/heap-utils.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698