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 library tree_ir.optimization.statement_rewriter; | 5 library tree_ir.optimization.statement_rewriter; |
6 | 6 |
7 import 'optimization.dart' show Pass; | 7 import 'optimization.dart' show Pass; |
8 import '../tree_ir_nodes.dart'; | 8 import '../tree_ir_nodes.dart'; |
9 | 9 |
10 /** | 10 /** |
(...skipping 417 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 | 428 |
429 Statement visitThrow(Throw node) { | 429 Statement visitThrow(Throw node) { |
430 node.value = visitExpression(node.value); | 430 node.value = visitExpression(node.value); |
431 return node; | 431 return node; |
432 } | 432 } |
433 | 433 |
434 Statement visitRethrow(Rethrow node) { | 434 Statement visitRethrow(Rethrow node) { |
435 return node; | 435 return node; |
436 } | 436 } |
437 | 437 |
| 438 Statement visitUnreachable(Unreachable node) { |
| 439 return node; |
| 440 } |
| 441 |
438 Statement visitBreak(Break node) { | 442 Statement visitBreak(Break node) { |
439 // Redirect through chain of breaks. | 443 // Redirect through chain of breaks. |
440 // Note that useCount was accounted for at visitLabeledStatement. | 444 // Note that useCount was accounted for at visitLabeledStatement. |
441 // Note redirect may return either a Break or Continue statement. | 445 // Note redirect may return either a Break or Continue statement. |
442 Jump jump = redirect(node); | 446 Jump jump = redirect(node); |
443 if (jump is Break && | 447 if (jump is Break && |
444 jump.target.useCount == 1 && | 448 jump.target.useCount == 1 && |
445 safeForInlining.contains(jump.target)) { | 449 safeForInlining.contains(jump.target)) { |
446 --jump.target.useCount; | 450 --jump.target.useCount; |
447 return visitStatement(jump.target.binding.next); | 451 return visitStatement(jump.target.binding.next); |
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
912 } | 916 } |
913 | 917 |
914 /// Result of combining two expressions that do not affect reference counting. | 918 /// Result of combining two expressions that do not affect reference counting. |
915 class GenericCombinedExpressions implements CombinedExpressions { | 919 class GenericCombinedExpressions implements CombinedExpressions { |
916 Expression combined; | 920 Expression combined; |
917 | 921 |
918 GenericCombinedExpressions(this.combined); | 922 GenericCombinedExpressions(this.combined); |
919 | 923 |
920 void uncombine() {} | 924 void uncombine() {} |
921 } | 925 } |
OLD | NEW |