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