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 'cps_ir_nodes.dart'; | 7 import 'cps_ir_nodes.dart'; |
8 import '../constants/values.dart'; | 8 import '../constants/values.dart'; |
9 | 9 |
10 export 'type_propagation.dart' show TypePropagator; | 10 export 'type_propagation.dart' show TypePropagator; |
11 export 'redundant_phi.dart' show RedundantPhiEliminator; | 11 export 'redundant_phi.dart' show RedundantPhiEliminator; |
12 export 'redundant_join.dart' show RedundantJoinEliminator; | 12 export 'redundant_join.dart' show RedundantJoinEliminator; |
13 export 'shrinking_reductions.dart' show ShrinkingReducer, ParentVisitor; | 13 export 'shrinking_reductions.dart' show ShrinkingReducer, ParentVisitor; |
14 export 'mutable_ssa.dart' show MutableVariableEliminator; | 14 export 'mutable_ssa.dart' show MutableVariableEliminator; |
| 15 export 'let_sinking.dart' show LetSinker; |
15 | 16 |
16 /// An optimization pass over the CPS IR. | 17 /// An optimization pass over the CPS IR. |
17 abstract class Pass { | 18 abstract class Pass { |
18 /// Applies optimizations to root, rewriting it in the process. | 19 /// Applies optimizations to root, rewriting it in the process. |
19 void rewrite(FunctionDefinition root); | 20 void rewrite(FunctionDefinition root); |
20 | 21 |
21 String get passName; | 22 String get passName; |
22 } | 23 } |
23 | 24 |
24 // Shared code between optimizations | 25 // Shared code between optimizations |
25 | 26 |
26 /// Returns true if [value] is false, null, 0, -0, NaN, or the empty string. | 27 /// Returns true if [value] is false, null, 0, -0, NaN, or the empty string. |
27 bool isFalsyConstant(ConstantValue value) { | 28 bool isFalsyConstant(ConstantValue value) { |
28 return value.isFalse || | 29 return value.isFalse || |
29 value.isNull || | 30 value.isNull || |
30 value.isZero || | 31 value.isZero || |
31 value.isMinusZero || | 32 value.isMinusZero || |
32 value.isNaN || | 33 value.isNaN || |
33 value is StringConstantValue && value.primitiveValue.isEmpty; | 34 value is StringConstantValue && value.primitiveValue.isEmpty; |
34 } | 35 } |
OLD | NEW |