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-accessor.h" | 5 #include "src/interpreter/bytecode-array-accessor.h" |
6 | 6 |
7 #include "src/interpreter/bytecode-decoder.h" | 7 #include "src/interpreter/bytecode-decoder.h" |
8 #include "src/interpreter/interpreter-intrinsics.h" | 8 #include "src/interpreter/interpreter-intrinsics.h" |
9 #include "src/objects-inl.h" | 9 #include "src/objects-inl.h" |
10 | 10 |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 return current_offset() + relative_offset + current_prefix_offset(); | 182 return current_offset() + relative_offset + current_prefix_offset(); |
183 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) { | 183 } else if (interpreter::Bytecodes::IsJumpConstant(bytecode)) { |
184 Smi* smi = Smi::cast(*GetConstantForIndexOperand(0)); | 184 Smi* smi = Smi::cast(*GetConstantForIndexOperand(0)); |
185 return current_offset() + smi->value() + current_prefix_offset(); | 185 return current_offset() + smi->value() + current_prefix_offset(); |
186 } else { | 186 } else { |
187 UNREACHABLE(); | 187 UNREACHABLE(); |
188 return kMinInt; | 188 return kMinInt; |
189 } | 189 } |
190 } | 190 } |
191 | 191 |
| 192 bool BytecodeArrayAccessor::OffsetWithinBytecode(int offset) const { |
| 193 return current_offset() <= offset && |
| 194 offset < current_offset() + current_bytecode_size(); |
| 195 } |
| 196 |
192 std::ostream& BytecodeArrayAccessor::PrintTo(std::ostream& os) const { | 197 std::ostream& BytecodeArrayAccessor::PrintTo(std::ostream& os) const { |
193 return BytecodeDecoder::Decode( | 198 return BytecodeDecoder::Decode( |
194 os, bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_, | 199 os, bytecode_array()->GetFirstBytecodeAddress() + bytecode_offset_, |
195 bytecode_array()->parameter_count()); | 200 bytecode_array()->parameter_count()); |
196 } | 201 } |
197 | 202 |
198 } // namespace interpreter | 203 } // namespace interpreter |
199 } // namespace internal | 204 } // namespace internal |
200 } // namespace v8 | 205 } // namespace v8 |
OLD | NEW |