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 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
157 | 157 |
158 BytecodeNode* BytecodePeepholeOptimizer::Optimize(BytecodeNode* current) { | 158 BytecodeNode* BytecodePeepholeOptimizer::Optimize(BytecodeNode* current) { |
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 ((last_.source_info().is_valid() != |
169 current->source_info().Update(last_.source_info()); | 169 current->source_info().is_valid()) || |
170 } | 170 (last_.source_info() == current->source_info()))) { |
rmcilroy
2016/05/20 16:31:13
nit - could we just move the source position check
oth
2016/05/21 12:40:10
Done.
| |
171 current->source_info().Update(last_.source_info()); | |
171 InvalidateLast(); | 172 InvalidateLast(); |
172 } | 173 } |
173 return current; | 174 return current; |
174 } | 175 } |
175 | 176 |
176 } // namespace interpreter | 177 } // namespace interpreter |
177 } // namespace internal | 178 } // namespace internal |
178 } // namespace v8 | 179 } // namespace v8 |
OLD | NEW |