| OLD | NEW |
| 1 library dart2js.cps_ir.loop_invariant_branch; | 1 library dart2js.cps_ir.loop_invariant_branch; |
| 2 | 2 |
| 3 import 'cps_ir_nodes.dart'; | 3 import 'cps_ir_nodes.dart'; |
| 4 import 'optimizers.dart'; | 4 import 'optimizers.dart'; |
| 5 import 'loop_hierarchy.dart'; | 5 import 'loop_hierarchy.dart'; |
| 6 import 'cps_fragment.dart'; | 6 import 'cps_fragment.dart'; |
| 7 import 'redundant_join.dart' show AlphaRenamer; | 7 import 'redundant_join.dart' show AlphaRenamer; |
| 8 | 8 |
| 9 /// Hoists branches out of loops, where: | 9 /// Hoists branches out of loops, where: |
| 10 /// - the branch is at the entry point of a loop | 10 /// - the branch is at the entry point of a loop |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 while (exp is LetCont) { | 88 while (exp is LetCont) { |
| 89 exp = exp.next; | 89 exp = exp.next; |
| 90 } | 90 } |
| 91 return exp; | 91 return exp; |
| 92 } | 92 } |
| 93 | 93 |
| 94 /// Adds [parameters] to [cont] and updates every invocation to pass the | 94 /// Adds [parameters] to [cont] and updates every invocation to pass the |
| 95 /// corresponding parameter values as arguments. Thus, the parameters are | 95 /// corresponding parameter values as arguments. Thus, the parameters are |
| 96 /// passed in explicitly instead of being captured. | 96 /// passed in explicitly instead of being captured. |
| 97 /// | 97 /// |
| 98 /// This only works because [AlphaRenamer] cleans up after this pass. | 98 /// This only works because [AlphaRenamer] cleans up at the end of this pass. |
| 99 /// | 99 /// |
| 100 /// Schematically: | 100 /// Schematically: |
| 101 /// | 101 /// |
| 102 /// let outer(x1, x2, x3) = | 102 /// let outer(x1, x2, x3) = |
| 103 /// let inner(y) = BODY | 103 /// let inner(y) = BODY |
| 104 /// [ .. inner(y') .. ] | 104 /// [ .. inner(y') .. ] |
| 105 /// | 105 /// |
| 106 /// ==> (append parameters) | 106 /// ==> (append parameters) |
| 107 /// | 107 /// |
| 108 /// let outer(x1, x2, x3) = | 108 /// let outer(x1, x2, x3) = |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 243 // in loop(i) | 243 // in loop(i) |
| 244 // | 244 // |
| 245 destroyAndReplace(branch, new InvokeContinuation(loopCase, [])); | 245 destroyAndReplace(branch, new InvokeContinuation(loopCase, [])); |
| 246 | 246 |
| 247 // Record that at least one branch was hoisted to trigger alpha renaming. | 247 // Record that at least one branch was hoisted to trigger alpha renaming. |
| 248 wasHoisted = true; | 248 wasHoisted = true; |
| 249 | 249 |
| 250 return true; | 250 return true; |
| 251 } | 251 } |
| 252 } | 252 } |
| OLD | NEW |