| 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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 .LoadLiteral(smi_1) | 48 .LoadLiteral(smi_1) |
| 49 .StackCheck(1) | 49 .StackCheck(1) |
| 50 .StoreAccumulatorInRegister(reg_1) | 50 .StoreAccumulatorInRegister(reg_1) |
| 51 .LoadAccumulatorWithRegister(reg_0) | 51 .LoadAccumulatorWithRegister(reg_0) |
| 52 .BinaryOperation(Token::Value::ADD, reg_0) | 52 .BinaryOperation(Token::Value::ADD, reg_0) |
| 53 .StoreAccumulatorInRegister(reg_1) | 53 .StoreAccumulatorInRegister(reg_1) |
| 54 .LoadNamedProperty(reg_1, name, feedback_slot) | 54 .LoadNamedProperty(reg_1, name, feedback_slot) |
| 55 .BinaryOperation(Token::Value::ADD, reg_0) | 55 .BinaryOperation(Token::Value::ADD, reg_0) |
| 56 .StoreAccumulatorInRegister(param) | 56 .StoreAccumulatorInRegister(param) |
| 57 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) | 57 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) |
| 58 .ForInPrepare(reg_0) | 58 .ForInPrepare(reg_0, reg_0) |
| 59 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) | 59 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) |
| 60 .Debugger() | 60 .Debugger() |
| 61 .LoadGlobal(0x10000000, TypeofMode::NOT_INSIDE_TYPEOF) | 61 .LoadGlobal(0x10000000, TypeofMode::NOT_INSIDE_TYPEOF) |
| 62 .Return(); | 62 .Return(); |
| 63 | 63 |
| 64 // Test iterator sees the expected output from the builder. | 64 // Test iterator sees the expected output from the builder. |
| 65 BytecodeArrayIterator iterator(builder.ToBytecodeArray()); | 65 BytecodeArrayIterator iterator(builder.ToBytecodeArray()); |
| 66 const int kPrefixByteSize = 1; | 66 const int kPrefixByteSize = 1; |
| 67 int offset = 0; | 67 int offset = 0; |
| 68 | 68 |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 CHECK_EQ(iterator.GetRegisterOperandRange(3), 2); | 232 CHECK_EQ(iterator.GetRegisterOperandRange(3), 2); |
| 233 CHECK(!iterator.done()); | 233 CHECK(!iterator.done()); |
| 234 offset += | 234 offset += |
| 235 Bytecodes::Size(Bytecode::kCallRuntimeForPair, OperandScale::kSingle); | 235 Bytecodes::Size(Bytecode::kCallRuntimeForPair, OperandScale::kSingle); |
| 236 iterator.Advance(); | 236 iterator.Advance(); |
| 237 | 237 |
| 238 CHECK_EQ(iterator.current_bytecode(), Bytecode::kForInPrepare); | 238 CHECK_EQ(iterator.current_bytecode(), Bytecode::kForInPrepare); |
| 239 CHECK_EQ(iterator.current_offset(), offset); | 239 CHECK_EQ(iterator.current_offset(), offset); |
| 240 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 240 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
| 241 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); | 241 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); |
| 242 CHECK_EQ(iterator.GetRegisterOperandRange(0), 3); | 242 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); |
| 243 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index()); |
| 244 CHECK_EQ(iterator.GetRegisterOperandRange(1), 3); |
| 243 CHECK(!iterator.done()); | 245 CHECK(!iterator.done()); |
| 244 offset += Bytecodes::Size(Bytecode::kForInPrepare, OperandScale::kSingle); | 246 offset += Bytecodes::Size(Bytecode::kForInPrepare, OperandScale::kSingle); |
| 245 iterator.Advance(); | 247 iterator.Advance(); |
| 246 | 248 |
| 247 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntime); | 249 CHECK_EQ(iterator.current_bytecode(), Bytecode::kCallRuntime); |
| 248 CHECK_EQ(iterator.current_offset(), offset); | 250 CHECK_EQ(iterator.current_offset(), offset); |
| 249 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 251 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
| 250 CHECK_EQ(iterator.GetRuntimeIdOperand(0), Runtime::kLoadIC_Miss); | 252 CHECK_EQ(iterator.GetRuntimeIdOperand(0), Runtime::kLoadIC_Miss); |
| 251 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index()); | 253 CHECK_EQ(iterator.GetRegisterOperand(1).index(), reg_0.index()); |
| 252 CHECK_EQ(iterator.GetRegisterCountOperand(2), 1); | 254 CHECK_EQ(iterator.GetRegisterCountOperand(2), 1); |
| (...skipping 21 matching lines...) Expand all Loading... |
| 274 CHECK_EQ(iterator.current_offset(), offset); | 276 CHECK_EQ(iterator.current_offset(), offset); |
| 275 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 277 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
| 276 CHECK(!iterator.done()); | 278 CHECK(!iterator.done()); |
| 277 iterator.Advance(); | 279 iterator.Advance(); |
| 278 CHECK(iterator.done()); | 280 CHECK(iterator.done()); |
| 279 } | 281 } |
| 280 | 282 |
| 281 } // namespace interpreter | 283 } // namespace interpreter |
| 282 } // namespace internal | 284 } // namespace internal |
| 283 } // namespace v8 | 285 } // namespace v8 |
| OLD | NEW |