| 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/interpreter/bytecode-array-builder.h" | 5 #include "src/interpreter/bytecode-array-builder.h" |
| 6 | 6 |
| 7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
| 8 #include "src/interpreter/bytecode-array-writer.h" | 8 #include "src/interpreter/bytecode-array-writer.h" |
| 9 #include "src/interpreter/bytecode-label.h" | 9 #include "src/interpreter/bytecode-label.h" |
| 10 #include "src/interpreter/bytecode-peephole-optimizer.h" | 10 #include "src/interpreter/bytecode-peephole-optimizer.h" |
| (...skipping 663 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 674 uint32_t operands[] = {operand0, operand1, operand2, operand3}; | 674 uint32_t operands[] = {operand0, operand1, operand2, operand3}; |
| 675 const OperandType* operand_types = Bytecodes::GetOperandTypes(bytecode); | 675 const OperandType* operand_types = Bytecodes::GetOperandTypes(bytecode); |
| 676 for (int i = 0; i < operand_count; ++i) { | 676 for (int i = 0; i < operand_count; ++i) { |
| 677 switch (operand_types[i]) { | 677 switch (operand_types[i]) { |
| 678 case OperandType::kNone: | 678 case OperandType::kNone: |
| 679 return false; | 679 return false; |
| 680 case OperandType::kRegCount: { | 680 case OperandType::kRegCount: { |
| 681 CHECK_NE(i, 0); | 681 CHECK_NE(i, 0); |
| 682 CHECK(operand_types[i - 1] == OperandType::kMaybeReg || | 682 CHECK(operand_types[i - 1] == OperandType::kMaybeReg || |
| 683 operand_types[i - 1] == OperandType::kReg); | 683 operand_types[i - 1] == OperandType::kReg); |
| 684 if (operands[i] > 0) { | 684 if (i > 0 && operands[i] > 0) { |
| 685 Register start = Register::FromOperand(operands[i - 1]); | 685 Register start = Register::FromOperand(operands[i - 1]); |
| 686 Register end(start.index() + static_cast<int>(operands[i]) - 1); | 686 Register end(start.index() + static_cast<int>(operands[i]) - 1); |
| 687 if (!RegisterIsValid(start) || !RegisterIsValid(end) || start > end) { | 687 if (!RegisterIsValid(start) || !RegisterIsValid(end) || start > end) { |
| 688 return false; | 688 return false; |
| 689 } | 689 } |
| 690 } | 690 } |
| 691 break; | 691 break; |
| 692 } | 692 } |
| 693 case OperandType::kFlag8: | 693 case OperandType::kFlag8: |
| 694 if (Bytecodes::SizeForUnsignedOperand(operands[i]) > | 694 if (Bytecodes::SizeForUnsignedOperand(operands[i]) > |
| (...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 917 return Bytecode::kTailCall; | 917 return Bytecode::kTailCall; |
| 918 default: | 918 default: |
| 919 UNREACHABLE(); | 919 UNREACHABLE(); |
| 920 } | 920 } |
| 921 return Bytecode::kIllegal; | 921 return Bytecode::kIllegal; |
| 922 } | 922 } |
| 923 | 923 |
| 924 } // namespace interpreter | 924 } // namespace interpreter |
| 925 } // namespace internal | 925 } // namespace internal |
| 926 } // namespace v8 | 926 } // namespace v8 |
| OLD | NEW |