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

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

Issue 1743283002: dart2js cps: Use definitions by default, not references. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Fix doc comments and long lines 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 6a2c16fac20b8d490159bb4563b712bc30e98610..de027ecdaef4059e88f6c7354f7e1cba0ffd2669 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
@@ -50,9 +50,8 @@ class BackwardNullCheckRemover extends BlockVisitor implements Pass {
BlockVisitor.traverseInPostOrder(node, this);
}
- /// Returns a reference to an operand of [prim], where [prim] throws if null
- /// is passed into that operand.
- Reference<Primitive> getNullCheckedOperand(Primitive prim) {
+ /// Returns an operand of [prim] that throws if null is passed into it.
+ Primitive getNullCheckedOperand(Primitive prim) {
if (prim is ReceiverCheck) return prim.value;
if (prim is GetLength) return prim.object;
if (prim is GetField) return prim.object;
@@ -60,10 +59,10 @@ class BackwardNullCheckRemover extends BlockVisitor implements Pass {
if (prim is SetField) return prim.object;
if (prim is SetIndex) return prim.object;
if (prim is InvokeMethod && !selectorsOnNull.contains(prim.selector)) {
- return prim.dartReceiverReference;
+ return prim.dartReceiver;
}
if (prim is ForeignCode) {
- return prim.isNullGuardOnNullFirstArgument() ? prim.arguments[0] : null;
+ return prim.isNullGuardOnNullFirstArgument() ? prim.argument(0) : null;
}
return null;
}
@@ -72,7 +71,7 @@ class BackwardNullCheckRemover extends BlockVisitor implements Pass {
/// [newNullCheck]. Eliminate [prim] if it is not needed any more.
void tryEliminateRedundantNullCheck(Primitive prim, Primitive newNullCheck) {
if (prim is ReceiverCheck && prim.isNullCheck) {
- Primitive value = prim.value.definition;
+ Primitive value = prim.value;
LetPrim let = prim.parent;
prim..replaceUsesWith(value)..destroy();
let.remove();
@@ -99,7 +98,7 @@ class BackwardNullCheckRemover extends BlockVisitor implements Pass {
void visitLetPrim(LetPrim node) {
Primitive prim = node.primitive;
- Primitive receiver = getNullCheckedOperand(prim)?.definition;
+ Primitive receiver = getNullCheckedOperand(prim);
if (receiver != null) {
if (nullCheckedValue != null && receiver.sameValue(nullCheckedValue)) {
tryEliminateRedundantNullCheck(prim, nullCheckedValue);
@@ -123,7 +122,7 @@ class BackwardNullCheckRemover extends BlockVisitor implements Pass {
visitInvokeContinuation(InvokeContinuation node) {
if (!node.isRecursive) {
- nullCheckedValue = nullCheckedValueAt[node.continuation.definition];
+ nullCheckedValue = nullCheckedValueAt[node.continuation];
}
}
}
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/bounds_checker.dart » ('j') | pkg/compiler/lib/src/cps_ir/bounds_checker.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698