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

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

Issue 2239323002: Revert of "[heap] Switch to 500k pages" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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
60 std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size, 31 std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size,
61 PretenureFlag tenure, 32 PretenureFlag tenure,
62 int object_size) { 33 int object_size) {
63 std::vector<Handle<FixedArray>> handles; 34 std::vector<Handle<FixedArray>> handles;
64 Isolate* isolate = heap->isolate(); 35 Isolate* isolate = heap->isolate();
65 int allocate_memory; 36 int allocate_memory;
66 int length; 37 int length;
67 int free_memory = padding_size; 38 int free_memory = padding_size;
68 if (tenure == i::TENURED) { 39 if (tenure == i::TENURED) {
69 heap->old_space()->EmptyAllocationInfo(); 40 heap->old_space()->EmptyAllocationInfo();
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 void GcAndSweep(Heap* heap, AllocationSpace space) { 149 void GcAndSweep(Heap* heap, AllocationSpace space) {
179 heap->CollectGarbage(space); 150 heap->CollectGarbage(space);
180 if (heap->mark_compact_collector()->sweeping_in_progress()) { 151 if (heap->mark_compact_collector()->sweeping_in_progress()) {
181 heap->mark_compact_collector()->EnsureSweepingCompleted(); 152 heap->mark_compact_collector()->EnsureSweepingCompleted();
182 } 153 }
183 } 154 }
184 155
185 } // namespace heap 156 } // namespace heap
186 } // namespace internal 157 } // namespace internal
187 } // namespace v8 158 } // 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