OLD | NEW |
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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 .StoreAccumulatorInRegister(reg_0) | 42 .StoreAccumulatorInRegister(reg_0) |
43 .LoadLiteral(zero) | 43 .LoadLiteral(zero) |
44 .StoreAccumulatorInRegister(reg_0) | 44 .StoreAccumulatorInRegister(reg_0) |
45 .LoadLiteral(smi_0) | 45 .LoadLiteral(smi_0) |
46 .StoreAccumulatorInRegister(reg_0) | 46 .StoreAccumulatorInRegister(reg_0) |
47 .LoadLiteral(smi_1) | 47 .LoadLiteral(smi_1) |
48 .StoreAccumulatorInRegister(reg_1) | 48 .StoreAccumulatorInRegister(reg_1) |
49 .LoadAccumulatorWithRegister(reg_0) | 49 .LoadAccumulatorWithRegister(reg_0) |
50 .StoreAccumulatorInRegister(reg_1) | 50 .StoreAccumulatorInRegister(reg_1) |
51 .LoadNamedProperty(reg_1, name, feedback_slot) | 51 .LoadNamedProperty(reg_1, name, feedback_slot) |
| 52 .BinaryOperation(Token::Value::ADD, reg_0) |
52 .StoreAccumulatorInRegister(param) | 53 .StoreAccumulatorInRegister(param) |
53 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) | 54 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) |
54 .ForInPrepare(reg_0) | 55 .ForInPrepare(reg_0) |
55 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) | 56 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) |
56 .Debugger() | 57 .Debugger() |
57 .LoadGlobal(name, 0x10000000, TypeofMode::NOT_INSIDE_TYPEOF) | 58 .LoadGlobal(name, 0x10000000, TypeofMode::NOT_INSIDE_TYPEOF) |
58 .Return(); | 59 .Return(); |
59 | 60 |
60 // Test iterator sees the expected output from the builder. | 61 // Test iterator sees the expected output from the builder. |
61 BytecodeArrayIterator iterator(builder.ToBytecodeArray()); | 62 BytecodeArrayIterator iterator(builder.ToBytecodeArray()); |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
167 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLoadIC); | 168 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLoadIC); |
168 CHECK_EQ(iterator.current_offset(), offset); | 169 CHECK_EQ(iterator.current_offset(), offset); |
169 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 170 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
170 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); | 171 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); |
171 CHECK_EQ(iterator.GetIndexOperand(1), name_index); | 172 CHECK_EQ(iterator.GetIndexOperand(1), name_index); |
172 CHECK_EQ(iterator.GetIndexOperand(2), feedback_slot); | 173 CHECK_EQ(iterator.GetIndexOperand(2), feedback_slot); |
173 CHECK(!iterator.done()); | 174 CHECK(!iterator.done()); |
174 offset += Bytecodes::Size(Bytecode::kLoadIC, OperandScale::kSingle); | 175 offset += Bytecodes::Size(Bytecode::kLoadIC, OperandScale::kSingle); |
175 iterator.Advance(); | 176 iterator.Advance(); |
176 | 177 |
| 178 CHECK_EQ(iterator.current_bytecode(), Bytecode::kAdd); |
| 179 CHECK_EQ(iterator.current_offset(), offset); |
| 180 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
| 181 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); |
| 182 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); |
| 183 CHECK(!iterator.done()); |
| 184 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); |
| 185 iterator.Advance(); |
| 186 |
177 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); | 187 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); |
178 CHECK_EQ(iterator.current_offset(), offset); | 188 CHECK_EQ(iterator.current_offset(), offset); |
179 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 189 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
180 CHECK_EQ(iterator.GetRegisterOperand(0).index(), param.index()); | 190 CHECK_EQ(iterator.GetRegisterOperand(0).index(), param.index()); |
181 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); | 191 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); |
182 CHECK(!iterator.done()); | 192 CHECK(!iterator.done()); |
183 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); | 193 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); |
184 iterator.Advance(); | 194 iterator.Advance(); |
185 | 195 |
186 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntimeForPair); | 196 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntimeForPair); |
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 CHECK_EQ(iterator.current_offset(), offset); | 247 CHECK_EQ(iterator.current_offset(), offset); |
238 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 248 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
239 CHECK(!iterator.done()); | 249 CHECK(!iterator.done()); |
240 iterator.Advance(); | 250 iterator.Advance(); |
241 CHECK(iterator.done()); | 251 CHECK(iterator.done()); |
242 } | 252 } |
243 | 253 |
244 } // namespace interpreter | 254 } // namespace interpreter |
245 } // namespace internal | 255 } // namespace internal |
246 } // namespace v8 | 256 } // namespace v8 |
OLD | NEW |