| 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 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 return Register::FromOperand(operand); | 88 return Register::FromOperand(operand); |
| 89 } | 89 } |
| 90 | 90 |
| 91 | 91 |
| 92 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( | 92 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( |
| 93 int operand_index) const { | 93 int operand_index) const { |
| 94 Handle<FixedArray> constants = handle(bytecode_array()->constant_pool()); | 94 Handle<FixedArray> constants = handle(bytecode_array()->constant_pool()); |
| 95 return FixedArray::get(constants, GetIndexOperand(operand_index)); | 95 return FixedArray::get(constants, GetIndexOperand(operand_index)); |
| 96 } | 96 } |
| 97 | 97 |
| 98 |
| 99 int BytecodeArrayIterator::GetJumpTargetOffset() const { |
| 100 Bytecode bytecode = current_bytecode(); |
| 101 if (interpreter::Bytecodes::IsJumpImmediate(bytecode)) { |
| 102 int relative_offset = GetImmediateOperand(0); |
| 103 return current_offset() + relative_offset; |
| 104 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) { |
| 105 Smi* smi = Smi::cast(*GetConstantForIndexOperand(0)); |
| 106 return current_offset() + smi->value(); |
| 107 } else { |
| 108 UNREACHABLE(); |
| 109 return kMinInt; |
| 110 } |
| 111 } |
| 112 |
| 98 } // namespace interpreter | 113 } // namespace interpreter |
| 99 } // namespace internal | 114 } // namespace internal |
| 100 } // namespace v8 | 115 } // namespace v8 |
| OLD | NEW |