| 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 '../compiler.dart' show Compiler; |
| 8 import '../elements/elements.dart'; |
| 9 import '../js_backend/js_backend.dart' show JavaScriptBackend; |
| 10 import '../world.dart'; |
| 7 import 'cps_ir_nodes.dart'; | 11 import 'cps_ir_nodes.dart'; |
| 8 import '../elements/elements.dart'; | 12 import 'effects.dart'; |
| 13 import 'loop_effects.dart'; |
| 14 import 'loop_hierarchy.dart'; |
| 9 import 'optimizers.dart' show Pass; | 15 import 'optimizers.dart' show Pass; |
| 10 import 'loop_hierarchy.dart'; | |
| 11 import 'loop_effects.dart'; | |
| 12 import '../world.dart'; | |
| 13 import '../compiler.dart' show Compiler; | |
| 14 import '../js_backend/js_backend.dart' show JavaScriptBackend; | |
| 15 import 'type_mask_system.dart'; | 16 import 'type_mask_system.dart'; |
| 16 import 'effects.dart'; | |
| 17 | 17 |
| 18 /// Eliminates redundant primitives by reusing the value of another primitive | 18 /// Eliminates redundant primitives by reusing the value of another primitive |
| 19 /// 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 |
| 20 /// loops when possible. | 20 /// loops when possible. |
| 21 /// | 21 /// |
| 22 /// 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 |
| 23 /// expensive than recomputing the value on-demand. For example, pulling an | 23 /// expensive than recomputing the value on-demand. For example, pulling an |
| 24 /// 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. |
| 25 /// Such primitives are said to be "trivial". | 25 /// Such primitives are said to be "trivial". |
| 26 /// | 26 /// |
| (...skipping 582 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 609 | 609 |
| 610 @override | 610 @override |
| 611 processReference(Reference ref) { | 611 processReference(Reference ref) { |
| 612 callback(ref); | 612 callback(ref); |
| 613 } | 613 } |
| 614 | 614 |
| 615 static void forEach(Primitive node, ReferenceCallback callback) { | 615 static void forEach(Primitive node, ReferenceCallback callback) { |
| 616 new InputVisitor(callback).visit(node); | 616 new InputVisitor(callback).visit(node); |
| 617 } | 617 } |
| 618 } | 618 } |
| OLD | NEW |