| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 part of tree_ir.optimization; | 5 part of tree_ir.optimization; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Performs the following transformations on the tree: | 8 * Performs the following transformations on the tree: |
| 9 * - Assignment propagation | 9 * - Assignment propagation |
| 10 * - If-to-conditional conversion | 10 * - If-to-conditional conversion |
| (...skipping 479 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 return node; | 490 return node; |
| 491 } | 491 } |
| 492 | 492 |
| 493 Expression visitCreateInstance(CreateInstance node) { | 493 Expression visitCreateInstance(CreateInstance node) { |
| 494 for (int i = node.arguments.length - 1; i >= 0; --i) { | 494 for (int i = node.arguments.length - 1; i >= 0; --i) { |
| 495 node.arguments[i] = visitExpression(node.arguments[i]); | 495 node.arguments[i] = visitExpression(node.arguments[i]); |
| 496 } | 496 } |
| 497 return node; | 497 return node; |
| 498 } | 498 } |
| 499 | 499 |
| 500 Expression visitReifyRuntimeType(ReifyRuntimeType node) { |
| 501 node.value = visitExpression(node.value); |
| 502 return node; |
| 503 } |
| 504 |
| 505 Expression visitReadTypeVariable(ReadTypeVariable node) { |
| 506 node.target = visitExpression(node.target); |
| 507 return node; |
| 508 } |
| 509 |
| 500 /// If [s] and [t] are similar statements we extract their subexpressions | 510 /// If [s] and [t] are similar statements we extract their subexpressions |
| 501 /// and returns a new statement of the same type using expressions combined | 511 /// and returns a new statement of the same type using expressions combined |
| 502 /// with the [combine] callback. For example: | 512 /// with the [combine] callback. For example: |
| 503 /// | 513 /// |
| 504 /// combineStatements(Return E1, Return E2) = Return combine(E1, E2) | 514 /// combineStatements(Return E1, Return E2) = Return combine(E1, E2) |
| 505 /// | 515 /// |
| 506 /// If [combine] returns E1 then the unified statement is equivalent to [s], | 516 /// If [combine] returns E1 then the unified statement is equivalent to [s], |
| 507 /// and if [combine] returns E2 the unified statement is equivalence to [t]. | 517 /// and if [combine] returns E2 the unified statement is equivalence to [t]. |
| 508 /// | 518 /// |
| 509 /// It is guaranteed that no side effects occur between the beginning of the | 519 /// It is guaranteed that no side effects occur between the beginning of the |
| (...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 657 } | 667 } |
| 658 | 668 |
| 659 Expression makeCondition(Expression e, bool polarity) { | 669 Expression makeCondition(Expression e, bool polarity) { |
| 660 return polarity ? e : new Not(e); | 670 return polarity ? e : new Not(e); |
| 661 } | 671 } |
| 662 | 672 |
| 663 Statement getBranch(If node, bool polarity) { | 673 Statement getBranch(If node, bool polarity) { |
| 664 return polarity ? node.thenStatement : node.elseStatement; | 674 return polarity ? node.thenStatement : node.elseStatement; |
| 665 } | 675 } |
| 666 } | 676 } |
| OLD | NEW |