| OLD | NEW |
| 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 cps_ir.optimization.insert_refinements; | 5 library cps_ir.optimization.insert_refinements; |
| 6 | 6 |
| 7 import 'optimizers.dart' show Pass; | 7 import 'optimizers.dart' show Pass; |
| 8 import 'cps_ir_nodes.dart'; | 8 import 'cps_ir_nodes.dart'; |
| 9 import '../common/names.dart'; | 9 import '../common/names.dart'; |
| 10 import '../types/types.dart' show TypeMask; | 10 import '../types/types.dart' show TypeMask; |
| 11 import 'type_mask_system.dart'; | 11 import 'type_mask_system.dart'; |
| 12 import 'cps_fragment.dart'; | |
| 13 | 12 |
| 14 /// Inserts [Refinement] nodes in the IR to allow for sparse path-sensitive | 13 /// Inserts [Refinement] nodes in the IR to allow for sparse path-sensitive |
| 15 /// type analysis in the [TypePropagator] pass. | 14 /// type analysis in the [TypePropagator] pass. |
| 16 /// | 15 /// |
| 17 /// Refinement nodes are inserted at the arms of a [Branch] node with a | 16 /// Refinement nodes are inserted at the arms of a [Branch] node with a |
| 18 /// condition of form `x is T` or `x == null`. | 17 /// condition of form `x is T` or `x == null`. |
| 19 /// | 18 /// |
| 20 /// Refinement nodes are inserted after a method invocation to refine the | 19 /// Refinement nodes are inserted after a method invocation to refine the |
| 21 /// receiver to the types that can respond to the given selector. | 20 /// receiver to the types that can respond to the given selector. |
| 22 class InsertRefinements extends TrampolineRecursiveVisitor implements Pass { | 21 class InsertRefinements extends TrampolineRecursiveVisitor implements Pass { |
| (...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 227 Expression traverseLetCont(LetCont node) { | 226 Expression traverseLetCont(LetCont node) { |
| 228 for (Continuation cont in node.continuations) { | 227 for (Continuation cont in node.continuations) { |
| 229 // Do not push the branch continuations here. visitBranch will do that. | 228 // Do not push the branch continuations here. visitBranch will do that. |
| 230 if (!(cont.hasExactlyOneUse && cont.firstRef.parent is Branch)) { | 229 if (!(cont.hasExactlyOneUse && cont.firstRef.parent is Branch)) { |
| 231 push(cont); | 230 push(cont); |
| 232 } | 231 } |
| 233 } | 232 } |
| 234 return node.body; | 233 return node.body; |
| 235 } | 234 } |
| 236 } | 235 } |
| OLD | NEW |