| 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 2883 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2894 } | 2894 } |
| 2895 | 2895 |
| 2896 | 2896 |
| 2897 void ConstantPropagator::VisitUnboxedMintBinaryOp( | 2897 void ConstantPropagator::VisitUnboxedMintBinaryOp( |
| 2898 UnboxedMintBinaryOpInstr* instr) { | 2898 UnboxedMintBinaryOpInstr* instr) { |
| 2899 // TODO(kmillikin): Handle binary operations. | 2899 // TODO(kmillikin): Handle binary operations. |
| 2900 SetValue(instr, non_constant_); | 2900 SetValue(instr, non_constant_); |
| 2901 } | 2901 } |
| 2902 | 2902 |
| 2903 | 2903 |
| 2904 void ConstantPropagator::VisitBinaryMintOp(BinaryMintOpInstr* instr) { | |
| 2905 const Object& left = instr->left()->definition()->constant_value(); | |
| 2906 const Object& right = instr->right()->definition()->constant_value(); | |
| 2907 if (IsNonConstant(left) || IsNonConstant(right)) { | |
| 2908 SetValue(instr, non_constant_); | |
| 2909 } else if (IsConstant(left) && IsConstant(right)) { | |
| 2910 // TODO(kmillikin): Handle binary operations. | |
| 2911 SetValue(instr, non_constant_); | |
| 2912 } | |
| 2913 } | |
| 2914 | |
| 2915 | |
| 2916 void ConstantPropagator::VisitUnarySmiOp(UnarySmiOpInstr* instr) { | 2904 void ConstantPropagator::VisitUnarySmiOp(UnarySmiOpInstr* instr) { |
| 2917 const Object& value = instr->value()->definition()->constant_value(); | 2905 const Object& value = instr->value()->definition()->constant_value(); |
| 2918 if (IsNonConstant(value)) { | 2906 if (IsNonConstant(value)) { |
| 2919 SetValue(instr, non_constant_); | 2907 SetValue(instr, non_constant_); |
| 2920 } else if (IsConstant(value)) { | 2908 } else if (IsConstant(value)) { |
| 2921 // TODO(kmillikin): Handle unary operations. | 2909 // TODO(kmillikin): Handle unary operations. |
| 2922 SetValue(instr, non_constant_); | 2910 SetValue(instr, non_constant_); |
| 2923 } | 2911 } |
| 2924 } | 2912 } |
| 2925 | 2913 |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3149 | 3137 |
| 3150 if (FLAG_trace_constant_propagation) { | 3138 if (FLAG_trace_constant_propagation) { |
| 3151 OS::Print("\n==== After constant propagation ====\n"); | 3139 OS::Print("\n==== After constant propagation ====\n"); |
| 3152 FlowGraphPrinter printer(*graph_); | 3140 FlowGraphPrinter printer(*graph_); |
| 3153 printer.PrintBlocks(); | 3141 printer.PrintBlocks(); |
| 3154 } | 3142 } |
| 3155 } | 3143 } |
| 3156 | 3144 |
| 3157 | 3145 |
| 3158 } // namespace dart | 3146 } // namespace dart |
| OLD | NEW |