| 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.cps_fragment; | 5 library cps_ir.cps_fragment; |
| 6 | 6 |
| 7 import 'cps_ir_nodes.dart'; | 7 import 'cps_ir_nodes.dart'; |
| 8 import '../constants/values.dart'; | 8 import '../constants/values.dart'; |
| 9 import '../universe/selector.dart' show Selector; | 9 import '../universe/selector.dart' show Selector; |
| 10 import '../types/types.dart' show TypeMask; | 10 import '../types/types.dart' show TypeMask; |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 193 /// Returns a new fragment for the 'then' branch, or the 'else' branch | 193 /// Returns a new fragment for the 'then' branch, or the 'else' branch |
| 194 /// if [negate] is true. | 194 /// if [negate] is true. |
| 195 /// | 195 /// |
| 196 /// The other branch becomes the new hole. | 196 /// The other branch becomes the new hole. |
| 197 CpsFragment branch(Primitive condition, | 197 CpsFragment branch(Primitive condition, |
| 198 {bool negate: false, | 198 {bool negate: false, |
| 199 bool strict: false}) { | 199 bool strict: false}) { |
| 200 Continuation trueCont = new Continuation(<Parameter>[]); | 200 Continuation trueCont = new Continuation(<Parameter>[]); |
| 201 Continuation falseCont = new Continuation(<Parameter>[]); | 201 Continuation falseCont = new Continuation(<Parameter>[]); |
| 202 put(new LetCont.two(trueCont, falseCont, | 202 put(new LetCont.two(trueCont, falseCont, |
| 203 new Branch(condition, trueCont, falseCont, strict: strict))); | 203 new Branch(condition, trueCont, falseCont, |
| 204 sourceInformation, strict: strict))); |
| 204 if (negate) { | 205 if (negate) { |
| 205 context = trueCont; | 206 context = trueCont; |
| 206 return new CpsFragment(sourceInformation, falseCont); | 207 return new CpsFragment(sourceInformation, falseCont); |
| 207 } else { | 208 } else { |
| 208 context = falseCont; | 209 context = falseCont; |
| 209 return new CpsFragment(sourceInformation, trueCont); | 210 return new CpsFragment(sourceInformation, trueCont); |
| 210 } | 211 } |
| 211 } | 212 } |
| 212 | 213 |
| 213 /// Branch on [condition]. | 214 /// Branch on [condition]. |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 while (prim.firstRef != null) { | 371 while (prim.firstRef != null) { |
| 371 Refinement refine = prim.firstRef.parent; | 372 Refinement refine = prim.firstRef.parent; |
| 372 destroyRefinementsOfDeadPrimitive(refine); | 373 destroyRefinementsOfDeadPrimitive(refine); |
| 373 LetPrim letPrim = refine.parent; | 374 LetPrim letPrim = refine.parent; |
| 374 InteriorNode parent = letPrim.parent; | 375 InteriorNode parent = letPrim.parent; |
| 375 parent.body = letPrim.body; | 376 parent.body = letPrim.body; |
| 376 letPrim.body.parent = parent; | 377 letPrim.body.parent = parent; |
| 377 prim.firstRef.unlink(); | 378 prim.firstRef.unlink(); |
| 378 } | 379 } |
| 379 } | 380 } |
| OLD | NEW |