Index: src/interpreter/bytecode-array-iterator.cc |
diff --git a/src/interpreter/bytecode-array-iterator.cc b/src/interpreter/bytecode-array-iterator.cc |
index a17efcb6ca4b5a36c240e32474fe0ef92834e96a..ec5e26b871c765f72afaf54d449103312711b946 100644 |
--- a/src/interpreter/bytecode-array-iterator.cc |
+++ b/src/interpreter/bytecode-array-iterator.cc |
@@ -131,23 +131,14 @@ int BytecodeArrayIterator::GetRegisterOperandRange(int operand_index) const { |
interpreter::OperandType operand_type = |
Bytecodes::GetOperandType(current_bytecode(), operand_index); |
DCHECK(Bytecodes::IsRegisterOperandType(operand_type)); |
- switch (operand_type) { |
- case OperandType::kRegPair: |
- case OperandType::kRegOutPair: |
- return 2; |
- case OperandType::kRegOutTriple: |
- return 3; |
- default: { |
- if (operand_index + 1 != |
- Bytecodes::NumberOfOperands(current_bytecode())) { |
- OperandType next_operand_type = |
- Bytecodes::GetOperandType(current_bytecode(), operand_index + 1); |
- if (OperandType::kRegCount == next_operand_type) { |
- return GetRegisterCountOperand(operand_index + 1); |
- } |
- } |
- return 1; |
- } |
+ int count = Bytecodes::GetNumberOfRegistersRepresentedBy(operand_type); |
+ if (count == 1 && |
+ ++operand_index < Bytecodes::NumberOfOperands(current_bytecode()) && |
+ Bytecodes::GetOperandType(current_bytecode(), operand_index) == |
+ OperandType::kRegCount) { |
+ return GetRegisterCountOperand(operand_index); |
+ } else { |
+ return count; |
} |
} |