| 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/flow_graph_compiler.h" | 10 #include "vm/flow_graph_compiler.h" |
| (...skipping 1651 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1662 | 1662 |
| 1663 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { | 1663 for (ForwardInstructionIterator it(block); !it.Done(); it.Advance()) { |
| 1664 Instruction* instr = it.Current(); | 1664 Instruction* instr = it.Current(); |
| 1665 if (instr->IsCheckSmi()) { | 1665 if (instr->IsCheckSmi()) { |
| 1666 const intptr_t value_ssa_index = | 1666 const intptr_t value_ssa_index = |
| 1667 instr->InputAt(0)->definition()->ssa_temp_index(); | 1667 instr->InputAt(0)->definition()->ssa_temp_index(); |
| 1668 if (!known_smis_->Contains(value_ssa_index)) { | 1668 if (!known_smis_->Contains(value_ssa_index)) { |
| 1669 known_smis_->Add(value_ssa_index); | 1669 known_smis_->Add(value_ssa_index); |
| 1670 rollback_checks_.Add(value_ssa_index); | 1670 rollback_checks_.Add(value_ssa_index); |
| 1671 } | 1671 } |
| 1672 } else if (instr->IsBranch()) { |
| 1673 for (intptr_t i = 0; i < instr->InputCount(); i++) { |
| 1674 Value* use = instr->InputAt(i); |
| 1675 if (known_smis_->Contains(use->definition()->ssa_temp_index())) { |
| 1676 use->set_reaching_cid(kSmiCid); |
| 1677 } |
| 1678 } |
| 1672 } | 1679 } |
| 1673 } | 1680 } |
| 1674 | 1681 |
| 1675 for (intptr_t i = 0; i < block->dominated_blocks().length(); ++i) { | 1682 for (intptr_t i = 0; i < block->dominated_blocks().length(); ++i) { |
| 1676 PropagateSminessRecursive(block->dominated_blocks()[i]); | 1683 PropagateSminessRecursive(block->dominated_blocks()[i]); |
| 1677 } | 1684 } |
| 1678 | 1685 |
| 1679 if (block->last_instruction()->SuccessorCount() == 1 && | 1686 if (block->last_instruction()->SuccessorCount() == 1 && |
| 1680 block->last_instruction()->SuccessorAt(0)->IsJoinEntry()) { | 1687 block->last_instruction()->SuccessorAt(0)->IsJoinEntry()) { |
| 1681 JoinEntryInstr* join = | 1688 JoinEntryInstr* join = |
| (...skipping 2233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3915 | 3922 |
| 3916 if (FLAG_trace_constant_propagation) { | 3923 if (FLAG_trace_constant_propagation) { |
| 3917 OS::Print("\n==== After constant propagation ====\n"); | 3924 OS::Print("\n==== After constant propagation ====\n"); |
| 3918 FlowGraphPrinter printer(*graph_); | 3925 FlowGraphPrinter printer(*graph_); |
| 3919 printer.PrintBlocks(); | 3926 printer.PrintBlocks(); |
| 3920 } | 3927 } |
| 3921 } | 3928 } |
| 3922 | 3929 |
| 3923 | 3930 |
| 3924 } // namespace dart | 3931 } // namespace dart |
| OLD | NEW |