Chromium Code Reviews| 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-iterator.h" | 5 #include "src/interpreter/bytecode-array-iterator.h" |
| 6 | 6 |
| 7 #include "src/objects-inl.h" | 7 #include "src/objects-inl.h" |
| 8 | 8 |
| 9 namespace v8 { | 9 namespace v8 { |
| 10 namespace internal { | 10 namespace internal { |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 124 Bytecodes::GetOperandOffset(current_bytecode(), operand_index, | 124 Bytecodes::GetOperandOffset(current_bytecode(), operand_index, |
| 125 current_operand_scale()); | 125 current_operand_scale()); |
| 126 return Bytecodes::DecodeRegisterOperand(operand_start, operand_type, | 126 return Bytecodes::DecodeRegisterOperand(operand_start, operand_type, |
| 127 current_operand_scale()); | 127 current_operand_scale()); |
| 128 } | 128 } |
| 129 | 129 |
| 130 int BytecodeArrayIterator::GetRegisterOperandRange(int operand_index) const { | 130 int BytecodeArrayIterator::GetRegisterOperandRange(int operand_index) const { |
| 131 interpreter::OperandType operand_type = | 131 interpreter::OperandType operand_type = |
| 132 Bytecodes::GetOperandType(current_bytecode(), operand_index); | 132 Bytecodes::GetOperandType(current_bytecode(), operand_index); |
| 133 DCHECK(Bytecodes::IsRegisterOperandType(operand_type)); | 133 DCHECK(Bytecodes::IsRegisterOperandType(operand_type)); |
| 134 switch (operand_type) { | 134 int count = Bytecodes::GetNumberOfRegistersRepresentedBy(operand_type); |
| 135 case OperandType::kRegPair: | 135 if (count == 1 && |
|
rmcilroy
2016/05/10 11:14:09
nit - how about:
if (++operand_index < Bytecodes:
oth
2016/05/11 13:17:30
Updated to use GetOperandTypes instead.
| |
| 136 case OperandType::kRegOutPair: | 136 ++operand_index < Bytecodes::NumberOfOperands(current_bytecode()) && |
| 137 return 2; | 137 Bytecodes::GetOperandType(current_bytecode(), operand_index) == |
| 138 case OperandType::kRegOutTriple: | 138 OperandType::kRegCount) { |
| 139 return 3; | 139 return GetRegisterCountOperand(operand_index); |
| 140 default: { | 140 } else { |
| 141 if (operand_index + 1 != | 141 return count; |
| 142 Bytecodes::NumberOfOperands(current_bytecode())) { | |
| 143 OperandType next_operand_type = | |
| 144 Bytecodes::GetOperandType(current_bytecode(), operand_index + 1); | |
| 145 if (OperandType::kRegCount == next_operand_type) { | |
| 146 return GetRegisterCountOperand(operand_index + 1); | |
| 147 } | |
| 148 } | |
| 149 return 1; | |
| 150 } | |
| 151 } | 142 } |
| 152 } | 143 } |
| 153 | 144 |
| 154 uint32_t BytecodeArrayIterator::GetRuntimeIdOperand(int operand_index) const { | 145 uint32_t BytecodeArrayIterator::GetRuntimeIdOperand(int operand_index) const { |
| 155 OperandType operand_type = | 146 OperandType operand_type = |
| 156 Bytecodes::GetOperandType(current_bytecode(), operand_index); | 147 Bytecodes::GetOperandType(current_bytecode(), operand_index); |
| 157 DCHECK(operand_type == OperandType::kRuntimeId); | 148 DCHECK(operand_type == OperandType::kRuntimeId); |
| 158 return GetUnsignedOperand(operand_index, operand_type); | 149 return GetUnsignedOperand(operand_index, operand_type); |
| 159 } | 150 } |
| 160 | 151 |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 176 return current_offset() + smi->value() + current_prefix_offset(); | 167 return current_offset() + smi->value() + current_prefix_offset(); |
| 177 } else { | 168 } else { |
| 178 UNREACHABLE(); | 169 UNREACHABLE(); |
| 179 return kMinInt; | 170 return kMinInt; |
| 180 } | 171 } |
| 181 } | 172 } |
| 182 | 173 |
| 183 } // namespace interpreter | 174 } // namespace interpreter |
| 184 } // namespace internal | 175 } // namespace internal |
| 185 } // namespace v8 | 176 } // namespace v8 |
| OLD | NEW |