| 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 29 matching lines...) Expand all Loading... |
| 40 uint32_t BytecodeArrayIterator::GetRawOperand(int operand_index, | 40 uint32_t BytecodeArrayIterator::GetRawOperand(int operand_index, |
| 41 OperandType operand_type) const { | 41 OperandType operand_type) const { |
| 42 DCHECK_GE(operand_index, 0); | 42 DCHECK_GE(operand_index, 0); |
| 43 DCHECK_LT(operand_index, Bytecodes::NumberOfOperands(current_bytecode())); | 43 DCHECK_LT(operand_index, Bytecodes::NumberOfOperands(current_bytecode())); |
| 44 DCHECK_EQ(operand_type, | 44 DCHECK_EQ(operand_type, |
| 45 Bytecodes::GetOperandType(current_bytecode(), operand_index)); | 45 Bytecodes::GetOperandType(current_bytecode(), operand_index)); |
| 46 uint8_t* operand_start = | 46 uint8_t* operand_start = |
| 47 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ + | 47 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ + |
| 48 Bytecodes::GetOperandOffset(current_bytecode(), operand_index); | 48 Bytecodes::GetOperandOffset(current_bytecode(), operand_index); |
| 49 switch (Bytecodes::SizeOfOperand(operand_type)) { | 49 switch (Bytecodes::SizeOfOperand(operand_type)) { |
| 50 default: | |
| 51 case OperandSize::kNone: | |
| 52 UNREACHABLE(); | |
| 53 case OperandSize::kByte: | 50 case OperandSize::kByte: |
| 54 return static_cast<uint32_t>(*operand_start); | 51 return static_cast<uint32_t>(*operand_start); |
| 55 case OperandSize::kShort: | 52 case OperandSize::kShort: |
| 56 return ReadUnalignedUInt16(operand_start); | 53 return ReadUnalignedUInt16(operand_start); |
| 54 case OperandSize::kNone: |
| 55 UNREACHABLE(); |
| 57 } | 56 } |
| 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 | 66 |
| 67 int BytecodeArrayIterator::GetCountOperand(int operand_index) const { | 67 int BytecodeArrayIterator::GetCountOperand(int operand_index) const { |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 return current_offset() + smi->value(); | 123 return current_offset() + smi->value(); |
| 124 } else { | 124 } else { |
| 125 UNREACHABLE(); | 125 UNREACHABLE(); |
| 126 return kMinInt; | 126 return kMinInt; |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 | 129 |
| 130 } // namespace interpreter | 130 } // namespace interpreter |
| 131 } // namespace internal | 131 } // namespace internal |
| 132 } // namespace v8 | 132 } // namespace v8 |
| OLD | NEW |