| 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.gvn; | 5 library dart2js.cps_ir.gvn; |
| 6 | 6 |
| 7 import 'cps_ir_nodes.dart'; | 7 import 'cps_ir_nodes.dart'; |
| 8 import '../universe/side_effects.dart'; | 8 import '../universe/side_effects.dart'; |
| 9 import '../elements/elements.dart'; | 9 import '../elements/elements.dart'; |
| 10 import 'optimizers.dart' show Pass; | 10 import 'optimizers.dart' show Pass; |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 gvnFor[prim] = gvn; | 152 gvnFor[prim] = gvn; |
| 153 | 153 |
| 154 // Try to reuse a previously computed value with the same GVN. | 154 // Try to reuse a previously computed value with the same GVN. |
| 155 Primitive existing = environment[gvn]; | 155 Primitive existing = environment[gvn]; |
| 156 if (existing != null && | 156 if (existing != null && |
| 157 canReplaceWithExistingValue(prim) && | 157 canReplaceWithExistingValue(prim) && |
| 158 !isTrivialPrimitive(prim)) { | 158 !isTrivialPrimitive(prim)) { |
| 159 if (prim is Interceptor) { | 159 if (prim is Interceptor) { |
| 160 Interceptor interceptor = existing; | 160 Interceptor interceptor = existing; |
| 161 interceptor.interceptedClasses.addAll(prim.interceptedClasses); | 161 interceptor.interceptedClasses.addAll(prim.interceptedClasses); |
| 162 interceptor.flags |= prim.flags; | |
| 163 } | 162 } |
| 164 prim..replaceUsesWith(existing)..destroy(); | 163 prim..replaceUsesWith(existing)..destroy(); |
| 165 node.remove(); | 164 node.remove(); |
| 166 return next; | 165 return next; |
| 167 } | 166 } |
| 168 | 167 |
| 169 if (tryToHoistOutOfLoop(prim, gvn)) { | 168 if (tryToHoistOutOfLoop(prim, gvn)) { |
| 170 return next; | 169 return next; |
| 171 } | 170 } |
| 172 | 171 |
| (...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 | 742 |
| 744 @override | 743 @override |
| 745 processReference(Reference ref) { | 744 processReference(Reference ref) { |
| 746 callback(ref); | 745 callback(ref); |
| 747 } | 746 } |
| 748 | 747 |
| 749 static void forEach(Primitive node, ReferenceCallback callback) { | 748 static void forEach(Primitive node, ReferenceCallback callback) { |
| 750 new InputVisitor(callback).visit(node); | 749 new InputVisitor(callback).visit(node); |
| 751 } | 750 } |
| 752 } | 751 } |
| OLD | NEW |