| OLD | NEW |
| 1 library dart2js.cps_ir.update_refinements; | 1 library dart2js.cps_ir.update_refinements; |
| 2 | 2 |
| 3 import 'cps_ir_nodes.dart'; | 3 import 'cps_ir_nodes.dart'; |
| 4 import 'optimizers.dart' show Pass; | 4 import 'optimizers.dart' show Pass; |
| 5 import 'type_mask_system.dart'; | 5 import 'type_mask_system.dart'; |
| 6 import '../world.dart'; | 6 import '../world.dart'; |
| 7 | 7 |
| 8 /// Updates all references to use the most refined version in scope. | 8 /// Updates all references to use the most refined version in scope. |
| 9 /// | 9 /// |
| 10 /// [GVN] and [RedundantJoinElimination], and possibly other passes, can create | 10 /// [GVN] and [RedundantJoinElimination], and possibly other passes, can create |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 node.refineType); | 66 node.refineType); |
| 67 } | 67 } |
| 68 Primitive value = node.effectiveDefinition; | 68 Primitive value = node.effectiveDefinition; |
| 69 Primitive old = refinementFor[value]; | 69 Primitive old = refinementFor[value]; |
| 70 refinementFor[value] = node; | 70 refinementFor[value] = node; |
| 71 pushAction(() { | 71 pushAction(() { |
| 72 refinementFor[value] = old; | 72 refinementFor[value] = old; |
| 73 }); | 73 }); |
| 74 } | 74 } |
| 75 | 75 |
| 76 visitBoundsCheck(BoundsCheck node) { |
| 77 super.visitBoundsCheck(node); |
| 78 if (node.hasIntegerCheck && |
| 79 typeSystem.isDefinitelyInt(node.index.definition.type)) { |
| 80 node.checks &= ~BoundsCheck.INTEGER; |
| 81 } |
| 82 } |
| 83 |
| 76 processReference(Reference ref) { | 84 processReference(Reference ref) { |
| 77 refine(ref); | 85 refine(ref); |
| 78 } | 86 } |
| 79 | 87 |
| 80 bool refine(Reference ref) { | 88 bool refine(Reference ref) { |
| 81 Definition def = ref.definition; | 89 Definition def = ref.definition; |
| 82 if (def is Primitive) { | 90 if (def is Primitive) { |
| 83 Primitive refinement = refinementFor[def.effectiveDefinition]; | 91 Primitive refinement = refinementFor[def.effectiveDefinition]; |
| 84 if (refinement != null && refinement != ref.definition) { | 92 if (refinement != null && refinement != ref.definition) { |
| 85 ref.changeTo(refinement); | 93 ref.changeTo(refinement); |
| 86 return true; | 94 return true; |
| 87 } | 95 } |
| 88 } | 96 } |
| 89 return false; | 97 return false; |
| 90 } | 98 } |
| 91 } | 99 } |
| OLD | NEW |