| 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-pipeline.h" | 5 #include "src/interpreter/bytecode-pipeline.h" |
| 6 | 6 |
| 7 #include <iomanip> | 7 #include <iomanip> |
| 8 #include "src/interpreter/source-position-table.h" | 8 #include "src/interpreter/source-position-table.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| 11 namespace internal { | 11 namespace internal { |
| 12 namespace interpreter { | 12 namespace interpreter { |
| 13 | 13 |
| 14 void BytecodeSourceInfo::Update(const BytecodeSourceInfo& entry) { | 14 void BytecodeSourceInfo::Update(const BytecodeSourceInfo& entry) { |
| 15 DCHECK(entry.is_valid()); | 15 if (!entry.is_valid()) return; |
| 16 if (!is_valid() || (entry.is_statement() && !is_statement()) || | 16 if (!is_valid() || (entry.is_statement() && !is_statement()) || |
| 17 (entry.is_statement() && is_statement() && | 17 (entry.is_statement() && is_statement() && |
| 18 entry.source_position() > source_position())) { | 18 entry.source_position() > source_position())) { |
| 19 // Position is updated if any of the following conditions are met: | 19 // Position is updated if any of the following conditions are met: |
| 20 // (1) there is no existing position. | 20 // (1) there is no existing position. |
| 21 // (2) the incoming position is a statement and the current position | 21 // (2) the incoming position is a statement and the current position |
| 22 // is an expression. | 22 // is an expression. |
| 23 // (3) the existing position is a statement and the incoming | 23 // (3) the existing position is a statement and the incoming |
| 24 // statement has a later source position. | 24 // statement has a later source position. |
| 25 // Condition 3 is needed for the first statement in a function which | 25 // Condition 3 is needed for the first statement in a function which |
| (...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 153 if (info.is_valid()) { | 153 if (info.is_valid()) { |
| 154 char description = info.is_statement() ? 'S' : 'E'; | 154 char description = info.is_statement() ? 'S' : 'E'; |
| 155 os << info.source_position() << ' ' << description << '>'; | 155 os << info.source_position() << ' ' << description << '>'; |
| 156 } | 156 } |
| 157 return os; | 157 return os; |
| 158 } | 158 } |
| 159 | 159 |
| 160 } // namespace interpreter | 160 } // namespace interpreter |
| 161 } // namespace internal | 161 } // namespace internal |
| 162 } // namespace v8 | 162 } // namespace v8 |
| OLD | NEW |