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

Side by Side Diff: test/cctest/heap/utils-inl.h

Issue 1896883003: Revert of 🏄 [heap] Add page evacuation mode for new->old (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 8 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/test-heap.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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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 #ifndef HEAP_UTILS_H_ 5 #ifndef HEAP_UTILS_H_
6 #define HEAP_UTILS_H_ 6 #define HEAP_UTILS_H_
7 7
8 #include "src/factory.h" 8 #include "src/factory.h"
9 #include "src/heap/heap-inl.h" 9 #include "src/heap/heap-inl.h"
10 #include "src/heap/incremental-marking.h" 10 #include "src/heap/incremental-marking.h"
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 handles.push_back(isolate->factory()->NewFixedArray(length, tenure)); 56 handles.push_back(isolate->factory()->NewFixedArray(length, tenure));
57 CHECK((tenure == NOT_TENURED && heap->InNewSpace(*handles.back())) || 57 CHECK((tenure == NOT_TENURED && heap->InNewSpace(*handles.back())) ||
58 (tenure == TENURED && heap->InOldSpace(*handles.back()))); 58 (tenure == TENURED && heap->InOldSpace(*handles.back())));
59 free_memory -= allocate_memory; 59 free_memory -= allocate_memory;
60 } 60 }
61 return handles; 61 return handles;
62 } 62 }
63 63
64 64
65 // Helper function that simulates a full new-space in the heap. 65 // Helper function that simulates a full new-space in the heap.
66 static inline bool FillUpOnePage( 66 static inline bool FillUpOnePage(v8::internal::NewSpace* space) {
67 v8::internal::NewSpace* space,
68 std::vector<Handle<FixedArray>>* out_handles = nullptr) {
69 space->DisableInlineAllocationSteps(); 67 space->DisableInlineAllocationSteps();
70 int space_remaining = static_cast<int>(*space->allocation_limit_address() - 68 int space_remaining = static_cast<int>(*space->allocation_limit_address() -
71 *space->allocation_top_address()); 69 *space->allocation_top_address());
72 if (space_remaining == 0) return false; 70 if (space_remaining == 0) return false;
73 std::vector<Handle<FixedArray>> handles = 71 CreatePadding(space->heap(), space_remaining, i::NOT_TENURED);
74 CreatePadding(space->heap(), space_remaining, i::NOT_TENURED);
75 if (out_handles != nullptr)
76 out_handles->insert(out_handles->end(), handles.begin(), handles.end());
77 return true; 72 return true;
78 } 73 }
79 74
80 75
81 // Helper function that simulates a fill new-space in the heap. 76 // Helper function that simulates a fill new-space in the heap.
82 static inline void AllocateAllButNBytes( 77 static inline void AllocateAllButNBytes(v8::internal::NewSpace* space,
83 v8::internal::NewSpace* space, int extra_bytes, 78 int extra_bytes) {
84 std::vector<Handle<FixedArray>>* out_handles = nullptr) {
85 space->DisableInlineAllocationSteps(); 79 space->DisableInlineAllocationSteps();
86 int space_remaining = static_cast<int>(*space->allocation_limit_address() - 80 int space_remaining = static_cast<int>(*space->allocation_limit_address() -
87 *space->allocation_top_address()); 81 *space->allocation_top_address());
88 CHECK(space_remaining >= extra_bytes); 82 CHECK(space_remaining >= extra_bytes);
89 int new_linear_size = space_remaining - extra_bytes; 83 int new_linear_size = space_remaining - extra_bytes;
90 if (new_linear_size == 0) return; 84 if (new_linear_size == 0) return;
91 std::vector<Handle<FixedArray>> handles = 85 CreatePadding(space->heap(), new_linear_size, i::NOT_TENURED);
92 CreatePadding(space->heap(), new_linear_size, i::NOT_TENURED);
93 if (out_handles != nullptr)
94 out_handles->insert(out_handles->end(), handles.begin(), handles.end());
95 } 86 }
96 87
97 static inline void FillCurrentPage( 88
98 v8::internal::NewSpace* space, 89 static inline void FillCurrentPage(v8::internal::NewSpace* space) {
99 std::vector<Handle<FixedArray>>* out_handles = nullptr) { 90 AllocateAllButNBytes(space, 0);
100 AllocateAllButNBytes(space, 0, out_handles);
101 } 91 }
102 92
103 static inline void SimulateFullSpace( 93
104 v8::internal::NewSpace* space, 94 static inline void SimulateFullSpace(v8::internal::NewSpace* space) {
105 std::vector<Handle<FixedArray>>* out_handles = nullptr) { 95 FillCurrentPage(space);
106 FillCurrentPage(space, out_handles); 96 while (FillUpOnePage(space)) {
107 while (FillUpOnePage(space, out_handles) || space->AddFreshPage()) {
108 } 97 }
109 } 98 }
110 99
111 100
112 // Helper function that simulates a full old-space in the heap. 101 // Helper function that simulates a full old-space in the heap.
113 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) { 102 static inline void SimulateFullSpace(v8::internal::PagedSpace* space) {
114 space->EmptyAllocationInfo(); 103 space->EmptyAllocationInfo();
115 space->ResetFreeList(); 104 space->ResetFreeList();
116 space->ClearStats(); 105 space->ClearStats();
117 } 106 }
(...skipping 21 matching lines...) Expand all
139 marking->FinalizeIncrementally(); 128 marking->FinalizeIncrementally();
140 } 129 }
141 } 130 }
142 CHECK(marking->IsComplete()); 131 CHECK(marking->IsComplete());
143 } 132 }
144 133
145 } // namespace internal 134 } // namespace internal
146 } // namespace v8 135 } // namespace v8
147 136
148 #endif // HEAP_UTILS_H_ 137 #endif // HEAP_UTILS_H_
OLDNEW
« no previous file with comments | « test/cctest/heap/test-heap.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698