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