| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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.optimizers; | 5 library dart2js.cps_ir.optimizers; |
| 6 | 6 |
| 7 import '../constants/expressions.dart' show | 7 import '../constants/expressions.dart' show |
| 8 ConstantExpression, | 8 ConstantExpression, |
| 9 PrimitiveConstantExpression; | 9 PrimitiveConstantExpression; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 part 'shrinking_reductions.dart'; | 25 part 'shrinking_reductions.dart'; |
| 26 | 26 |
| 27 /// An optimization pass over the CPS IR. | 27 /// An optimization pass over the CPS IR. |
| 28 abstract class Pass { | 28 abstract class Pass { |
| 29 /// Applies optimizations to root, rewriting it in the process. | 29 /// Applies optimizations to root, rewriting it in the process. |
| 30 void rewrite(ExecutableDefinition root) => root.applyPass(this); | 30 void rewrite(ExecutableDefinition root) => root.applyPass(this); |
| 31 | 31 |
| 32 void rewriteConstructorDefinition(ConstructorDefinition root); | 32 void rewriteConstructorDefinition(ConstructorDefinition root); |
| 33 void rewriteFunctionDefinition(FunctionDefinition root); | 33 void rewriteFunctionDefinition(FunctionDefinition root); |
| 34 void rewriteFieldDefinition(FieldDefinition root); | 34 void rewriteFieldDefinition(FieldDefinition root); |
| 35 |
| 36 String get passName; |
| 35 } | 37 } |
| 36 | 38 |
| 37 abstract class PassMixin implements Pass { | 39 abstract class PassMixin implements Pass { |
| 38 void rewrite(ExecutableDefinition root) => root.applyPass(this); | 40 void rewrite(ExecutableDefinition root) => root.applyPass(this); |
| 39 | 41 |
| 40 void rewriteExecutableDefinition(ExecutableDefinition root); | 42 void rewriteExecutableDefinition(ExecutableDefinition root); |
| 41 | 43 |
| 42 void rewriteFunctionDefinition(FunctionDefinition root) { | 44 void rewriteFunctionDefinition(FunctionDefinition root) { |
| 43 if (root.isAbstract) return; | 45 if (root.isAbstract) return; |
| 44 rewriteExecutableDefinition(root); | 46 rewriteExecutableDefinition(root); |
| 45 } | 47 } |
| 46 | 48 |
| 47 void rewriteConstructorDefinition(ConstructorDefinition root) { | 49 void rewriteConstructorDefinition(ConstructorDefinition root) { |
| 48 if (root.isAbstract) return; | 50 if (root.isAbstract) return; |
| 49 rewriteExecutableDefinition(root); | 51 rewriteExecutableDefinition(root); |
| 50 } | 52 } |
| 51 void rewriteFieldDefinition(FieldDefinition root) { | 53 void rewriteFieldDefinition(FieldDefinition root) { |
| 52 if (!root.hasInitializer) return; | 54 if (!root.hasInitializer) return; |
| 53 rewriteExecutableDefinition(root); | 55 rewriteExecutableDefinition(root); |
| 54 } | 56 } |
| 55 } | 57 } |
| OLD | NEW |