| 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'; | |
| 9 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 10 import 'optimizers.dart' show Pass; | 9 import 'optimizers.dart' show Pass; |
| 11 import 'loop_hierarchy.dart'; | 10 import 'loop_hierarchy.dart'; |
| 12 import 'loop_effects.dart'; | 11 import 'loop_effects.dart'; |
| 13 import '../world.dart'; | 12 import '../world.dart'; |
| 14 import '../compiler.dart' show Compiler; | 13 import '../compiler.dart' show Compiler; |
| 15 import '../js_backend/js_backend.dart' show JavaScriptBackend; | 14 import '../js_backend/js_backend.dart' show JavaScriptBackend; |
| 16 import '../constants/values.dart'; | |
| 17 import 'type_mask_system.dart'; | 15 import 'type_mask_system.dart'; |
| 18 import 'effects.dart'; | 16 import 'effects.dart'; |
| 19 | 17 |
| 20 /// Eliminates redundant primitives by reusing the value of another primitive | 18 /// Eliminates redundant primitives by reusing the value of another primitive |
| 21 /// that is known to have the same result. Primitives are also hoisted out of | 19 /// that is known to have the same result. Primitives are also hoisted out of |
| 22 /// loops when possible. | 20 /// loops when possible. |
| 23 /// | 21 /// |
| 24 /// Reusing values can introduce new temporaries, which in some cases is more | 22 /// Reusing values can introduce new temporaries, which in some cases is more |
| 25 /// expensive than recomputing the value on-demand. For example, pulling an | 23 /// expensive than recomputing the value on-demand. For example, pulling an |
| 26 /// expression such as "n+1" out of a loop is generally not worth it. | 24 /// expression such as "n+1" out of a loop is generally not worth it. |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 | 607 |
| 610 @override | 608 @override |
| 611 processReference(Reference ref) { | 609 processReference(Reference ref) { |
| 612 callback(ref); | 610 callback(ref); |
| 613 } | 611 } |
| 614 | 612 |
| 615 static void forEach(Primitive node, ReferenceCallback callback) { | 613 static void forEach(Primitive node, ReferenceCallback callback) { |
| 616 new InputVisitor(callback).visit(node); | 614 new InputVisitor(callback).visit(node); |
| 617 } | 615 } |
| 618 } | 616 } |
| OLD | NEW |