| OLD | NEW | 
|---|
| 1 // Copyright (c) 2016, the Dart project authors.  Please see the AUTHORS file | 1 // Copyright (c) 2016, 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 library dart2js.cps_ir.use_field_initializers; | 4 library dart2js.cps_ir.use_field_initializers; | 
| 5 | 5 | 
| 6 import 'cps_ir_nodes.dart'; | 6 import 'cps_ir_nodes.dart'; | 
| 7 import 'optimizers.dart'; | 7 import 'optimizers.dart'; | 
| 8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; | 
| 9 import '../js_backend/js_backend.dart'; | 9 import '../js_backend/js_backend.dart'; | 
| 10 | 10 | 
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 67       if (unescaped.isEmpty) { | 67       if (unescaped.isEmpty) { | 
| 68         sinkLetConts(); | 68         sinkLetConts(); | 
| 69         letConts.clear(); | 69         letConts.clear(); | 
| 70       } | 70       } | 
| 71     } | 71     } | 
| 72   } | 72   } | 
| 73 | 73 | 
| 74   void visitContinuation(Continuation node) { | 74   void visitContinuation(Continuation node) { | 
| 75     endBasicBlock(); | 75     endBasicBlock(); | 
| 76   } | 76   } | 
|  | 77 | 
| 77   void visitLetHandler(LetHandler node) { | 78   void visitLetHandler(LetHandler node) { | 
| 78     endBasicBlock(); | 79     endBasicBlock(); | 
| 79   } | 80   } | 
|  | 81 | 
| 80   void visitInvokeContinuation(InvokeContinuation node) { | 82   void visitInvokeContinuation(InvokeContinuation node) { | 
| 81     endBasicBlock(); | 83     endBasicBlock(); | 
| 82   } | 84   } | 
|  | 85 | 
| 83   void visitBranch(Branch node) { | 86   void visitBranch(Branch node) { | 
| 84     endBasicBlock(); | 87     endBasicBlock(); | 
| 85   } | 88   } | 
|  | 89 | 
| 86   void visitRethrow(Rethrow node) { | 90   void visitRethrow(Rethrow node) { | 
| 87     endBasicBlock(); | 91     endBasicBlock(); | 
| 88   } | 92   } | 
|  | 93 | 
| 89   void visitThrow(Throw node) { | 94   void visitThrow(Throw node) { | 
| 90     endBasicBlock(); | 95     endBasicBlock(); | 
| 91   } | 96   } | 
|  | 97 | 
| 92   void visitUnreachable(Unreachable node) { | 98   void visitUnreachable(Unreachable node) { | 
| 93     endBasicBlock(); | 99     endBasicBlock(); | 
| 94   } | 100   } | 
| 95 | 101 | 
| 96   void visitLetMutable(LetMutable node) { | 102   void visitLetMutable(LetMutable node) { | 
| 97     escape(node.valueRef); | 103     escape(node.valueRef); | 
| 98   } | 104   } | 
| 99 | 105 | 
| 100   void visitLetCont(LetCont node) { | 106   void visitLetCont(LetCont node) { | 
| 101     if (unescaped.isNotEmpty) { | 107     if (unescaped.isNotEmpty) { | 
| 102       // Ensure we do not lift a LetCont if there is a sink target set above | 108       // Ensure we do not lift a LetCont if there is a sink target set above | 
| 103       // the current node. | 109       // the current node. | 
| 104       sinkLetConts(); | 110       sinkLetConts(); | 
| 105       letConts.add(node); | 111       letConts.add(node); | 
| 106     } | 112     } | 
| 107   } | 113   } | 
| 108 | 114 | 
| 109   void sinkLetConts() { | 115   void sinkLetConts() { | 
| 110     if (letContSinkTarget != null) { | 116     if (letContSinkTarget != null) { | 
| 111       for (LetCont letCont in letConts.reversed) { | 117       for (LetCont letCont in letConts.reversed) { | 
| 112         letCont..remove()..insertBelow(letContSinkTarget); | 118         letCont | 
|  | 119           ..remove() | 
|  | 120           ..insertBelow(letContSinkTarget); | 
| 113       } | 121       } | 
| 114       letContSinkTarget = null; | 122       letContSinkTarget = null; | 
| 115     } | 123     } | 
| 116   } | 124   } | 
| 117 | 125 | 
| 118   void endBasicBlock() { | 126   void endBasicBlock() { | 
| 119     sinkLetConts(); | 127     sinkLetConts(); | 
| 120     letConts.clear(); | 128     letConts.clear(); | 
| 121     unescaped.clear(); | 129     unescaped.clear(); | 
| 122   } | 130   } | 
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 203 } | 211 } | 
| 204 | 212 | 
| 205 class EscapeVisitor extends DeepRecursiveVisitor { | 213 class EscapeVisitor extends DeepRecursiveVisitor { | 
| 206   final UseFieldInitializers main; | 214   final UseFieldInitializers main; | 
| 207   EscapeVisitor(this.main); | 215   EscapeVisitor(this.main); | 
| 208 | 216 | 
| 209   processReference(Reference ref) { | 217   processReference(Reference ref) { | 
| 210     main.escape(ref); | 218     main.escape(ref); | 
| 211   } | 219   } | 
| 212 } | 220 } | 
| OLD | NEW | 
|---|