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

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

Issue 1583663003: dart2js cps: specialize isEmpty and isNotEmpty (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: wrap long lines Created 4 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/cps_ir/type_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index 19e8c87d6a79f8d57f733e12d32ac049aa7c36ae..aa26e319231398246ef0cd811da339ff54222879 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -1388,6 +1388,28 @@ class TransformingVisitor extends DeepRecursiveVisitor {
assert(node.hasNoUses);
return cps;
+ case 'isEmpty':
+ if (!node.selector.isGetter) return null;
+ CpsFragment cps = new CpsFragment(node.sourceInformation);
+ Primitive length = cps.letPrim(new GetLength(receiver));
+ Constant zero = cps.makeZero();
+ ApplyBuiltinOperator op = cps.applyBuiltin(BuiltinOperator.StrictEq,
+ [length, zero]);
+ node.replaceUsesWith(op);
+ op.hint = node.hint;
+ return cps;
+
+ case 'isNotEmpty':
+ if (!node.selector.isGetter) return null;
+ CpsFragment cps = new CpsFragment(node.sourceInformation);
+ Primitive length = cps.letPrim(new GetLength(receiver));
+ Constant zero = cps.makeZero();
+ ApplyBuiltinOperator op = cps.applyBuiltin(BuiltinOperator.StrictNeq,
+ [length, zero]);
+ node.replaceUsesWith(op);
+ op.hint = node.hint;
+ return cps;
+
default:
return null;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698