Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(910)

Unified Diff: pkg/compiler/lib/src/cps_ir/optimizers.dart

Issue 1229893002: dart2js cps: Redundant join elimination. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart ('k') | pkg/compiler/lib/src/cps_ir/redundant_join.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/optimizers.dart
diff --git a/pkg/compiler/lib/src/cps_ir/optimizers.dart b/pkg/compiler/lib/src/cps_ir/optimizers.dart
index c80dfb0499f952cee3c110f286d231a4dbb2200e..3b48349f6e0e45d7633f8bf4e6ac7853043a22e6 100644
--- a/pkg/compiler/lib/src/cps_ir/optimizers.dart
+++ b/pkg/compiler/lib/src/cps_ir/optimizers.dart
@@ -5,9 +5,11 @@
library dart2js.cps_ir.optimizers;
import 'cps_ir_nodes.dart';
+import '../constants/values.dart';
export 'type_propagation.dart' show TypePropagator;
export 'redundant_phi.dart' show RedundantPhiEliminator;
+export 'redundant_join.dart' show RedundantJoinEliminator;
export 'shrinking_reductions.dart' show ShrinkingReducer, ParentVisitor;
/// An optimization pass over the CPS IR.
@@ -17,3 +19,15 @@ abstract class Pass {
String get passName;
}
+
+// Shared code between optimizations
+
+/// Returns true if [value] is false, null, 0, -0, NaN, or the empty string.
+bool isFalsyConstant(ConstantValue value) {
+ return value.isFalse ||
+ value.isNull ||
+ value.isZero ||
+ value.isMinusZero ||
+ value.isNaN ||
+ value is StringConstantValue && value.primitiveValue.isEmpty;
+}
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/cps_ir_tracer.dart ('k') | pkg/compiler/lib/src/cps_ir/redundant_join.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698