Index: src/interpreter/bytecode-array-iterator.cc |
diff --git a/src/interpreter/bytecode-array-iterator.cc b/src/interpreter/bytecode-array-iterator.cc |
index fc9e2f5e9037615a2d18c64dd78700a682bfc219..4bb112bc948a8214ce367b8b1344ecc9974e702b 100644 |
--- a/src/interpreter/bytecode-array-iterator.cc |
+++ b/src/interpreter/bytecode-array-iterator.cc |
@@ -89,15 +89,28 @@ Register BytecodeArrayIterator::GetRegisterOperand(int operand_index) const { |
Bytecodes::GetOperandType(current_bytecode(), operand_index); |
DCHECK(Bytecodes::IsRegisterOperandType(operand_type)); |
uint32_t operand = GetRawOperand(operand_index, operand_type); |
+ Register reg; |
switch (Bytecodes::GetOperandSize(current_bytecode(), operand_index)) { |
case OperandSize::kByte: |
- return Register::FromOperand(static_cast<uint8_t>(operand)); |
+ reg = Register::FromOperand(static_cast<uint8_t>(operand)); |
+ break; |
case OperandSize::kShort: |
- return Register::FromWideOperand(static_cast<uint16_t>(operand)); |
+ reg = Register::FromWideOperand(static_cast<uint16_t>(operand)); |
+ break; |
case OperandSize::kNone: |
UNREACHABLE(); |
+ reg = Register::invalid_value(); |
rmcilroy
2016/02/02 10:53:28
break;
oth
2016/02/02 11:20:24
Done.
|
} |
- return Register(); |
+ DCHECK_GE(reg.index(), |
+ Register::FromParameterIndex(0, bytecode_array()->parameter_count()) |
+ .index()); |
+ DCHECK(reg.index() < bytecode_array()->register_count() || |
+ (reg.index() == 0 && |
+ (Bytecodes::GetOperandType(current_bytecode(), operand_index) == |
+ OperandType::kMaybeReg8 || |
+ Bytecodes::GetOperandType(current_bytecode(), operand_index) == |
+ OperandType::kMaybeReg16))); |
rmcilroy
2016/02/02 10:53:28
nit - could you pull out a helper for IsMaybeRegis
oth
2016/02/02 11:20:24
Done. Also IsRegisterCountOperandType used just be
|
+ return reg; |
} |
int BytecodeArrayIterator::GetRegisterOperandRange(int operand_index) const { |