| 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 } | 56 } |
| 57 return 0; | 57 return 0; |
| 58 } | 58 } |
| 59 | 59 |
| 60 | 60 |
| 61 int8_t BytecodeArrayIterator::GetImmediateOperand(int operand_index) const { | 61 int8_t BytecodeArrayIterator::GetImmediateOperand(int operand_index) const { |
| 62 uint32_t operand = GetRawOperand(operand_index, OperandType::kImm8); | 62 uint32_t operand = GetRawOperand(operand_index, OperandType::kImm8); |
| 63 return static_cast<int8_t>(operand); | 63 return static_cast<int8_t>(operand); |
| 64 } | 64 } |
| 65 | 65 |
| 66 int BytecodeArrayIterator::GetRegisterCountOperand(int operand_index) const { | 66 |
| 67 int BytecodeArrayIterator::GetCountOperand(int operand_index) const { |
| 67 OperandSize size = | 68 OperandSize size = |
| 68 Bytecodes::GetOperandSize(current_bytecode(), operand_index); | 69 Bytecodes::GetOperandSize(current_bytecode(), operand_index); |
| 69 OperandType type = (size == OperandSize::kByte) ? OperandType::kRegCount8 | 70 OperandType type = (size == OperandSize::kByte) ? OperandType::kRegCount8 |
| 70 : OperandType::kRegCount16; | 71 : OperandType::kRegCount16; |
| 71 uint32_t operand = GetRawOperand(operand_index, type); | 72 uint32_t operand = GetRawOperand(operand_index, type); |
| 72 return static_cast<int>(operand); | 73 return static_cast<int>(operand); |
| 73 } | 74 } |
| 74 | 75 |
| 75 | 76 |
| 76 int BytecodeArrayIterator::GetIndexOperand(int operand_index) const { | 77 int BytecodeArrayIterator::GetIndexOperand(int operand_index) const { |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return 2; | 124 return 2; |
| 124 case OperandType::kRegOutTriple8: | 125 case OperandType::kRegOutTriple8: |
| 125 case OperandType::kRegOutTriple16: | 126 case OperandType::kRegOutTriple16: |
| 126 return 3; | 127 return 3; |
| 127 default: { | 128 default: { |
| 128 if (operand_index + 1 != | 129 if (operand_index + 1 != |
| 129 Bytecodes::NumberOfOperands(current_bytecode())) { | 130 Bytecodes::NumberOfOperands(current_bytecode())) { |
| 130 OperandType next_operand_type = | 131 OperandType next_operand_type = |
| 131 Bytecodes::GetOperandType(current_bytecode(), operand_index + 1); | 132 Bytecodes::GetOperandType(current_bytecode(), operand_index + 1); |
| 132 if (Bytecodes::IsRegisterCountOperandType(next_operand_type)) { | 133 if (Bytecodes::IsRegisterCountOperandType(next_operand_type)) { |
| 133 return GetRegisterCountOperand(operand_index + 1); | 134 return GetCountOperand(operand_index + 1); |
| 134 } | 135 } |
| 135 } | 136 } |
| 136 return 1; | 137 return 1; |
| 137 } | 138 } |
| 138 } | 139 } |
| 139 } | 140 } |
| 140 | 141 |
| 141 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( | 142 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( |
| 142 int operand_index) const { | 143 int operand_index) const { |
| 143 return FixedArray::get(bytecode_array()->constant_pool(), | 144 return FixedArray::get(bytecode_array()->constant_pool(), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 157 return current_offset() + smi->value(); | 158 return current_offset() + smi->value(); |
| 158 } else { | 159 } else { |
| 159 UNREACHABLE(); | 160 UNREACHABLE(); |
| 160 return kMinInt; | 161 return kMinInt; |
| 161 } | 162 } |
| 162 } | 163 } |
| 163 | 164 |
| 164 } // namespace interpreter | 165 } // namespace interpreter |
| 165 } // namespace internal | 166 } // namespace internal |
| 166 } // namespace v8 | 167 } // namespace v8 |
| OLD | NEW |