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

Side by Side Diff: test/unittests/interpreter/bytecode-register-allocator-unittest.cc

Issue 1783483002: [interpreter] Add support for scalable operands. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Re-generate golden files. Created 4 years, 9 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
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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 "src/v8.h" 5 #include "src/v8.h"
6 6
7 #include "src/interpreter/bytecode-array-builder.h" 7 #include "src/interpreter/bytecode-array-builder.h"
8 #include "src/interpreter/bytecode-register-allocator.h" 8 #include "src/interpreter/bytecode-register-allocator.h"
9 #include "test/unittests/test-utils.h" 9 #include "test/unittests/test-utils.h"
10 10
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 133
134 int start = allocator()->PrepareForConsecutiveTemporaryRegisters(kRunLength); 134 int start = allocator()->PrepareForConsecutiveTemporaryRegisters(kRunLength);
135 CHECK_EQ(start, kNotRunLength); 135 CHECK_EQ(start, kNotRunLength);
136 for (int i = 0; i < kRunLength; i++) { 136 for (int i = 0; i < kRunLength; i++) {
137 CHECK(!allocator()->RegisterIsLive(Register(start + i))); 137 CHECK(!allocator()->RegisterIsLive(Register(start + i)));
138 allocator()->BorrowConsecutiveTemporaryRegister(start + i); 138 allocator()->BorrowConsecutiveTemporaryRegister(start + i);
139 CHECK(allocator()->RegisterIsLive(Register(start + i))); 139 CHECK(allocator()->RegisterIsLive(Register(start + i)));
140 } 140 }
141 } 141 }
142 142
143 TEST_F(TemporaryRegisterAllocatorTest, RangeAvoidsTranslationBoundary) {
144 int boundary = RegisterTranslator::DistanceToTranslationWindow(Register(0));
145 int limit = boundary + 64;
146
147 for (int run_length = 2; run_length < 32; run_length += 7) {
148 ZoneVector<int> run_starts(zone());
149 for (int start = 0; start < limit; start += run_length) {
150 int run_start =
151 allocator()->PrepareForConsecutiveTemporaryRegisters(run_length);
152 run_starts.push_back(run_start);
153 for (int i = 0; i < run_length; i++) {
154 allocator()->BorrowConsecutiveTemporaryRegister(run_start + i);
155 }
156 CHECK(run_start >= boundary || run_start + run_length <= boundary);
157 }
158 for (size_t batch = 0; batch < run_starts.size(); batch++) {
159 for (int i = run_starts[batch]; i < run_starts[batch] + run_length; i++) {
160 allocator()->ReturnTemporaryRegister(i);
161 }
162 }
163 }
164 }
165
166 TEST_F(TemporaryRegisterAllocatorTest, NotInRange) { 143 TEST_F(TemporaryRegisterAllocatorTest, NotInRange) {
167 for (int i = 0; i < 10; i++) { 144 for (int i = 0; i < 10; i++) {
168 int reg = allocator()->BorrowTemporaryRegisterNotInRange(2, 5); 145 int reg = allocator()->BorrowTemporaryRegisterNotInRange(2, 5);
169 CHECK(reg == i || (reg > 2 && reg == i + 4)); 146 CHECK(reg == i || (reg > 2 && reg == i + 4));
170 } 147 }
171 for (int i = 0; i < 10; i++) { 148 for (int i = 0; i < 10; i++) {
172 if (i < 2) { 149 if (i < 2) {
173 allocator()->ReturnTemporaryRegister(i); 150 allocator()->ReturnTemporaryRegister(i);
174 } else { 151 } else {
175 allocator()->ReturnTemporaryRegister(i + 4); 152 allocator()->ReturnTemporaryRegister(i + 4);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 Register reg2 = allocator.NextConsecutiveRegister(); 203 Register reg2 = allocator.NextConsecutiveRegister();
227 Register reg3 = allocator.NextConsecutiveRegister(); 204 Register reg3 = allocator.NextConsecutiveRegister();
228 USE(other); 205 USE(other);
229 206
230 CHECK(Register::AreContiguous(reg0, reg1, reg2, reg3)); 207 CHECK(Register::AreContiguous(reg0, reg1, reg2, reg3));
231 } 208 }
232 209
233 } // namespace interpreter 210 } // namespace interpreter
234 } // namespace internal 211 } // namespace internal
235 } // namespace v8 212 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/interpreter/bytecode-array-iterator-unittest.cc ('k') | test/unittests/interpreter/bytecodes-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698