| 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 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 | 417 |
| 418 Expression visitGetField(GetField node) { | 418 Expression visitGetField(GetField node) { |
| 419 node.object = visitExpression(node.object); | 419 node.object = visitExpression(node.object); |
| 420 return node; | 420 return node; |
| 421 } | 421 } |
| 422 | 422 |
| 423 Expression visitCreateBox(CreateBox node) { | 423 Expression visitCreateBox(CreateBox node) { |
| 424 return node; | 424 return node; |
| 425 } | 425 } |
| 426 | 426 |
| 427 Expression visitCreateClosureClass(CreateClosureClass node) { | 427 Expression visitCreateInstance(CreateInstance node) { |
| 428 for (int i = node.arguments.length - 1; i >= 0; --i) { | 428 for (int i = node.arguments.length - 1; i >= 0; --i) { |
| 429 node.arguments[i] = visitExpression(node.arguments[i]); | 429 node.arguments[i] = visitExpression(node.arguments[i]); |
| 430 } | 430 } |
| 431 return node; | 431 return node; |
| 432 } | 432 } |
| 433 | 433 |
| 434 /// If [s] and [t] are similar statements we extract their subexpressions | 434 /// If [s] and [t] are similar statements we extract their subexpressions |
| 435 /// and returns a new statement of the same type using expressions combined | 435 /// and returns a new statement of the same type using expressions combined |
| 436 /// with the [combine] callback. For example: | 436 /// with the [combine] callback. For example: |
| 437 /// | 437 /// |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 } | 590 } |
| 591 | 591 |
| 592 Expression makeCondition(Expression e, bool polarity) { | 592 Expression makeCondition(Expression e, bool polarity) { |
| 593 return polarity ? e : new Not(e); | 593 return polarity ? e : new Not(e); |
| 594 } | 594 } |
| 595 | 595 |
| 596 Statement getBranch(If node, bool polarity) { | 596 Statement getBranch(If node, bool polarity) { |
| 597 return polarity ? node.thenStatement : node.elseStatement; | 597 return polarity ? node.thenStatement : node.elseStatement; |
| 598 } | 598 } |
| 599 } | 599 } |
| OLD | NEW |