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-peephole-optimizer.h" | 5 #include "src/interpreter/bytecode-peephole-optimizer.h" |
6 | 6 |
7 #include "src/interpreter/constant-array-builder.h" | 7 #include "src/interpreter/constant-array-builder.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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
159 UpdateCurrentBytecode(current); | 159 UpdateCurrentBytecode(current); |
160 | 160 |
161 if (CanElideCurrent(current)) { | 161 if (CanElideCurrent(current)) { |
162 if (current->source_info().is_valid()) { | 162 if (current->source_info().is_valid()) { |
163 current->set_bytecode(Bytecode::kNop); | 163 current->set_bytecode(Bytecode::kNop); |
164 } else { | 164 } else { |
165 current = nullptr; | 165 current = nullptr; |
166 } | 166 } |
167 } else if (CanElideLast(current)) { | 167 } else if (CanElideLast(current)) { |
168 if (last_.source_info().is_valid()) { | 168 if (last_.source_info().is_valid()) { |
169 current->source_info().Update(last_.source_info()); | 169 if (current->source_info().is_valid() && |
170 current->source_info() != last_.source_info()) { | |
rmcilroy
2016/05/20 11:08:03
I think this would be clearer as:
// The last byt
oth
2016/05/20 14:56:43
Revised with a simpler path that produces the same
| |
171 // The last bytecode can't be elided without dropping a source | |
172 // position. | |
173 return current; | |
174 } else { | |
175 // Transfer source position from bytecode that's being dropped | |
176 // to it's successor. | |
177 current->source_info().Update(last_.source_info()); | |
178 } | |
170 } | 179 } |
171 InvalidateLast(); | 180 InvalidateLast(); |
172 } | 181 } |
173 return current; | 182 return current; |
174 } | 183 } |
175 | 184 |
176 } // namespace interpreter | 185 } // namespace interpreter |
177 } // namespace internal | 186 } // namespace internal |
178 } // namespace v8 | 187 } // namespace v8 |
OLD | NEW |