Chromium Code Reviews| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 return Register::FromWideOperand(static_cast<uint16_t>(operand)); | 100 return Register::FromWideOperand(static_cast<uint16_t>(operand)); |
| 101 case OperandSize::kNone: | 101 case OperandSize::kNone: |
| 102 UNREACHABLE(); | 102 UNREACHABLE(); |
| 103 } | 103 } |
| 104 return Register(); | 104 return Register(); |
| 105 } | 105 } |
| 106 | 106 |
| 107 | 107 |
| 108 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( | 108 Handle<Object> BytecodeArrayIterator::GetConstantForIndexOperand( |
| 109 int operand_index) const { | 109 int operand_index) const { |
| 110 Handle<FixedArray> constants = handle(bytecode_array()->constant_pool()); | 110 Handle<FixedArray> constants = handle(bytecode_array()->constant_pool()); |
|
rmcilroy
2016/01/26 15:53:27
Just skip the handle creation here and call get on
Jakob Kummerow
2016/01/29 14:31:26
Most excellent point, dunno why I didn't see that
| |
| 111 return FixedArray::get(constants, GetIndexOperand(operand_index)); | 111 return FixedArray::get(*constants, GetIndexOperand(operand_index), |
| 112 constants->GetIsolate()); | |
| 112 } | 113 } |
| 113 | 114 |
| 114 | 115 |
| 115 int BytecodeArrayIterator::GetJumpTargetOffset() const { | 116 int BytecodeArrayIterator::GetJumpTargetOffset() const { |
| 116 Bytecode bytecode = current_bytecode(); | 117 Bytecode bytecode = current_bytecode(); |
| 117 if (interpreter::Bytecodes::IsJumpImmediate(bytecode)) { | 118 if (interpreter::Bytecodes::IsJumpImmediate(bytecode)) { |
| 118 int relative_offset = GetImmediateOperand(0); | 119 int relative_offset = GetImmediateOperand(0); |
| 119 return current_offset() + relative_offset; | 120 return current_offset() + relative_offset; |
| 120 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode) || | 121 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode) || |
| 121 interpreter::Bytecodes::IsJumpConstantWide(bytecode)) { | 122 interpreter::Bytecodes::IsJumpConstantWide(bytecode)) { |
| 122 Smi* smi = Smi::cast(*GetConstantForIndexOperand(0)); | 123 Smi* smi = Smi::cast(*GetConstantForIndexOperand(0)); |
| 123 return current_offset() + smi->value(); | 124 return current_offset() + smi->value(); |
| 124 } else { | 125 } else { |
| 125 UNREACHABLE(); | 126 UNREACHABLE(); |
| 126 return kMinInt; | 127 return kMinInt; |
| 127 } | 128 } |
| 128 } | 129 } |
| 129 | 130 |
| 130 } // namespace interpreter | 131 } // namespace interpreter |
| 131 } // namespace internal | 132 } // namespace internal |
| 132 } // namespace v8 | 133 } // namespace v8 |
| OLD | NEW |