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