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/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/dart_entry.h" | 9 #include "vm/dart_entry.h" |
10 #include "vm/flow_graph_builder.h" | 10 #include "vm/flow_graph_builder.h" |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 args->Add(new Value(curr_instr->right()->definition())); | 368 args->Add(new Value(curr_instr->right()->definition())); |
369 | 369 |
370 // Replace with TruncDivMod. | 370 // Replace with TruncDivMod. |
371 MergedMathInstr* div_mod = new MergedMathInstr( | 371 MergedMathInstr* div_mod = new MergedMathInstr( |
372 args, | 372 args, |
373 curr_instr->deopt_id(), | 373 curr_instr->deopt_id(), |
374 MergedMathInstr::kTruncDivMod); | 374 MergedMathInstr::kTruncDivMod); |
375 curr_instr->ReplaceWith(div_mod, current_iterator()); | 375 curr_instr->ReplaceWith(div_mod, current_iterator()); |
376 other_binop->ReplaceUsesWith(div_mod); | 376 other_binop->ReplaceUsesWith(div_mod); |
377 other_binop->RemoveFromGraph(); | 377 other_binop->RemoveFromGraph(); |
| 378 // Only one merge possible. Because canonicalization happens later, |
| 379 // more candidates are possible. |
| 380 // TODO(srdjan): Allow merging of trunc-div/mod into truncDivMod. |
| 381 break; |
378 } | 382 } |
379 } | 383 } |
380 } | 384 } |
381 } | 385 } |
382 | 386 |
383 | 387 |
384 void FlowGraphOptimizer::TryMergeMathUnary( | 388 void FlowGraphOptimizer::TryMergeMathUnary( |
385 GrowableArray<MathUnaryInstr*>* merge_candidates) { | 389 GrowableArray<MathUnaryInstr*>* merge_candidates) { |
386 if (!FlowGraphCompiler::SupportsSinCos()) { | 390 if (!FlowGraphCompiler::SupportsSinCos()) { |
387 return; | 391 return; |
(...skipping 7939 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8327 } | 8331 } |
8328 | 8332 |
8329 // Insert materializations at environment uses. | 8333 // Insert materializations at environment uses. |
8330 for (intptr_t i = 0; i < exits.length(); i++) { | 8334 for (intptr_t i = 0; i < exits.length(); i++) { |
8331 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); | 8335 CreateMaterializationAt(exits[i], alloc, alloc->cls(), *fields); |
8332 } | 8336 } |
8333 } | 8337 } |
8334 | 8338 |
8335 | 8339 |
8336 } // namespace dart | 8340 } // namespace dart |
OLD | NEW |