| 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; | 14 export 'shrinking_reductions.dart' show ShrinkingReducer; |
| 15 export 'mutable_ssa.dart' show MutableVariableEliminator; | 15 export 'mutable_ssa.dart' show MutableVariableEliminator; |
| 16 export 'insert_refinements.dart' show InsertRefinements; | 16 export 'insert_refinements.dart' show InsertRefinements; |
| 17 export 'remove_refinements.dart' show RemoveRefinements; | 17 export 'remove_refinements.dart' show RemoveRefinements; |
| 18 export 'share_final_fields.dart' show ShareFinalFields; |
| 18 export 'share_interceptors.dart' show ShareInterceptors; | 19 export 'share_interceptors.dart' show ShareInterceptors; |
| 19 export 'bounds_checker.dart' show BoundsChecker; | 20 export 'bounds_checker.dart' show BoundsChecker; |
| 20 export 'parent_visitor.dart' show ParentVisitor; | 21 export 'parent_visitor.dart' show ParentVisitor; |
| 21 | 22 |
| 22 /// An optimization pass over the CPS IR. | 23 /// An optimization pass over the CPS IR. |
| 23 abstract class Pass { | 24 abstract class Pass { |
| 24 /// Applies optimizations to root, rewriting it in the process. | 25 /// Applies optimizations to root, rewriting it in the process. |
| 25 void rewrite(FunctionDefinition root); | 26 void rewrite(FunctionDefinition root); |
| 26 | 27 |
| 27 String get passName; | 28 String get passName; |
| (...skipping 11 matching lines...) Expand all Loading... |
| 39 value is StringConstantValue && value.primitiveValue.isEmpty; | 40 value is StringConstantValue && value.primitiveValue.isEmpty; |
| 40 } | 41 } |
| 41 | 42 |
| 42 /// Returns true if [value] satisfies a branching condition with the | 43 /// Returns true if [value] satisfies a branching condition with the |
| 43 /// given strictness. | 44 /// given strictness. |
| 44 /// | 45 /// |
| 45 /// For non-strict, this is the opposite of [isFalsyConstant]. | 46 /// For non-strict, this is the opposite of [isFalsyConstant]. |
| 46 bool isTruthyConstant(ConstantValue value, {bool strict: false}) { | 47 bool isTruthyConstant(ConstantValue value, {bool strict: false}) { |
| 47 return strict ? value.isTrue : !isFalsyConstant(value); | 48 return strict ? value.isTrue : !isFalsyConstant(value); |
| 48 } | 49 } |
| OLD | NEW |