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

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

Issue 1668913002: dart2js cps: More aggressive operator specialization. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
Index: pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart
diff --git a/pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart b/pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart
index b55a433ffa2da6d15b7a9fd0eb3b67f4ec1c2265..6a2c16fac20b8d490159bb4563b712bc30e98610 100644
--- a/pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart
+++ b/pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart
@@ -19,11 +19,11 @@ import 'cps_fragment.dart';
///
/// print(x.length);
///
-/// `x.length` will throw when x is null, so the original [NullCheck] is not
+/// `x.length` will throw when x is null, so the original [ReceiverCheck] is not
/// needed. This changes the error message, but at least for now we are
/// willing to accept this.
///
-/// Note that code motion may not occur after this pass, since the [NullCheck]
+/// Note that code motion may not occur after this pass, since the [ReceiverCheck]
Siggi Cherem (dart-lang) 2016/02/05 18:19:39 nit: 80 col
asgerf 2016/02/09 12:19:54 Done.
/// nodes are not there to restrict it.
//
// TODO(asgerf): It would be nice with a clear specification of when we allow
@@ -53,7 +53,7 @@ class BackwardNullCheckRemover extends BlockVisitor implements Pass {
/// Returns a reference to an operand of [prim], where [prim] throws if null
/// is passed into that operand.
Reference<Primitive> getNullCheckedOperand(Primitive prim) {
- if (prim is NullCheck) return prim.value;
+ if (prim is ReceiverCheck) return prim.value;
if (prim is GetLength) return prim.object;
if (prim is GetField) return prim.object;
if (prim is GetIndex) return prim.object;
@@ -71,7 +71,7 @@ class BackwardNullCheckRemover extends BlockVisitor implements Pass {
/// It has been determined that the null check in [prim] made redundant by
/// [newNullCheck]. Eliminate [prim] if it is not needed any more.
void tryEliminateRedundantNullCheck(Primitive prim, Primitive newNullCheck) {
- if (prim is NullCheck) {
+ if (prim is ReceiverCheck && prim.isNullCheck) {
Primitive value = prim.value.definition;
LetPrim let = prim.parent;
prim..replaceUsesWith(value)..destroy();
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698