| 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/flow_graph_builder.h" | 7 #include "vm/flow_graph_builder.h" |
| 8 #include "vm/il_printer.h" | 8 #include "vm/il_printer.h" |
| 9 #include "vm/object_store.h" | 9 #include "vm/object_store.h" |
| 10 | 10 |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 operands_type = BinaryOpComp::kSmiOperands; | 167 operands_type = BinaryOpComp::kSmiOperands; |
| 168 } else { | 168 } else { |
| 169 return false; | 169 return false; |
| 170 } | 170 } |
| 171 break; | 171 break; |
| 172 default: | 172 default: |
| 173 UNREACHABLE(); | 173 UNREACHABLE(); |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 ASSERT(comp->ArgumentCount() == 2); | 176 ASSERT(comp->ArgumentCount() == 2); |
| 177 Value* left = comp->ArgumentAt(0)->value(); | 177 if (operands_type == BinaryOpComp::kDoubleOperands) { |
| 178 Value* right = comp->ArgumentAt(1)->value(); | 178 DoubleBinaryOpComp* double_bin_op = new DoubleBinaryOpComp(op_kind, comp); |
| 179 BinaryOpComp* bin_op = | 179 double_bin_op->set_ic_data(comp->ic_data()); |
| 180 new BinaryOpComp(op_kind, | 180 instr->set_computation(double_bin_op); |
| 181 operands_type, | 181 } else { |
| 182 comp, | 182 Value* left = comp->ArgumentAt(0)->value(); |
| 183 left, | 183 Value* right = comp->ArgumentAt(1)->value(); |
| 184 right); | 184 BinaryOpComp* bin_op = |
| 185 bin_op->set_ic_data(comp->ic_data()); | 185 new BinaryOpComp(op_kind, |
| 186 instr->set_computation(bin_op); | 186 operands_type, |
| 187 RemovePushArguments(comp); | 187 comp, |
| 188 left, |
| 189 right); |
| 190 bin_op->set_ic_data(comp->ic_data()); |
| 191 instr->set_computation(bin_op); |
| 192 RemovePushArguments(comp); |
| 193 } |
| 188 return true; | 194 return true; |
| 189 } | 195 } |
| 190 | 196 |
| 191 | 197 |
| 192 bool FlowGraphOptimizer::TryReplaceWithUnaryOp(BindInstr* instr, | 198 bool FlowGraphOptimizer::TryReplaceWithUnaryOp(BindInstr* instr, |
| 193 InstanceCallComp* comp, | 199 InstanceCallComp* comp, |
| 194 Token::Kind op_kind) { | 200 Token::Kind op_kind) { |
| 195 if (comp->ic_data()->NumberOfChecks() != 1) { | 201 if (comp->ic_data()->NumberOfChecks() != 1) { |
| 196 // TODO(srdjan): Not yet supported. | 202 // TODO(srdjan): Not yet supported. |
| 197 return false; | 203 return false; |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 582 } | 588 } |
| 583 } | 589 } |
| 584 } | 590 } |
| 585 | 591 |
| 586 | 592 |
| 587 void FlowGraphTypePropagator::PropagateTypes() { | 593 void FlowGraphTypePropagator::PropagateTypes() { |
| 588 VisitBlocks(); | 594 VisitBlocks(); |
| 589 } | 595 } |
| 590 | 596 |
| 591 } // namespace dart | 597 } // namespace dart |
| OLD | NEW |