| 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 inlining | 9 * - Assignment inlining |
| 10 * - Assignment expression propagation | 10 * - Assignment expression propagation |
| (...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 new StatementRewriter.nested(this).rewrite(node.definition); | 428 new StatementRewriter.nested(this).rewrite(node.definition); |
| 429 node.next = visitStatement(node.next); | 429 node.next = visitStatement(node.next); |
| 430 return node; | 430 return node; |
| 431 } | 431 } |
| 432 | 432 |
| 433 Statement visitReturn(Return node) { | 433 Statement visitReturn(Return node) { |
| 434 node.value = visitExpression(node.value); | 434 node.value = visitExpression(node.value); |
| 435 return node; | 435 return node; |
| 436 } | 436 } |
| 437 | 437 |
| 438 Statement visitThrow(Throw node) { |
| 439 node.value = visitExpression(node.value); |
| 440 return node; |
| 441 } |
| 442 |
| 443 Statement visitRethrow(Rethrow node) { |
| 444 return node; |
| 445 } |
| 446 |
| 438 Statement visitBreak(Break node) { | 447 Statement visitBreak(Break node) { |
| 439 // Redirect through chain of breaks. | 448 // Redirect through chain of breaks. |
| 440 // Note that useCount was accounted for at visitLabeledStatement. | 449 // Note that useCount was accounted for at visitLabeledStatement. |
| 441 // Note redirect may return either a Break or Continue statement. | 450 // Note redirect may return either a Break or Continue statement. |
| 442 Jump jump = redirect(node); | 451 Jump jump = redirect(node); |
| 443 if (jump is Break && | 452 if (jump is Break && |
| 444 jump.target.useCount == 1 && | 453 jump.target.useCount == 1 && |
| 445 safeForInlining.contains(jump.target)) { | 454 safeForInlining.contains(jump.target)) { |
| 446 --jump.target.useCount; | 455 --jump.target.useCount; |
| 447 return visitStatement(jump.target.binding.next); | 456 return visitStatement(jump.target.binding.next); |
| (...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 909 } | 918 } |
| 910 | 919 |
| 911 /// Result of combining two expressions that do not affect reference counting. | 920 /// Result of combining two expressions that do not affect reference counting. |
| 912 class GenericCombinedExpressions implements CombinedExpressions { | 921 class GenericCombinedExpressions implements CombinedExpressions { |
| 913 Expression combined; | 922 Expression combined; |
| 914 | 923 |
| 915 GenericCombinedExpressions(this.combined); | 924 GenericCombinedExpressions(this.combined); |
| 916 | 925 |
| 917 void uncombine() {} | 926 void uncombine() {} |
| 918 } | 927 } |
| OLD | NEW |