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

Side by Side Diff: test/unittests/interpreter/bytecodes-unittest.cc

Issue 1894063002: [Interpreter] Remove register file register and replace with LoadParentFramePointer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix gcc 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
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 #include <vector> 5 #include <vector>
6 6
7 #include "src/v8.h" 7 #include "src/v8.h"
8 8
9 #include "src/interpreter/bytecodes.h" 9 #include "src/interpreter/bytecodes.h"
10 #include "test/unittests/test-utils.h" 10 #include "test/unittests/test-utils.h"
(...skipping 13 matching lines...) Expand all
24 } 24 }
25 25
26 uint32_t operand1 = Register(i).ToOperand(); 26 uint32_t operand1 = Register(i).ToOperand();
27 Register reg1 = Register::FromOperand(operand1); 27 Register reg1 = Register::FromOperand(operand1);
28 CHECK_EQ(i, reg1.index()); 28 CHECK_EQ(i, reg1.index());
29 29
30 uint32_t operand2 = Register(i).ToOperand(); 30 uint32_t operand2 = Register(i).ToOperand();
31 Register reg2 = Register::FromOperand(operand2); 31 Register reg2 = Register::FromOperand(operand2);
32 CHECK_EQ(i, reg2.index()); 32 CHECK_EQ(i, reg2.index());
33 } 33 }
34
35 for (int i = 0; i <= kMaxUInt8; i++) {
36 Register reg = Register::FromOperand(i);
37 if (i > 0) {
38 CHECK(reg.is_parameter());
39 } else {
40 CHECK(!reg.is_parameter());
41 }
42 }
43 } 34 }
44 35
45 TEST(OperandConversion, Parameters) { 36 TEST(OperandConversion, Parameters) {
46 int parameter_counts[] = {7, 13, 99}; 37 int parameter_counts[] = {7, 13, 99};
47 38
48 size_t count = sizeof(parameter_counts) / sizeof(parameter_counts[0]); 39 size_t count = sizeof(parameter_counts) / sizeof(parameter_counts[0]);
49 for (size_t p = 0; p < count; p++) { 40 for (size_t p = 0; p < count; p++) {
50 int parameter_count = parameter_counts[p]; 41 int parameter_count = parameter_counts[p];
51 for (int i = 0; i < parameter_count; i++) { 42 for (int i = 0; i < parameter_count; i++) {
52 Register r = Register::FromParameterIndex(i, parameter_count); 43 Register r = Register::FromParameterIndex(i, parameter_count);
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
193 {{B(ExtraWide), B(LdaSmi), 0xa0, 0x86, 0x01, 0x00}, 184 {{B(ExtraWide), B(LdaSmi), 0xa0, 0x86, 0x01, 0x00},
194 6, 185 6,
195 0, 186 0,
196 "LdaSmi.ExtraWide [100000]"}, 187 "LdaSmi.ExtraWide [100000]"},
197 {{B(LdaSmi), 0xff}, 2, 0, " LdaSmi [-1]"}, 188 {{B(LdaSmi), 0xff}, 2, 0, " LdaSmi [-1]"},
198 {{B(Wide), B(LdaSmi), 0x18, 0xfc}, 4, 0, " LdaSmi.Wide [-1000]"}, 189 {{B(Wide), B(LdaSmi), 0x18, 0xfc}, 4, 0, " LdaSmi.Wide [-1000]"},
199 {{B(ExtraWide), B(LdaSmi), 0x60, 0x79, 0xfe, 0xff}, 190 {{B(ExtraWide), B(LdaSmi), 0x60, 0x79, 0xfe, 0xff},
200 6, 191 6,
201 0, 192 0,
202 "LdaSmi.ExtraWide [-100000]"}, 193 "LdaSmi.ExtraWide [-100000]"},
203 {{B(Star), 0xfb}, 2, 0, " Star r5"}, 194 {{B(Star), 0xf5}, 2, 0, " Star r5"},
204 {{B(Wide), B(Star), 0x78, 0xff}, 4, 0, " Star.Wide r136"}, 195 {{B(Wide), B(Star), 0x72, 0xff}, 4, 0, " Star.Wide r136"},
205 {{B(Wide), B(Call), 0x7a, 0xff, 0x79, 0xff, 0x02, 0x00, 0xb1, 0x00}, 196 {{B(Wide), B(Call), 0x74, 0xff, 0x73, 0xff, 0x02, 0x00, 0xb1, 0x00},
206 10, 197 10,
207 0, 198 0,
208 "Call.Wide r134, r135, #2, [177]"}, 199 "Call.Wide r134, r135, #2, [177]"},
209 {{B(Ldar), 200 {{B(Ldar),
210 static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())}, 201 static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())},
211 2, 202 2,
212 3, 203 3,
213 " Ldar a1"}, 204 " Ldar a1"},
214 {{B(Wide), B(CreateObjectLiteral), 0x01, 0x02, 0x03, 0x04, 0xa5}, 205 {{B(Wide), B(CreateObjectLiteral), 0x01, 0x02, 0x03, 0x04, 0xa5},
215 7, 206 7,
216 0, 207 0,
217 "CreateObjectLiteral.Wide [513], [1027], #165"}, 208 "CreateObjectLiteral.Wide [513], [1027], #165"},
218 {{B(ExtraWide), B(JumpIfNull), 0x15, 0xcd, 0x5b, 0x07}, 209 {{B(ExtraWide), B(JumpIfNull), 0x15, 0xcd, 0x5b, 0x07},
219 6, 210 6,
220 0, 211 0,
221 "JumpIfNull.ExtraWide [123456789]"}, 212 "JumpIfNull.ExtraWide [123456789]"},
222 #elif V8_TARGET_BIG_ENDIAN 213 #elif V8_TARGET_BIG_ENDIAN
223 {{B(LdaSmi), 0x01}, 2, 0, " LdaSmi [1]"}, 214 {{B(LdaSmi), 0x01}, 2, 0, " LdaSmi [1]"},
224 {{B(Wide), B(LdaSmi), 0x03, 0xe8}, 4, 0, " LdaSmi.Wide [1000]"}, 215 {{B(Wide), B(LdaSmi), 0x03, 0xe8}, 4, 0, " LdaSmi.Wide [1000]"},
225 {{B(ExtraWide), B(LdaSmi), 0x00, 0x01, 0x86, 0xa0}, 216 {{B(ExtraWide), B(LdaSmi), 0x00, 0x01, 0x86, 0xa0},
226 6, 217 6,
227 0, 218 0,
228 "LdaSmi.ExtraWide [100000]"}, 219 "LdaSmi.ExtraWide [100000]"},
229 {{B(LdaSmi), 0xff}, 2, 0, " LdaSmi [-1]"}, 220 {{B(LdaSmi), 0xff}, 2, 0, " LdaSmi [-1]"},
230 {{B(Wide), B(LdaSmi), 0xfc, 0x18}, 4, 0, " LdaSmi.Wide [-1000]"}, 221 {{B(Wide), B(LdaSmi), 0xfc, 0x18}, 4, 0, " LdaSmi.Wide [-1000]"},
231 {{B(ExtraWide), B(LdaSmi), 0xff, 0xfe, 0x79, 0x60}, 222 {{B(ExtraWide), B(LdaSmi), 0xff, 0xfe, 0x79, 0x60},
232 6, 223 6,
233 0, 224 0,
234 "LdaSmi.ExtraWide [-100000]"}, 225 "LdaSmi.ExtraWide [-100000]"},
235 {{B(Star), 0xfb}, 2, 0, " Star r5"}, 226 {{B(Star), 0xf5}, 2, 0, " Star r5"},
236 {{B(Wide), B(Star), 0xff, 0x78}, 4, 0, " Star.Wide r136"}, 227 {{B(Wide), B(Star), 0xff, 0x72}, 4, 0, " Star.Wide r136"},
237 {{B(Wide), B(Call), 0xff, 0x7a, 0xff, 0x79, 0x00, 0x02, 0x00, 0xb1}, 228 {{B(Wide), B(Call), 0xff, 0x74, 0xff, 0x73, 0x00, 0x02, 0x00, 0xb1},
238 10, 229 10,
239 0, 230 0,
240 "Call.Wide r134, r135, #2, [177]"}, 231 "Call.Wide r134, r135, #2, [177]"},
241 {{B(Ldar), 232 {{B(Ldar),
242 static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())}, 233 static_cast<uint8_t>(Register::FromParameterIndex(2, 3).ToOperand())},
243 2, 234 2,
244 3, 235 3,
245 " Ldar a1"}, 236 " Ldar a1"},
246 {{B(Wide), B(CreateObjectLiteral), 0x02, 0x01, 0x04, 0x03, 0xa5}, 237 {{B(Wide), B(CreateObjectLiteral), 0x02, 0x01, 0x04, 0x03, 0xa5},
247 7, 238 7,
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kNone)); 338 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kNone));
348 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kRead)); 339 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kRead));
349 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kWrite)); 340 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kWrite));
350 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kReadWrite)); 341 names.insert(Bytecodes::AccumulatorUseToString(AccumulatorUse::kReadWrite));
351 CHECK_EQ(names.size(), 4); 342 CHECK_EQ(names.size(), 4);
352 } 343 }
353 344
354 } // namespace interpreter 345 } // namespace interpreter
355 } // namespace internal 346 } // namespace internal
356 } // namespace v8 347 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698