| 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 25 matching lines...) Expand all Loading... |
| 36 int name_index = 2; | 36 int name_index = 2; |
| 37 int feedback_slot = 97; | 37 int feedback_slot = 97; |
| 38 | 38 |
| 39 builder.LoadLiteral(heap_num_0) | 39 builder.LoadLiteral(heap_num_0) |
| 40 .StoreAccumulatorInRegister(reg_0) | 40 .StoreAccumulatorInRegister(reg_0) |
| 41 .LoadLiteral(heap_num_1) | 41 .LoadLiteral(heap_num_1) |
| 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 .StackCheck(0) |
| 46 .StoreAccumulatorInRegister(reg_0) | 47 .StoreAccumulatorInRegister(reg_0) |
| 47 .LoadLiteral(smi_1) | 48 .LoadLiteral(smi_1) |
| 49 .StackCheck(1) |
| 48 .StoreAccumulatorInRegister(reg_1) | 50 .StoreAccumulatorInRegister(reg_1) |
| 49 .LoadAccumulatorWithRegister(reg_0) | 51 .LoadAccumulatorWithRegister(reg_0) |
| 50 .BinaryOperation(Token::Value::ADD, reg_0) | 52 .BinaryOperation(Token::Value::ADD, reg_0) |
| 51 .StoreAccumulatorInRegister(reg_1) | 53 .StoreAccumulatorInRegister(reg_1) |
| 52 .LoadNamedProperty(reg_1, name, feedback_slot) | 54 .LoadNamedProperty(reg_1, name, feedback_slot) |
| 53 .BinaryOperation(Token::Value::ADD, reg_0) | 55 .BinaryOperation(Token::Value::ADD, reg_0) |
| 54 .StoreAccumulatorInRegister(param) | 56 .StoreAccumulatorInRegister(param) |
| 55 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) | 57 .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, param, 1, reg_0) |
| 56 .ForInPrepare(reg_0) | 58 .ForInPrepare(reg_0) |
| 57 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) | 59 .CallRuntime(Runtime::kLoadIC_Miss, reg_0, 1) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 iterator.Advance(); | 117 iterator.Advance(); |
| 116 | 118 |
| 117 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaSmi); | 119 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaSmi); |
| 118 CHECK_EQ(iterator.current_offset(), offset); | 120 CHECK_EQ(iterator.current_offset(), offset); |
| 119 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 121 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
| 120 CHECK_EQ(Smi::FromInt(iterator.GetImmediateOperand(0)), smi_0); | 122 CHECK_EQ(Smi::FromInt(iterator.GetImmediateOperand(0)), smi_0); |
| 121 CHECK(!iterator.done()); | 123 CHECK(!iterator.done()); |
| 122 offset += Bytecodes::Size(Bytecode::kLdaSmi, OperandScale::kSingle); | 124 offset += Bytecodes::Size(Bytecode::kLdaSmi, OperandScale::kSingle); |
| 123 iterator.Advance(); | 125 iterator.Advance(); |
| 124 | 126 |
| 127 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStackCheck); |
| 128 CHECK_EQ(iterator.current_offset(), offset); |
| 129 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
| 130 CHECK_EQ(Bytecodes::NumberOfOperands(iterator.current_bytecode()), 0); |
| 131 CHECK(!iterator.done()); |
| 132 offset += Bytecodes::Size(Bytecode::kStackCheck, OperandScale::kSingle); |
| 133 iterator.Advance(); |
| 134 |
| 125 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); | 135 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); |
| 126 CHECK_EQ(iterator.current_offset(), offset); | 136 CHECK_EQ(iterator.current_offset(), offset); |
| 127 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 137 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
| 128 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); | 138 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_0.index()); |
| 129 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); | 139 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); |
| 130 CHECK(!iterator.done()); | 140 CHECK(!iterator.done()); |
| 131 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); | 141 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); |
| 132 iterator.Advance(); | 142 iterator.Advance(); |
| 133 | 143 |
| 134 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaSmi); | 144 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdaSmi); |
| 135 CHECK_EQ(iterator.current_offset(), offset); | 145 CHECK_EQ(iterator.current_offset(), offset); |
| 136 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kQuadruple); | 146 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kQuadruple); |
| 137 CHECK_EQ(Smi::FromInt(iterator.GetImmediateOperand(0)), smi_1); | 147 CHECK_EQ(Smi::FromInt(iterator.GetImmediateOperand(0)), smi_1); |
| 138 CHECK(!iterator.done()); | 148 CHECK(!iterator.done()); |
| 139 offset += Bytecodes::Size(Bytecode::kLdaSmi, OperandScale::kQuadruple) + | 149 offset += Bytecodes::Size(Bytecode::kLdaSmi, OperandScale::kQuadruple) + |
| 140 kPrefixByteSize; | 150 kPrefixByteSize; |
| 141 iterator.Advance(); | 151 iterator.Advance(); |
| 142 | 152 |
| 153 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStackCheck); |
| 154 CHECK_EQ(iterator.current_offset(), offset); |
| 155 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
| 156 CHECK_EQ(Bytecodes::NumberOfOperands(iterator.current_bytecode()), 0); |
| 157 CHECK(!iterator.done()); |
| 158 offset += Bytecodes::Size(Bytecode::kStackCheck, OperandScale::kSingle); |
| 159 iterator.Advance(); |
| 160 |
| 143 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); | 161 CHECK_EQ(iterator.current_bytecode(), Bytecode::kStar); |
| 144 CHECK_EQ(iterator.current_offset(), offset); | 162 CHECK_EQ(iterator.current_offset(), offset); |
| 145 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 163 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
| 146 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); | 164 CHECK_EQ(iterator.GetRegisterOperand(0).index(), reg_1.index()); |
| 147 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); | 165 CHECK_EQ(iterator.GetRegisterOperandRange(0), 1); |
| 148 CHECK(!iterator.done()); | 166 CHECK(!iterator.done()); |
| 149 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); | 167 offset += Bytecodes::Size(Bytecode::kStar, OperandScale::kSingle); |
| 150 iterator.Advance(); | 168 iterator.Advance(); |
| 151 | 169 |
| 152 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdar); | 170 CHECK_EQ(iterator.current_bytecode(), Bytecode::kLdar); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 256 CHECK_EQ(iterator.current_offset(), offset); | 274 CHECK_EQ(iterator.current_offset(), offset); |
| 257 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); | 275 CHECK_EQ(iterator.current_operand_scale(), OperandScale::kSingle); |
| 258 CHECK(!iterator.done()); | 276 CHECK(!iterator.done()); |
| 259 iterator.Advance(); | 277 iterator.Advance(); |
| 260 CHECK(iterator.done()); | 278 CHECK(iterator.done()); |
| 261 } | 279 } |
| 262 | 280 |
| 263 } // namespace interpreter | 281 } // namespace interpreter |
| 264 } // namespace internal | 282 } // namespace internal |
| 265 } // namespace v8 | 283 } // namespace v8 |
| OLD | NEW |