| 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 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 return GetCountOperand(operand_index + 1); | 126 return GetCountOperand(operand_index + 1); |
| 127 } | 127 } |
| 128 } | 128 } |
| 129 return 1; | 129 return 1; |
| 130 } | 130 } |
| 131 } | 131 } |
| 132 } | 132 } |
| 133 | 133 |
| 134 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( | 134 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( |
| 135 int operand_index) const { | 135 int operand_index) const { |
| 136 Handle<FixedArray> constants = handle(bytecode_array()->constant_pool()); | 136 return FixedArray::get(bytecode_array()->constant_pool(), |
| 137 return FixedArray::get(constants, GetIndexOperand(operand_index)); | 137 GetIndexOperand(operand_index), |
| 138 bytecode_array()->GetIsolate()); |
| 138 } | 139 } |
| 139 | 140 |
| 140 | 141 |
| 141 int BytecodeArrayIterator::GetJumpTargetOffset() const { | 142 int BytecodeArrayIterator::GetJumpTargetOffset() const { |
| 142 Bytecode bytecode = current_bytecode(); | 143 Bytecode bytecode = current_bytecode(); |
| 143 if (interpreter::Bytecodes::IsJumpImmediate(bytecode)) { | 144 if (interpreter::Bytecodes::IsJumpImmediate(bytecode)) { |
| 144 int relative_offset = GetImmediateOperand(0); | 145 int relative_offset = GetImmediateOperand(0); |
| 145 return current_offset() + relative_offset; | 146 return current_offset() + relative_offset; |
| 146 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode) || | 147 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode) || |
| 147 interpreter::Bytecodes::IsJumpConstantWide(bytecode)) { | 148 interpreter::Bytecodes::IsJumpConstantWide(bytecode)) { |
| 148 Smi* smi = Smi::cast(*GetConstantForIndexOperand(0)); | 149 Smi* smi = Smi::cast(*GetConstantForIndexOperand(0)); |
| 149 return current_offset() + smi->value(); | 150 return current_offset() + smi->value(); |
| 150 } else { | 151 } else { |
| 151 UNREACHABLE(); | 152 UNREACHABLE(); |
| 152 return kMinInt; | 153 return kMinInt; |
| 153 } | 154 } |
| 154 } | 155 } |
| 155 | 156 |
| 156 } // namespace interpreter | 157 } // namespace interpreter |
| 157 } // namespace internal | 158 } // namespace internal |
| 158 } // namespace v8 | 159 } // namespace v8 |
| OLD | NEW |