| 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/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/hash_map.h" | 10 #include "vm/hash_map.h" |
| (...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1502 } | 1502 } |
| 1503 } | 1503 } |
| 1504 | 1504 |
| 1505 if ((non_smi_input == kNotFound) || | 1505 if ((non_smi_input == kNotFound) || |
| 1506 (phi->block()->PredecessorAt(non_smi_input) != pre_header)) { | 1506 (phi->block()->PredecessorAt(non_smi_input) != pre_header)) { |
| 1507 return; | 1507 return; |
| 1508 } | 1508 } |
| 1509 | 1509 |
| 1510 // Host CheckSmi instruction and make this phi smi one. | 1510 // Host CheckSmi instruction and make this phi smi one. |
| 1511 Hoist(it, pre_header, current); | 1511 Hoist(it, pre_header, current); |
| 1512 current->SetInputAt(non_smi_input, phi->InputAt(non_smi_input)); | 1512 current->SetInputAt(0, phi->InputAt(non_smi_input)); |
| 1513 phi->SetPropagatedCid(kSmiCid); | 1513 phi->SetPropagatedCid(kSmiCid); |
| 1514 } | 1514 } |
| 1515 | 1515 |
| 1516 | 1516 |
| 1517 void LICM::Optimize(FlowGraph* flow_graph) { | 1517 void LICM::Optimize(FlowGraph* flow_graph) { |
| 1518 GrowableArray<BlockEntryInstr*> loop_headers; | 1518 GrowableArray<BlockEntryInstr*> loop_headers; |
| 1519 flow_graph->ComputeLoops(&loop_headers); | 1519 flow_graph->ComputeLoops(&loop_headers); |
| 1520 | 1520 |
| 1521 for (intptr_t i = 0; i < loop_headers.length(); ++i) { | 1521 for (intptr_t i = 0; i < loop_headers.length(); ++i) { |
| 1522 BlockEntryInstr* header = loop_headers[i]; | 1522 BlockEntryInstr* header = loop_headers[i]; |
| (...skipping 933 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2456 it.Advance()) { | 2456 it.Advance()) { |
| 2457 JoinEntryInstr* join = it.Current()->AsJoinEntry(); | 2457 JoinEntryInstr* join = it.Current()->AsJoinEntry(); |
| 2458 if (join != NULL) join->EliminateUnreachablePhiInputs(); | 2458 if (join != NULL) join->EliminateUnreachablePhiInputs(); |
| 2459 } | 2459 } |
| 2460 | 2460 |
| 2461 graph_->ComputeUseLists(); | 2461 graph_->ComputeUseLists(); |
| 2462 } | 2462 } |
| 2463 | 2463 |
| 2464 | 2464 |
| 2465 } // namespace dart | 2465 } // namespace dart |
| OLD | NEW |