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 14 matching lines...) Expand all Loading... |
25 } | 25 } |
26 | 26 |
27 | 27 |
28 Bytecode BytecodeArrayIterator::current_bytecode() const { | 28 Bytecode BytecodeArrayIterator::current_bytecode() const { |
29 DCHECK(!done()); | 29 DCHECK(!done()); |
30 uint8_t current_byte = bytecode_array()->get(bytecode_offset_); | 30 uint8_t current_byte = bytecode_array()->get(bytecode_offset_); |
31 return interpreter::Bytecodes::FromByte(current_byte); | 31 return interpreter::Bytecodes::FromByte(current_byte); |
32 } | 32 } |
33 | 33 |
34 | 34 |
| 35 int BytecodeArrayIterator::current_bytecode_size() const { |
| 36 return Bytecodes::Size(current_bytecode()); |
| 37 } |
| 38 |
| 39 |
35 uint32_t BytecodeArrayIterator::GetRawOperand(int operand_index, | 40 uint32_t BytecodeArrayIterator::GetRawOperand(int operand_index, |
36 OperandType operand_type) const { | 41 OperandType operand_type) const { |
37 DCHECK_GE(operand_index, 0); | 42 DCHECK_GE(operand_index, 0); |
38 DCHECK_LT(operand_index, Bytecodes::NumberOfOperands(current_bytecode())); | 43 DCHECK_LT(operand_index, Bytecodes::NumberOfOperands(current_bytecode())); |
39 DCHECK_EQ(operand_type, | 44 DCHECK_EQ(operand_type, |
40 Bytecodes::GetOperandType(current_bytecode(), operand_index)); | 45 Bytecodes::GetOperandType(current_bytecode(), operand_index)); |
41 uint8_t* operand_start = | 46 uint8_t* operand_start = |
42 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ + | 47 bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_ + |
43 Bytecodes::GetOperandOffset(current_bytecode(), operand_index); | 48 Bytecodes::GetOperandOffset(current_bytecode(), operand_index); |
44 switch (Bytecodes::SizeOfOperand(operand_type)) { | 49 switch (Bytecodes::SizeOfOperand(operand_type)) { |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 return current_offset() + smi->value(); | 111 return current_offset() + smi->value(); |
107 } else { | 112 } else { |
108 UNREACHABLE(); | 113 UNREACHABLE(); |
109 return kMinInt; | 114 return kMinInt; |
110 } | 115 } |
111 } | 116 } |
112 | 117 |
113 } // namespace interpreter | 118 } // namespace interpreter |
114 } // namespace internal | 119 } // namespace internal |
115 } // namespace v8 | 120 } // namespace v8 |
OLD | NEW |