| 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 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 204 | 204 |
| 205 // Use propagated class-ids to optimize further. | 205 // Use propagated class-ids to optimize further. |
| 206 optimizer.ApplyClassIds(); | 206 optimizer.ApplyClassIds(); |
| 207 | 207 |
| 208 // Recompute use lists after applying class ids. | 208 // Recompute use lists after applying class ids. |
| 209 flow_graph->ComputeUseLists(); | 209 flow_graph->ComputeUseLists(); |
| 210 | 210 |
| 211 // Do optimizations that depend on the propagated type information. | 211 // Do optimizations that depend on the propagated type information. |
| 212 optimizer.Canonicalize(); | 212 optimizer.Canonicalize(); |
| 213 | 213 |
| 214 // Unbox doubles. | |
| 215 flow_graph->ComputeUseLists(); | 214 flow_graph->ComputeUseLists(); |
| 216 optimizer.SelectRepresentations(); | |
| 217 | 215 |
| 218 if (FLAG_constant_propagation || | |
| 219 FLAG_common_subexpression_elimination) { | |
| 220 flow_graph->ComputeUseLists(); | |
| 221 } | |
| 222 if (FLAG_constant_propagation) { | 216 if (FLAG_constant_propagation) { |
| 223 ConstantPropagator::Optimize(flow_graph); | 217 ConstantPropagator::Optimize(flow_graph); |
| 224 // A canonicalization pass to remove e.g. smi checks on smi constants. | 218 // A canonicalization pass to remove e.g. smi checks on smi constants. |
| 225 optimizer.Canonicalize(); | 219 optimizer.Canonicalize(); |
| 226 } | 220 } |
| 221 |
| 222 // Unbox doubles. Performed after constant propagation to minimize |
| 223 // interference from phis merging double values and tagged |
| 224 // values comming from dead paths. |
| 225 optimizer.SelectRepresentations(); |
| 226 flow_graph->ComputeUseLists(); |
| 227 |
| 227 if (FLAG_common_subexpression_elimination) { | 228 if (FLAG_common_subexpression_elimination) { |
| 228 if (DominatorBasedCSE::Optimize(flow_graph)) { | 229 if (DominatorBasedCSE::Optimize(flow_graph)) { |
| 229 // Do another round of CSE to take secondary effects into account: | 230 // Do another round of CSE to take secondary effects into account: |
| 230 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) | 231 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) |
| 231 // TODO(fschneider): Change to a one-pass optimization pass. | 232 // TODO(fschneider): Change to a one-pass optimization pass. |
| 232 DominatorBasedCSE::Optimize(flow_graph); | 233 DominatorBasedCSE::Optimize(flow_graph); |
| 233 } | 234 } |
| 234 } | 235 } |
| 235 if (FLAG_loop_invariant_code_motion && | 236 if (FLAG_loop_invariant_code_motion && |
| 236 (parsed_function.function().deoptimization_counter() < | 237 (parsed_function.function().deoptimization_counter() < |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 640 Object::Handle(isolate->object_store()->sticky_error()); | 641 Object::Handle(isolate->object_store()->sticky_error()); |
| 641 isolate->object_store()->clear_sticky_error(); | 642 isolate->object_store()->clear_sticky_error(); |
| 642 isolate->set_long_jump_base(base); | 643 isolate->set_long_jump_base(base); |
| 643 return result.raw(); | 644 return result.raw(); |
| 644 } | 645 } |
| 645 UNREACHABLE(); | 646 UNREACHABLE(); |
| 646 return Object::null(); | 647 return Object::null(); |
| 647 } | 648 } |
| 648 | 649 |
| 649 } // namespace dart | 650 } // namespace dart |
| OLD | NEW |