| 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/block_scheduler.h" | 10 #include "vm/block_scheduler.h" |
| (...skipping 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 597 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 598 | 598 |
| 599 if (FLAG_common_subexpression_elimination || | 599 if (FLAG_common_subexpression_elimination || |
| 600 FLAG_loop_invariant_code_motion) { | 600 FLAG_loop_invariant_code_motion) { |
| 601 flow_graph->ComputeBlockEffects(); | 601 flow_graph->ComputeBlockEffects(); |
| 602 } | 602 } |
| 603 | 603 |
| 604 if (FLAG_common_subexpression_elimination) { | 604 if (FLAG_common_subexpression_elimination) { |
| 605 if (DominatorBasedCSE::Optimize(flow_graph)) { | 605 if (DominatorBasedCSE::Optimize(flow_graph)) { |
| 606 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 606 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 607 optimizer.Canonicalize(); |
| 607 // Do another round of CSE to take secondary effects into account: | 608 // Do another round of CSE to take secondary effects into account: |
| 608 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) | 609 // e.g. when eliminating dependent loads (a.x[0] + a.x[0]) |
| 609 // TODO(fschneider): Change to a one-pass optimization pass. | 610 // TODO(fschneider): Change to a one-pass optimization pass. |
| 610 DominatorBasedCSE::Optimize(flow_graph); | 611 if (DominatorBasedCSE::Optimize(flow_graph)) { |
| 612 optimizer.Canonicalize(); |
| 613 } |
| 611 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 614 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| 612 } | 615 } |
| 613 } | 616 } |
| 614 | 617 |
| 615 // Run loop-invariant code motion right after load elimination since it | 618 // Run loop-invariant code motion right after load elimination since it |
| 616 // depends on the numbering of loads from the previous load-elimination. | 619 // depends on the numbering of loads from the previous load-elimination. |
| 617 if (FLAG_loop_invariant_code_motion) { | 620 if (FLAG_loop_invariant_code_motion) { |
| 618 LICM licm(flow_graph); | 621 LICM licm(flow_graph); |
| 619 licm.Optimize(); | 622 licm.Optimize(); |
| 620 DEBUG_ASSERT(flow_graph->VerifyUseLists()); | 623 DEBUG_ASSERT(flow_graph->VerifyUseLists()); |
| (...skipping 1207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1828 isolate->set_background_compiler(task); | 1831 isolate->set_background_compiler(task); |
| 1829 start_task = true; | 1832 start_task = true; |
| 1830 } | 1833 } |
| 1831 } | 1834 } |
| 1832 if (start_task) { | 1835 if (start_task) { |
| 1833 Dart::thread_pool()->Run(isolate->background_compiler()); | 1836 Dart::thread_pool()->Run(isolate->background_compiler()); |
| 1834 } | 1837 } |
| 1835 } | 1838 } |
| 1836 | 1839 |
| 1837 } // namespace dart | 1840 } // namespace dart |
| OLD | NEW |