| 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/constant_propagator.h" | 5 #include "vm/constant_propagator.h" |
| 6 | 6 |
| 7 #include "vm/bit_vector.h" | 7 #include "vm/bit_vector.h" |
| 8 #include "vm/flow_graph_builder.h" | 8 #include "vm/flow_graph_builder.h" |
| 9 #include "vm/flow_graph_compiler.h" | 9 #include "vm/flow_graph_compiler.h" |
| 10 #include "vm/flow_graph_range_analysis.h" | 10 #include "vm/flow_graph_range_analysis.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 Smi::Handle(Z, Smi::New(0))); | 526 Smi::Handle(Z, Smi::New(0))); |
| 527 SetValue(instr, result ? Bool::True() : Bool::False()); | 527 SetValue(instr, result ? Bool::True() : Bool::False()); |
| 528 } else { | 528 } else { |
| 529 SetValue(instr, non_constant_); | 529 SetValue(instr, non_constant_); |
| 530 } | 530 } |
| 531 } | 531 } |
| 532 } | 532 } |
| 533 | 533 |
| 534 | 534 |
| 535 void ConstantPropagator::VisitTestCids(TestCidsInstr* instr) { | 535 void ConstantPropagator::VisitTestCids(TestCidsInstr* instr) { |
| 536 // TODO(sra): Constant fold test. |
| 536 SetValue(instr, non_constant_); | 537 SetValue(instr, non_constant_); |
| 537 } | 538 } |
| 538 | 539 |
| 539 | 540 |
| 540 void ConstantPropagator::VisitEqualityCompare(EqualityCompareInstr* instr) { | 541 void ConstantPropagator::VisitEqualityCompare(EqualityCompareInstr* instr) { |
| 541 Definition* left_defn = instr->left()->definition(); | 542 Definition* left_defn = instr->left()->definition(); |
| 542 Definition* right_defn = instr->right()->definition(); | 543 Definition* right_defn = instr->right()->definition(); |
| 543 | 544 |
| 544 if (RawObject::IsIntegerClassId(instr->operation_cid())) { | 545 if (RawObject::IsIntegerClassId(instr->operation_cid())) { |
| 545 // Fold x == x, and x != x to true/false for numbers comparisons. | 546 // Fold x == x, and x != x to true/false for numbers comparisons. |
| (...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1685 graph_->MergeBlocks(); | 1686 graph_->MergeBlocks(); |
| 1686 GrowableArray<BitVector*> dominance_frontier; | 1687 GrowableArray<BitVector*> dominance_frontier; |
| 1687 graph_->ComputeDominators(&dominance_frontier); | 1688 graph_->ComputeDominators(&dominance_frontier); |
| 1688 | 1689 |
| 1689 if (FLAG_trace_constant_propagation) { | 1690 if (FLAG_trace_constant_propagation) { |
| 1690 FlowGraphPrinter::PrintGraph("After CP", graph_); | 1691 FlowGraphPrinter::PrintGraph("After CP", graph_); |
| 1691 } | 1692 } |
| 1692 } | 1693 } |
| 1693 | 1694 |
| 1694 } // namespace dart | 1695 } // namespace dart |
| OLD | NEW |