Chromium Code Reviews| 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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 482 return node; | 482 return node; |
| 483 } | 483 } |
| 484 | 484 |
| 485 Expression visitCreateInstance(CreateInstance node) { | 485 Expression visitCreateInstance(CreateInstance node) { |
| 486 for (int i = node.arguments.length - 1; i >= 0; --i) { | 486 for (int i = node.arguments.length - 1; i >= 0; --i) { |
| 487 node.arguments[i] = visitExpression(node.arguments[i]); | 487 node.arguments[i] = visitExpression(node.arguments[i]); |
| 488 } | 488 } |
| 489 return node; | 489 return node; |
| 490 } | 490 } |
| 491 | 491 |
| 492 Expression visitReifyRuntimeType(ReifyRuntimeType node) => node; | |
|
asgerf
2015/03/02 13:52:37
Visit and update subexpressions so variables can b
karlklose
2015/03/05 09:54:58
I lost this change when cherry picking from my fea
| |
| 493 | |
| 494 Expression visitReadTypeVariable(ReadTypeVariable node) => node; | |
| 495 | |
| 492 /// If [s] and [t] are similar statements we extract their subexpressions | 496 /// If [s] and [t] are similar statements we extract their subexpressions |
| 493 /// and returns a new statement of the same type using expressions combined | 497 /// and returns a new statement of the same type using expressions combined |
| 494 /// with the [combine] callback. For example: | 498 /// with the [combine] callback. For example: |
| 495 /// | 499 /// |
| 496 /// combineStatements(Return E1, Return E2) = Return combine(E1, E2) | 500 /// combineStatements(Return E1, Return E2) = Return combine(E1, E2) |
| 497 /// | 501 /// |
| 498 /// If [combine] returns E1 then the unified statement is equivalent to [s], | 502 /// If [combine] returns E1 then the unified statement is equivalent to [s], |
| 499 /// and if [combine] returns E2 the unified statement is equivalence to [t]. | 503 /// and if [combine] returns E2 the unified statement is equivalence to [t]. |
| 500 /// | 504 /// |
| 501 /// It is guaranteed that no side effects occur between the beginning of the | 505 /// It is guaranteed that no side effects occur between the beginning of the |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 646 } | 650 } |
| 647 | 651 |
| 648 Expression makeCondition(Expression e, bool polarity) { | 652 Expression makeCondition(Expression e, bool polarity) { |
| 649 return polarity ? e : new Not(e); | 653 return polarity ? e : new Not(e); |
| 650 } | 654 } |
| 651 | 655 |
| 652 Statement getBranch(If node, bool polarity) { | 656 Statement getBranch(If node, bool polarity) { |
| 653 return polarity ? node.thenStatement : node.elseStatement; | 657 return polarity ? node.thenStatement : node.elseStatement; |
| 654 } | 658 } |
| 655 } | 659 } |
| OLD | NEW |