Chromium Code Reviews| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 125 | 125 |
| 126 | 126 |
| 127 static bool HasTwoDouble(const ICData& ic_data) { | 127 static bool HasTwoDouble(const ICData& ic_data) { |
| 128 return ICDataHasReceiverArgumentClassIds(ic_data, kDouble, kDouble); | 128 return ICDataHasReceiverArgumentClassIds(ic_data, kDouble, kDouble); |
| 129 } | 129 } |
| 130 | 130 |
| 131 | 131 |
| 132 bool FlowGraphOptimizer::TryReplaceWithBinaryOp(InstanceCallComp* comp, | 132 bool FlowGraphOptimizer::TryReplaceWithBinaryOp(InstanceCallComp* comp, |
| 133 Token::Kind op_kind) { | 133 Token::Kind op_kind) { |
| 134 BinaryOpComp::OperandsType operands_type; | 134 BinaryOpComp::OperandsType operands_type; |
| 135 if ((op_kind == Token::kBIT_AND) && HasTwoMintOrSmi(*comp->ic_data())) { | 135 if ((comp->ic_data()->NumberOfChecks() == 1) && HasTwoSmi(*comp->ic_data())) { |
| 136 operands_type = BinaryOpComp::kMintOperands; | |
| 137 } else if (comp->ic_data()->NumberOfChecks() != 1) { | |
| 138 // TODO(srdjan): Not yet supported. | |
| 139 return false; | |
| 140 } else if (HasTwoSmi(*comp->ic_data())) { | |
| 141 if (op_kind == Token::kDIV || | 136 if (op_kind == Token::kDIV || |
| 142 op_kind == Token::kMOD) { | 137 op_kind == Token::kMOD) { |
| 143 // TODO(srdjan): Not yet supported. | 138 // TODO(srdjan): Not yet supported. |
| 144 return false; | 139 return false; |
|
regis
2012/06/22 20:09:03
With this change, you will not inline kBIT_AND wit
srdjan
2012/06/22 20:36:47
As discussed, the code is correct but complicated.
| |
| 145 } | 140 } |
| 146 operands_type = BinaryOpComp::kSmiOperands; | 141 operands_type = BinaryOpComp::kSmiOperands; |
| 142 } else if ((op_kind == Token::kBIT_AND) && | |
| 143 HasTwoMintOrSmi(*comp->ic_data())) { | |
| 144 operands_type = BinaryOpComp::kMintOperands; | |
| 145 } else if (comp->ic_data()->NumberOfChecks() != 1) { | |
| 146 // TODO(srdjan): Not yet supported. | |
| 147 return false; | |
| 147 } else if (HasTwoDouble(*comp->ic_data())) { | 148 } else if (HasTwoDouble(*comp->ic_data())) { |
| 148 if (op_kind != Token::kADD && | 149 if (op_kind != Token::kADD && |
| 149 op_kind != Token::kSUB && | 150 op_kind != Token::kSUB && |
| 150 op_kind != Token::kMUL && | 151 op_kind != Token::kMUL && |
| 151 op_kind != Token::kDIV) { | 152 op_kind != Token::kDIV) { |
| 152 // TODO(vegorov): Not yet supported. | 153 // TODO(vegorov): Not yet supported. |
| 153 return false; | 154 return false; |
| 154 } | 155 } |
| 155 operands_type = BinaryOpComp::kDoubleOperands; | 156 operands_type = BinaryOpComp::kDoubleOperands; |
| 156 } else { | 157 } else { |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 587 instr->computation()->Accept(this); | 588 instr->computation()->Accept(this); |
| 588 } | 589 } |
| 589 | 590 |
| 590 | 591 |
| 591 void FlowGraphOptimizer::VisitBind(BindInstr* instr) { | 592 void FlowGraphOptimizer::VisitBind(BindInstr* instr) { |
| 592 instr->computation()->Accept(this); | 593 instr->computation()->Accept(this); |
| 593 } | 594 } |
| 594 | 595 |
| 595 | 596 |
| 596 } // namespace dart | 597 } // namespace dart |
| OLD | NEW |