| 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 391 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 List<Assign> savedEnvironment = environment; | 402 List<Assign> savedEnvironment = environment; |
| 403 environment = <Assign>[]; | 403 environment = <Assign>[]; |
| 404 node.next = visitStatement(node.next); | 404 node.next = visitStatement(node.next); |
| 405 assert(environment.isEmpty); | 405 assert(environment.isEmpty); |
| 406 environment = savedEnvironment; | 406 environment = savedEnvironment; |
| 407 return node; | 407 return node; |
| 408 } | 408 } |
| 409 | 409 |
| 410 Statement visitSetField(SetField node) { | 410 Statement visitSetField(SetField node) { |
| 411 node.next = visitStatement(node.next); | 411 node.next = visitStatement(node.next); |
| 412 node.value = visitExpression(node.value); |
| 412 node.object = visitExpression(node.object); | 413 node.object = visitExpression(node.object); |
| 413 node.value = visitExpression(node.value); | |
| 414 return node; | 414 return node; |
| 415 } | 415 } |
| 416 | 416 |
| 417 Expression visitGetField(GetField node) { | 417 Expression visitGetField(GetField node) { |
| 418 node.object = visitExpression(node.object); | 418 node.object = visitExpression(node.object); |
| 419 return node; | 419 return node; |
| 420 } | 420 } |
| 421 | 421 |
| 422 Expression visitCreateBox(CreateBox node) { | 422 Expression visitCreateBox(CreateBox node) { |
| 423 return node; | 423 return node; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 589 } | 589 } |
| 590 | 590 |
| 591 Expression makeCondition(Expression e, bool polarity) { | 591 Expression makeCondition(Expression e, bool polarity) { |
| 592 return polarity ? e : new Not(e); | 592 return polarity ? e : new Not(e); |
| 593 } | 593 } |
| 594 | 594 |
| 595 Statement getBranch(If node, bool polarity) { | 595 Statement getBranch(If node, bool polarity) { |
| 596 return polarity ? node.thenStatement : node.elseStatement; | 596 return polarity ? node.thenStatement : node.elseStatement; |
| 597 } | 597 } |
| 598 } | 598 } |
| OLD | NEW |