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

Side by Side Diff: test/unittests/interpreter/bytecode-array-iterator-unittest.cc

Issue 2384123002: [Interpreter] Use RegisterList for kRegTriple and kRegPair operands. (Closed)
Patch Set: Rebase Created 4 years, 2 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/unittests/interpreter/bytecode-array-builder-unittest.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 #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-array-iterator.h" 8 #include "src/interpreter/bytecode-array-iterator.h"
9 #include "test/unittests/test-utils.h" 9 #include "test/unittests/test-utils.h"
10 10
(...skipping 13 matching lines...) Expand all
24 // with 0, 1 and 2 operands. 24 // with 0, 1 and 2 operands.
25 BytecodeArrayBuilder builder(isolate(), zone(), 3, 3, 0); 25 BytecodeArrayBuilder builder(isolate(), zone(), 3, 3, 0);
26 Factory* factory = isolate()->factory(); 26 Factory* factory = isolate()->factory();
27 Handle<HeapObject> heap_num_0 = factory->NewHeapNumber(2.718); 27 Handle<HeapObject> heap_num_0 = factory->NewHeapNumber(2.718);
28 Handle<HeapObject> heap_num_1 = factory->NewHeapNumber(2147483647); 28 Handle<HeapObject> heap_num_1 = factory->NewHeapNumber(2147483647);
29 Smi* zero = Smi::FromInt(0); 29 Smi* zero = Smi::FromInt(0);
30 Smi* smi_0 = Smi::FromInt(64); 30 Smi* smi_0 = Smi::FromInt(64);
31 Smi* smi_1 = Smi::FromInt(-65536); 31 Smi* smi_1 = Smi::FromInt(-65536);
32 Register reg_0(0); 32 Register reg_0(0);
33 Register reg_1(1); 33 Register reg_1(1);
34 RegisterList pair(0, 2);
35 RegisterList triple(0, 3);
34 Register param = Register::FromParameterIndex(2, builder.parameter_count()); 36 Register param = Register::FromParameterIndex(2, builder.parameter_count());
35 Handle<String> name = factory->NewStringFromStaticChars("abc"); 37 Handle<String> name = factory->NewStringFromStaticChars("abc");
36 int name_index = 2; 38 int name_index = 2;
37 int feedback_slot = 97; 39 int feedback_slot = 97;
38 40
39 builder.LoadLiteral(heap_num_0) 41 builder.LoadLiteral(heap_num_0)
40 .StoreAccumulatorInRegister(reg_0) 42 .StoreAccumulatorInRegister(reg_0)
41 .LoadLiteral(heap_num_1) 43 .LoadLiteral(heap_num_1)
42 .StoreAccumulatorInRegister(reg_0) 44 .StoreAccumulatorInRegister(reg_0)
43 .LoadLiteral(zero) 45 .LoadLiteral(zero)
44 .StoreAccumulatorInRegister(reg_0) 46 .StoreAccumulatorInRegister(reg_0)
45 .LoadLiteral(smi_0) 47 .LoadLiteral(smi_0)
46 .StackCheck(0) 48 .StackCheck(0)
47 .StoreAccumulatorInRegister(reg_0) 49 .StoreAccumulatorInRegister(reg_0)
48 .LoadLiteral(smi_1) 50 .LoadLiteral(smi_1)
49 .StackCheck(1) 51 .StackCheck(1)
50 .StoreAccumulatorInRegister(reg_1) 52 .StoreAccumulatorInRegister(reg_1)
51 .LoadAccumulatorWithRegister(reg_0) 53 .LoadAccumulatorWithRegister(reg_0)
52 .BinaryOperation(Token::Value::ADD, reg_0, 2) 54 .BinaryOperation(Token::Value::ADD, reg_0, 2)
53 .StoreAccumulatorInRegister(reg_1) 55 .StoreAccumulatorInRegister(reg_1)
54 .LoadNamedProperty(reg_1, name, feedback_slot) 56 .LoadNamedProperty(reg_1, name, feedback_slot)
55 .BinaryOperation(Token::Value::ADD, reg_0, 3) 57 .BinaryOperation(Token::Value::ADD, reg_0, 3)
56 .StoreAccumulatorInRegister(param) 58 .StoreAccumulatorInRegister(param)
57 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, reg_0) 59 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, pair)
58 .ForInPrepare(reg_0, reg_0) 60 .ForInPrepare(reg_0, triple)
59 .CallRuntime(Runtime::kLoadIC_Miss, reg_0) 61 .CallRuntime(Runtime::kLoadIC_Miss, reg_0)
60 .Debugger() 62 .Debugger()
61 .LoadGlobal(0x10000000, TypeofMode::NOT_INSIDE_TYPEOF) 63 .LoadGlobal(0x10000000, TypeofMode::NOT_INSIDE_TYPEOF)
62 .Return(); 64 .Return();
63 65
64 // Test iterator sees the expected output from the builder. 66 // Test iterator sees the expected output from the builder.
65 BytecodeArrayIterator iterator(builder.ToBytecodeArray(isolate())); 67 BytecodeArrayIterator iterator(builder.ToBytecodeArray(isolate()));
66 const int kPrefixByteSize = 1; 68 const int kPrefixByteSize = 1;
67 int offset = 0; 69 int offset = 0;
68 70
(...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 CHECK_EQ(iterator.current_offset(), offset); 278 CHECK_EQ(iterator.current_offset(), offset);
277 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); 279 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle);
278 CHECK(!iterator.done()); 280 CHECK(!iterator.done());
279 iterator.Advance(); 281 iterator.Advance();
280 CHECK(iterator.done()); 282 CHECK(iterator.done());
281 } 283 }
282 284
283 } // namespace interpreter 285 } // namespace interpreter
284 } // namespace internal 286 } // namespace internal
285 } // namespace v8 287 } // namespace v8
OLDNEW
« no previous file with comments | « test/unittests/interpreter/bytecode-array-builder-unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698