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 if (!entry.is_valid()) return; |
| 16 |
15 if (!is_valid() || (entry.is_statement() && !is_statement()) || | 17 if (!is_valid() || (entry.is_statement() && !is_statement()) || |
16 (entry.is_statement() && is_statement() && | 18 (entry.is_statement() && is_statement() && |
17 entry.source_position() > source_position())) { | 19 entry.source_position() > source_position())) { |
18 // Position is updated if any of the following conditions are met: | 20 // Position is updated if any of the following conditions are met: |
19 // (1) there is no existing position. | 21 // (1) there is no existing position. |
20 // (2) the incoming position is a statement and the current position | 22 // (2) the incoming position is a statement and the current position |
21 // is an expression. | 23 // is an expression. |
22 // (3) the existing position is a statement and the incoming | 24 // (3) the existing position is a statement and the incoming |
23 // statement has a later source position. | 25 // statement has a later source position. |
24 // Condition 3 is needed for the first statement in a function which | 26 // Condition 3 is needed for the first statement in a function which |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 uint32_t operand3, OperandScale operand_scale) { | 70 uint32_t operand3, OperandScale operand_scale) { |
69 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 4); | 71 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 4); |
70 bytecode_ = bytecode; | 72 bytecode_ = bytecode; |
71 operands_[0] = operand0; | 73 operands_[0] = operand0; |
72 operands_[1] = operand1; | 74 operands_[1] = operand1; |
73 operands_[2] = operand2; | 75 operands_[2] = operand2; |
74 operands_[3] = operand3; | 76 operands_[3] = operand3; |
75 operand_scale_ = operand_scale; | 77 operand_scale_ = operand_scale; |
76 } | 78 } |
77 | 79 |
| 80 BytecodeNode::BytecodeNode(const BytecodeNode& other) { |
| 81 memcpy(this, &other, sizeof(other)); |
| 82 } |
| 83 |
| 84 BytecodeNode& BytecodeNode::operator=(const BytecodeNode& other) { |
| 85 memcpy(this, &other, sizeof(other)); |
| 86 return *this; |
| 87 } |
| 88 |
78 void BytecodeNode::set_bytecode(Bytecode bytecode) { | 89 void BytecodeNode::set_bytecode(Bytecode bytecode) { |
79 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 0); | 90 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 0); |
80 bytecode_ = bytecode; | 91 bytecode_ = bytecode; |
81 operand_scale_ = OperandScale::kSingle; | 92 operand_scale_ = OperandScale::kSingle; |
82 } | 93 } |
83 | 94 |
84 void BytecodeNode::set_bytecode(Bytecode bytecode, uint32_t operand0, | 95 void BytecodeNode::set_bytecode(Bytecode bytecode, uint32_t operand0, |
85 OperandScale operand_scale) { | 96 OperandScale operand_scale) { |
86 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 1); | 97 DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), 1); |
87 bytecode_ = bytecode; | 98 bytecode_ = bytecode; |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 if (info.is_valid()) { | 182 if (info.is_valid()) { |
172 char description = info.is_statement() ? 'S' : 'E'; | 183 char description = info.is_statement() ? 'S' : 'E'; |
173 os << info.source_position() << ' ' << description << '>'; | 184 os << info.source_position() << ' ' << description << '>'; |
174 } | 185 } |
175 return os; | 186 return os; |
176 } | 187 } |
177 | 188 |
178 } // namespace interpreter | 189 } // namespace interpreter |
179 } // namespace internal | 190 } // namespace internal |
180 } // namespace v8 | 191 } // namespace v8 |
OLD | NEW |