| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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/flow_graph_optimizer.h" | 5 #include "vm/flow_graph_optimizer.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/cha.h" | 8 #include "vm/cha.h" |
| 9 #include "vm/flow_graph_builder.h" | 9 #include "vm/flow_graph_builder.h" |
| 10 #include "vm/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 2625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2636 | 2636 |
| 2637 // Host CheckSmi instruction and make this phi smi one. | 2637 // Host CheckSmi instruction and make this phi smi one. |
| 2638 Hoist(it, pre_header, current); | 2638 Hoist(it, pre_header, current); |
| 2639 | 2639 |
| 2640 // Replace value we are checking with phi's input. Maintain use lists. | 2640 // Replace value we are checking with phi's input. Maintain use lists. |
| 2641 Definition* non_smi_input_defn = phi->InputAt(non_smi_input)->definition(); | 2641 Definition* non_smi_input_defn = phi->InputAt(non_smi_input)->definition(); |
| 2642 current->value()->RemoveFromUseList(); | 2642 current->value()->RemoveFromUseList(); |
| 2643 current->value()->set_definition(non_smi_input_defn); | 2643 current->value()->set_definition(non_smi_input_defn); |
| 2644 non_smi_input_defn->AddInputUse(current->value()); | 2644 non_smi_input_defn->AddInputUse(current->value()); |
| 2645 | 2645 |
| 2646 phi->Type()->ReplaceWith(CompileType::FromCid(kSmiCid)); | 2646 phi->UpdateType(CompileType::FromCid(kSmiCid)); |
| 2647 } | 2647 } |
| 2648 | 2648 |
| 2649 | 2649 |
| 2650 void LICM::Optimize(FlowGraph* flow_graph) { | 2650 void LICM::Optimize(FlowGraph* flow_graph) { |
| 2651 GrowableArray<BlockEntryInstr*> loop_headers; | 2651 GrowableArray<BlockEntryInstr*> loop_headers; |
| 2652 flow_graph->ComputeLoops(&loop_headers); | 2652 flow_graph->ComputeLoops(&loop_headers); |
| 2653 | 2653 |
| 2654 for (intptr_t i = 0; i < loop_headers.length(); ++i) { | 2654 for (intptr_t i = 0; i < loop_headers.length(); ++i) { |
| 2655 BlockEntryInstr* header = loop_headers[i]; | 2655 BlockEntryInstr* header = loop_headers[i]; |
| 2656 // Skip loop that don't have a pre-header block. | 2656 // Skip loop that don't have a pre-header block. |
| (...skipping 1600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4257 | 4257 |
| 4258 if (FLAG_trace_constant_propagation) { | 4258 if (FLAG_trace_constant_propagation) { |
| 4259 OS::Print("\n==== After constant propagation ====\n"); | 4259 OS::Print("\n==== After constant propagation ====\n"); |
| 4260 FlowGraphPrinter printer(*graph_); | 4260 FlowGraphPrinter printer(*graph_); |
| 4261 printer.PrintBlocks(); | 4261 printer.PrintBlocks(); |
| 4262 } | 4262 } |
| 4263 } | 4263 } |
| 4264 | 4264 |
| 4265 | 4265 |
| 4266 } // namespace dart | 4266 } // namespace dart |
| OLD | NEW |