| 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) { | |
| 15 if (!entry.is_valid()) return; | |
| 16 | |
| 17 if (!is_valid() || (entry.is_statement() && !is_statement()) || | |
| 18 (entry.is_statement() && is_statement() && | |
| 19 entry.source_position() > source_position())) { | |
| 20 // Position is updated if any of the following conditions are met: | |
| 21 // (1) there is no existing position. | |
| 22 // (2) the incoming position is a statement and the current position | |
| 23 // is an expression. | |
| 24 // (3) the existing position is a statement and the incoming | |
| 25 // statement has a later source position. | |
| 26 // Condition 3 is needed for the first statement in a function which | |
| 27 // may end up with later statement positions being added during bytecode | |
| 28 // generation. | |
| 29 source_position_ = entry.source_position_; | |
| 30 is_statement_ = entry.is_statement_; | |
| 31 } | |
| 32 } | |
| 33 | |
| 34 BytecodeNode::BytecodeNode(Bytecode bytecode) { | 14 BytecodeNode::BytecodeNode(Bytecode bytecode) { |
| 35 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 0); | 15 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 0); |
| 36 bytecode_ = bytecode; | 16 bytecode_ = bytecode; |
| 37 } | 17 } |
| 38 | 18 |
| 39 BytecodeNode::BytecodeNode(Bytecode bytecode, uint32_t operand0) { | 19 BytecodeNode::BytecodeNode(Bytecode bytecode, uint32_t operand0) { |
| 40 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 1); | 20 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 1); |
| 41 bytecode_ = bytecode; | 21 bytecode_ = bytecode; |
| 42 operands_[0] = operand0; | 22 operands_[0] = operand0; |
| 43 } | 23 } |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 } | 136 } |
| 157 | 137 |
| 158 std::ostream& operator<<(std::ostream& os, const BytecodeNode& node) { | 138 std::ostream& operator<<(std::ostream& os, const BytecodeNode& node) { |
| 159 node.Print(os); | 139 node.Print(os); |
| 160 return os; | 140 return os; |
| 161 } | 141 } |
| 162 | 142 |
| 163 } // namespace interpreter | 143 } // namespace interpreter |
| 164 } // namespace internal | 144 } // namespace internal |
| 165 } // namespace v8 | 145 } // namespace v8 |
| OLD | NEW |