Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(199)

Side by Side Diff: src/interpreter/bytecode-pipeline.cc

Issue 1998203002: [Interpreter] Preserve source positions in peephole optimizer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Nitlet on last patch set. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/interpreter/bytecode-pipeline.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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());
16 if (!is_valid() || (entry.is_statement() && !is_statement()) || 15 if (!is_valid() || (entry.is_statement() && !is_statement()) ||
17 (entry.is_statement() && is_statement() && 16 (entry.is_statement() && is_statement() &&
18 entry.source_position() > source_position())) { 17 entry.source_position() > source_position())) {
19 // Position is updated if any of the following conditions are met: 18 // Position is updated if any of the following conditions are met:
20 // (1) there is no existing position. 19 // (1) there is no existing position.
21 // (2) the incoming position is a statement and the current position 20 // (2) the incoming position is a statement and the current position
22 // is an expression. 21 // is an expression.
23 // (3) the existing position is a statement and the incoming 22 // (3) the existing position is a statement and the incoming
24 // statement has a later source position. 23 // statement has a later source position.
25 // Condition 3 is needed for the first statement in a function which 24 // Condition 3 is needed for the first statement in a function which
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 Bytecodes::OperandScaleToPrefixBytecode(operand_scale_); 108 Bytecodes::OperandScaleToPrefixBytecode(operand_scale_);
110 os << '.' << Bytecodes::ToString(scale_prefix); 109 os << '.' << Bytecodes::ToString(scale_prefix);
111 } 110 }
112 111
113 for (int i = 0; i < operand_count(); ++i) { 112 for (int i = 0; i < operand_count(); ++i) {
114 os << ' ' << std::setw(8) << std::setfill('0') << std::hex << operands_[i]; 113 os << ' ' << std::setw(8) << std::setfill('0') << std::hex << operands_[i];
115 } 114 }
116 os.copyfmt(saved_state); 115 os.copyfmt(saved_state);
117 116
118 if (source_info_.is_valid()) { 117 if (source_info_.is_valid()) {
119 os << source_info_; 118 os << ' ' << source_info_;
120 } 119 }
121 os << '\n'; 120 os << '\n';
122 #else 121 #else
123 os << static_cast<const void*>(this); 122 os << static_cast<const void*>(this);
124 #endif // DEBUG 123 #endif // DEBUG
125 } 124 }
126 125
127 void BytecodeNode::Clone(const BytecodeNode* const other) { 126 void BytecodeNode::Clone(const BytecodeNode* const other) {
128 memcpy(this, other, sizeof(*other)); 127 memcpy(this, other, sizeof(*other));
129 } 128 }
(...skipping 23 matching lines...) Expand all
153 if (info.is_valid()) { 152 if (info.is_valid()) {
154 char description = info.is_statement() ? 'S' : 'E'; 153 char description = info.is_statement() ? 'S' : 'E';
155 os << info.source_position() << ' ' << description << '>'; 154 os << info.source_position() << ' ' << description << '>';
156 } 155 }
157 return os; 156 return os;
158 } 157 }
159 158
160 } // namespace interpreter 159 } // namespace interpreter
161 } // namespace internal 160 } // namespace internal
162 } // namespace v8 161 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/bytecode-pipeline.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698