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 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 const uint8_t* operand_start = | 121 const uint8_t* operand_start = |
122 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ + | 122 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ + |
123 current_prefix_offset() + | 123 current_prefix_offset() + |
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 DCHECK_LE(operand_index, Bytecodes::NumberOfOperands(current_bytecode())); |
132 Bytecodes::GetOperandType(current_bytecode(), operand_index); | 132 const OperandType* operand_types = |
133 DCHECK(Bytecodes::IsRegisterOperandType(operand_type)); | 133 Bytecodes::GetOperandTypes(current_bytecode()); |
134 switch (operand_type) { | 134 DCHECK(Bytecodes::IsRegisterOperandType(operand_types[operand_index])); |
135 case OperandType::kRegPair: | 135 if (operand_types[operand_index + 1] == OperandType::kRegCount) { |
136 case OperandType::kRegOutPair: | 136 return GetRegisterCountOperand(operand_index + 1); |
137 return 2; | 137 } else { |
138 case OperandType::kRegOutTriple: | 138 OperandType operand_type = operand_types[operand_index]; |
139 return 3; | 139 return Bytecodes::GetNumberOfRegistersRepresentedBy(operand_type); |
140 default: { | |
141 if (operand_index + 1 != | |
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 } | 140 } |
152 } | 141 } |
153 | 142 |
154 uint32_t BytecodeArrayIterator::GetRuntimeIdOperand(int operand_index) const { | 143 uint32_t BytecodeArrayIterator::GetRuntimeIdOperand(int operand_index) const { |
155 OperandType operand_type = | 144 OperandType operand_type = |
156 Bytecodes::GetOperandType(current_bytecode(), operand_index); | 145 Bytecodes::GetOperandType(current_bytecode(), operand_index); |
157 DCHECK(operand_type == OperandType::kRuntimeId); | 146 DCHECK(operand_type == OperandType::kRuntimeId); |
158 return GetUnsignedOperand(operand_index, operand_type); | 147 return GetUnsignedOperand(operand_index, operand_type); |
159 } | 148 } |
160 | 149 |
(...skipping 15 matching lines...) Expand all Loading... |
176 return current_offset() + smi->value() + current_prefix_offset(); | 165 return current_offset() + smi->value() + current_prefix_offset(); |
177 } else { | 166 } else { |
178 UNREACHABLE(); | 167 UNREACHABLE(); |
179 return kMinInt; | 168 return kMinInt; |
180 } | 169 } |
181 } | 170 } |
182 | 171 |
183 } // namespace interpreter | 172 } // namespace interpreter |
184 } // namespace internal | 173 } // namespace internal |
185 } // namespace v8 | 174 } // namespace v8 |
OLD | NEW |