| 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 #include "vm/parser.h" | 10 #include "vm/parser.h" |
| (...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 139 | 139 |
| 140 static bool HasOnlyTwoDouble(const ICData& ic_data) { | 140 static bool HasOnlyTwoDouble(const ICData& ic_data) { |
| 141 return (ic_data.NumberOfChecks() == 1) && | 141 return (ic_data.NumberOfChecks() == 1) && |
| 142 ICDataHasReceiverArgumentClassIds(ic_data, kDoubleCid, kDoubleCid); | 142 ICDataHasReceiverArgumentClassIds(ic_data, kDoubleCid, kDoubleCid); |
| 143 } | 143 } |
| 144 | 144 |
| 145 | 145 |
| 146 static void RemovePushArguments(InstanceCallComp* comp) { | 146 static void RemovePushArguments(InstanceCallComp* comp) { |
| 147 // Remove original push arguments. | 147 // Remove original push arguments. |
| 148 for (intptr_t i = 0; i < comp->ArgumentCount(); ++i) { | 148 for (intptr_t i = 0; i < comp->ArgumentCount(); ++i) { |
| 149 comp->ArgumentAt(i)->RemoveFromGraph(); | 149 PushArgumentInstr* push = comp->ArgumentAt(i); |
| 150 // TODO(zerny): Currently the register allocator replaces unused pushes with |
| 151 // their definitions. To do so here, we need first to link uses to their |
| 152 // instructions and input index. Here push->ReplaceUsesWith requires that |
| 153 // push->value() is a UseVal. |
| 154 // (See FlowGraphAllocator::EliminateEnvironmentUses). |
| 155 push->set_use_list(NULL); |
| 156 push->RemoveFromGraph(); |
| 150 } | 157 } |
| 151 } | 158 } |
| 152 | 159 |
| 153 | 160 |
| 154 bool FlowGraphOptimizer::TryReplaceWithBinaryOp(BindInstr* instr, | 161 bool FlowGraphOptimizer::TryReplaceWithBinaryOp(BindInstr* instr, |
| 155 InstanceCallComp* comp, | 162 InstanceCallComp* comp, |
| 156 Token::Kind op_kind) { | 163 Token::Kind op_kind) { |
| 157 BinaryOpComp::OperandsType operands_type = BinaryOpComp::kDynamicOperands; | 164 BinaryOpComp::OperandsType operands_type = BinaryOpComp::kDynamicOperands; |
| 158 ASSERT(comp->HasICData()); | 165 ASSERT(comp->HasICData()); |
| 159 const ICData& ic_data = *comp->ic_data(); | 166 const ICData& ic_data = *comp->ic_data(); |
| (...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 718 LocationSummary* locs = it.Current()->locs(); | 725 LocationSummary* locs = it.Current()->locs(); |
| 719 if ((locs != NULL) && locs->contains_call()) { | 726 if ((locs != NULL) && locs->contains_call()) { |
| 720 is_leaf_ = false; | 727 is_leaf_ = false; |
| 721 return; | 728 return; |
| 722 } | 729 } |
| 723 } | 730 } |
| 724 } | 731 } |
| 725 } | 732 } |
| 726 | 733 |
| 727 } // namespace dart | 734 } // namespace dart |
| OLD | NEW |