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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 } | 53 } |
54 | 54 |
55 | 55 |
56 int8_t BytecodeArrayIterator::GetImmediateOperand(int operand_index) const { | 56 int8_t BytecodeArrayIterator::GetImmediateOperand(int operand_index) const { |
57 uint32_t operand = GetRawOperand(operand_index, OperandType::kImm8); | 57 uint32_t operand = GetRawOperand(operand_index, OperandType::kImm8); |
58 return static_cast<int8_t>(operand); | 58 return static_cast<int8_t>(operand); |
59 } | 59 } |
60 | 60 |
61 | 61 |
62 int BytecodeArrayIterator::GetCountOperand(int operand_index) const { | 62 int BytecodeArrayIterator::GetCountOperand(int operand_index) const { |
63 uint32_t operand = GetRawOperand(operand_index, OperandType::kCount8); | 63 OperandSize size = |
| 64 Bytecodes::GetOperandSize(current_bytecode(), operand_index); |
| 65 OperandType type = (size == OperandSize::kByte) ? OperandType::kCount8 |
| 66 : OperandType::kCount16; |
| 67 uint32_t operand = GetRawOperand(operand_index, type); |
64 return static_cast<int>(operand); | 68 return static_cast<int>(operand); |
65 } | 69 } |
66 | 70 |
67 | 71 |
68 int BytecodeArrayIterator::GetIndexOperand(int operand_index) const { | 72 int BytecodeArrayIterator::GetIndexOperand(int operand_index) const { |
69 OperandSize size = | 73 OperandSize size = |
70 Bytecodes::GetOperandSize(current_bytecode(), operand_index); | 74 Bytecodes::GetOperandSize(current_bytecode(), operand_index); |
71 OperandType type = | 75 OperandType type = |
72 (size == OperandSize::kByte) ? OperandType::kIdx8 : OperandType::kIdx16; | 76 (size == OperandSize::kByte) ? OperandType::kIdx8 : OperandType::kIdx16; |
73 uint32_t operand = GetRawOperand(operand_index, type); | 77 uint32_t operand = GetRawOperand(operand_index, type); |
(...skipping 13 matching lines...) Expand all Loading... |
87 | 91 |
88 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( | 92 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( |
89 int operand_index) const { | 93 int operand_index) const { |
90 Handle<FixedArray> constants = handle(bytecode_array()->constant_pool()); | 94 Handle<FixedArray> constants = handle(bytecode_array()->constant_pool()); |
91 return FixedArray::get(constants, GetIndexOperand(operand_index)); | 95 return FixedArray::get(constants, GetIndexOperand(operand_index)); |
92 } | 96 } |
93 | 97 |
94 } // namespace interpreter | 98 } // namespace interpreter |
95 } // namespace internal | 99 } // namespace internal |
96 } // namespace v8 | 100 } // namespace v8 |
OLD | NEW |