OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/source-position-table.h" | 5 #include "src/interpreter/source-position-table.h" |
6 | 6 |
7 #include "src/assembler.h" | 7 #include "src/assembler.h" |
8 #include "src/objects-inl.h" | 8 #include "src/objects-inl.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 | 10 |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 DCHECK(bytecode_offset_ < new_bytecode_offset || index_ == 0); | 70 DCHECK(bytecode_offset_ < new_bytecode_offset || index_ == 0); |
71 bytecode_offset_ = new_bytecode_offset; | 71 bytecode_offset_ = new_bytecode_offset; |
72 uint32_t source_position_and_type = | 72 uint32_t source_position_and_type = |
73 static_cast<uint32_t>(Smi::cast(table_->get(index_ + 1))->value()); | 73 static_cast<uint32_t>(Smi::cast(table_->get(index_ + 1))->value()); |
74 is_statement_ = IsStatementField::decode(source_position_and_type); | 74 is_statement_ = IsStatementField::decode(source_position_and_type); |
75 source_position_ = SourcePositionField::decode(source_position_and_type); | 75 source_position_ = SourcePositionField::decode(source_position_and_type); |
76 } | 76 } |
77 index_ += 2; | 77 index_ += 2; |
78 } | 78 } |
79 | 79 |
80 int SourcePositionTableIterator::PositionFromBytecodeOffset( | |
81 BytecodeArray* bytecode_array, int bytecode_offset) { | |
82 int last_position = 0; | |
83 for (SourcePositionTableIterator iterator(bytecode_array); | |
84 !iterator.done() && iterator.bytecode_offset() <= bytecode_offset; | |
85 iterator.Advance()) { | |
86 last_position = iterator.source_position(); | |
87 } | |
88 return last_position; | |
89 } | |
90 | |
91 } // namespace interpreter | 80 } // namespace interpreter |
92 } // namespace internal | 81 } // namespace internal |
93 } // namespace v8 | 82 } // namespace v8 |
OLD | NEW |