| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #include "vm/compiler.h" | 5 #include "vm/compiler.h" |
| 6 | 6 |
| 7 #include "vm/assembler.h" | 7 #include "vm/assembler.h" |
| 8 | 8 |
| 9 #include "vm/ast_printer.h" | 9 #include "vm/ast_printer.h" |
| 10 #include "vm/code_generator.h" | 10 #include "vm/code_generator.h" |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 if (FLAG_constant_propagation || | 208 if (FLAG_constant_propagation || |
| 209 FLAG_common_subexpression_elimination) { | 209 FLAG_common_subexpression_elimination) { |
| 210 flow_graph->ComputeUseLists(); | 210 flow_graph->ComputeUseLists(); |
| 211 } | 211 } |
| 212 if (FLAG_constant_propagation) { | 212 if (FLAG_constant_propagation) { |
| 213 ConstantPropagator::Optimize(flow_graph); | 213 ConstantPropagator::Optimize(flow_graph); |
| 214 // A canonicalization pass to remove e.g. smi checks on smi constants. | 214 // A canonicalization pass to remove e.g. smi checks on smi constants. |
| 215 optimizer.OptimizeComputations(); | 215 optimizer.OptimizeComputations(); |
| 216 } | 216 } |
| 217 if (FLAG_common_subexpression_elimination) { | 217 if (FLAG_common_subexpression_elimination) { |
| 218 DominatorBasedCSE::Optimize(flow_graph); | 218 if (DominatorBasedCSE::Optimize(flow_graph)) { |
| 219 // Do another round of CSE to take secondary effects into account: |
| 220 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) |
| 221 // TODO(fschneider): Change to a one-pass optimization pass. |
| 222 DominatorBasedCSE::Optimize(flow_graph); |
| 223 } |
| 219 } | 224 } |
| 220 if (FLAG_loop_invariant_code_motion && | 225 if (FLAG_loop_invariant_code_motion && |
| 221 (parsed_function.function().deoptimization_counter() < | 226 (parsed_function.function().deoptimization_counter() < |
| 222 (FLAG_deoptimization_counter_threshold - 1))) { | 227 (FLAG_deoptimization_counter_threshold - 1))) { |
| 223 LICM::Optimize(flow_graph); | 228 LICM::Optimize(flow_graph); |
| 224 } | 229 } |
| 225 | 230 |
| 226 if (FLAG_range_analysis) { | 231 if (FLAG_range_analysis) { |
| 227 // We have to perform range analysis after LICM because it | 232 // We have to perform range analysis after LICM because it |
| 228 // optimistically moves CheckSmi through phis into loop preheaders | 233 // optimistically moves CheckSmi through phis into loop preheaders |
| (...skipping 360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 result = isolate->object_store()->sticky_error(); | 594 result = isolate->object_store()->sticky_error(); |
| 590 isolate->object_store()->clear_sticky_error(); | 595 isolate->object_store()->clear_sticky_error(); |
| 591 isolate->set_long_jump_base(base); | 596 isolate->set_long_jump_base(base); |
| 592 return result.raw(); | 597 return result.raw(); |
| 593 } | 598 } |
| 594 UNREACHABLE(); | 599 UNREACHABLE(); |
| 595 return Object::null(); | 600 return Object::null(); |
| 596 } | 601 } |
| 597 | 602 |
| 598 } // namespace dart | 603 } // namespace dart |
| OLD | NEW |