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 | 15 |
15 /// An optimization pass over the CPS IR. | 16 /// An optimization pass over the CPS IR. |
16 abstract class Pass { | 17 abstract class Pass { |
17 /// Applies optimizations to root, rewriting it in the process. | 18 /// Applies optimizations to root, rewriting it in the process. |
18 void rewrite(FunctionDefinition root); | 19 void rewrite(FunctionDefinition root); |
19 | 20 |
20 String get passName; | 21 String get passName; |
21 } | 22 } |
22 | 23 |
23 // Shared code between optimizations | 24 // Shared code between optimizations |
24 | 25 |
25 /// Returns true if [value] is false, null, 0, -0, NaN, or the empty string. | 26 /// Returns true if [value] is false, null, 0, -0, NaN, or the empty string. |
26 bool isFalsyConstant(ConstantValue value) { | 27 bool isFalsyConstant(ConstantValue value) { |
27 return value.isFalse || | 28 return value.isFalse || |
28 value.isNull || | 29 value.isNull || |
29 value.isZero || | 30 value.isZero || |
30 value.isMinusZero || | 31 value.isMinusZero || |
31 value.isNaN || | 32 value.isNaN || |
32 value is StringConstantValue && value.primitiveValue.isEmpty; | 33 value is StringConstantValue && value.primitiveValue.isEmpty; |
33 } | 34 } |
OLD | NEW |