| 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 dart2js.cps_ir.redundant_join_elimination; | 5 library dart2js.cps_ir.redundant_join_elimination; |
| 6 | 6 |
| 7 import 'cps_ir_nodes.dart'; | 7 import 'cps_ir_nodes.dart'; |
| 8 import 'optimizers.dart'; | 8 import 'optimizers.dart'; |
| 9 | 9 |
| 10 /// Eliminates redundant join points. | 10 /// Eliminates redundant join points. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 /// | 205 /// |
| 206 /// LetCont (k1 x = (return x)) in | 206 /// LetCont (k1 x = (return x)) in |
| 207 /// LetCont (k2 x = (InvokeContinuation k3 x)) in ... | 207 /// LetCont (k2 x = (InvokeContinuation k3 x)) in ... |
| 208 /// => | 208 /// => |
| 209 /// LetCont (k1 x = (return x)) in | 209 /// LetCont (k1 x = (return x)) in |
| 210 /// LetCont (k2 x' = (InvokeContinuation k3 x')) in ... | 210 /// LetCont (k2 x' = (InvokeContinuation k3 x')) in ... |
| 211 /// | 211 /// |
| 212 /// After lifting LetConts in the main pass above, parameter objects can have | 212 /// After lifting LetConts in the main pass above, parameter objects can have |
| 213 /// multiple bindings. Each reference implicitly refers to the binding that | 213 /// multiple bindings. Each reference implicitly refers to the binding that |
| 214 /// is currently in scope. | 214 /// is currently in scope. |
| 215 /// | 215 /// |
| 216 /// This returns the IR to its normal form after redundant joins have been | 216 /// This returns the IR to its normal form after redundant joins have been |
| 217 /// eliminated. | 217 /// eliminated. |
| 218 class AlphaRenamer extends TrampolineRecursiveVisitor { | 218 class AlphaRenamer extends TrampolineRecursiveVisitor { |
| 219 Map<Parameter, Parameter> renaming = <Parameter, Parameter>{}; | 219 Map<Parameter, Parameter> renaming = <Parameter, Parameter>{}; |
| 220 | 220 |
| 221 processContinuation(Continuation cont) { | 221 processContinuation(Continuation cont) { |
| 222 if (cont.isReturnContinuation) return; | 222 if (cont.isReturnContinuation) return; |
| 223 | 223 |
| 224 List<Parameter> shadowedKeys = <Parameter>[]; | 224 List<Parameter> shadowedKeys = <Parameter>[]; |
| 225 List<Parameter> shadowedValues = <Parameter>[]; | 225 List<Parameter> shadowedValues = <Parameter>[]; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 251 }); | 251 }); |
| 252 } | 252 } |
| 253 | 253 |
| 254 processReference(Reference ref) { | 254 processReference(Reference ref) { |
| 255 Parameter target = renaming[ref.definition]; | 255 Parameter target = renaming[ref.definition]; |
| 256 if (target != null) { | 256 if (target != null) { |
| 257 ref.changeTo(target); | 257 ref.changeTo(target); |
| 258 } | 258 } |
| 259 } | 259 } |
| 260 } | 260 } |
| OLD | NEW |