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

Side by Side Diff: pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart

Issue 1577993005: Revert "Null check remover understands JS fragments." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 library dart2js.cps_ir.backward_null_check_remover; 1 library dart2js.cps_ir.backward_null_check_remover;
2 2
3 import 'cps_ir_nodes.dart'; 3 import 'cps_ir_nodes.dart';
4 import 'optimizers.dart'; 4 import 'optimizers.dart';
5 import '../common/names.dart'; 5 import '../common/names.dart';
6 import '../universe/selector.dart'; 6 import '../universe/selector.dart';
7 import 'type_mask_system.dart'; 7 import 'type_mask_system.dart';
8 import 'cps_fragment.dart'; 8 import 'cps_fragment.dart';
9 9
10 /// Removes null checks that are follwed by another instruction that will 10 /// Removes null checks that are follwed by another instruction that will
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 Reference<Primitive> getNullCheckedOperand(Primitive prim) { 55 Reference<Primitive> getNullCheckedOperand(Primitive prim) {
56 if (prim is NullCheck) return prim.value; 56 if (prim is NullCheck) return prim.value;
57 if (prim is GetLength) return prim.object; 57 if (prim is GetLength) return prim.object;
58 if (prim is GetField) return prim.object; 58 if (prim is GetField) return prim.object;
59 if (prim is GetIndex) return prim.object; 59 if (prim is GetIndex) return prim.object;
60 if (prim is SetField) return prim.object; 60 if (prim is SetField) return prim.object;
61 if (prim is SetIndex) return prim.object; 61 if (prim is SetIndex) return prim.object;
62 if (prim is InvokeMethod && !selectorsOnNull.contains(prim.selector)) { 62 if (prim is InvokeMethod && !selectorsOnNull.contains(prim.selector)) {
63 return prim.dartReceiverReference; 63 return prim.dartReceiverReference;
64 } 64 }
65 if (prim is ForeignCode) {
66 return prim.isNullGuardOnNullFirstArgument() ? prim.arguments[0] : null;
67 }
68 return null; 65 return null;
69 } 66 }
70 67
71 /// It has been determined that the null check in [prim] made redundant by 68 /// It has been determined that the null check in [prim] made redundant by
72 /// [newNullCheck]. Eliminate [prim] if it is not needed any more. 69 /// [newNullCheck]. Eliminate [prim] if it is not needed any more.
73 void tryEliminateRedundantNullCheck(Primitive prim, Primitive newNullCheck) { 70 void tryEliminateRedundantNullCheck(Primitive prim, Primitive newNullCheck) {
74 if (prim is NullCheck) { 71 if (prim is NullCheck) {
75 Primitive value = prim.value.definition; 72 Primitive value = prim.value.definition;
76 LetPrim let = prim.parent; 73 LetPrim let = prim.parent;
77 prim..replaceUsesWith(value)..destroy(); 74 prim..replaceUsesWith(value)..destroy();
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 void visitLetHandler(LetHandler node) { 117 void visitLetHandler(LetHandler node) {
121 nullCheckedValue = null; 118 nullCheckedValue = null;
122 } 119 }
123 120
124 visitInvokeContinuation(InvokeContinuation node) { 121 visitInvokeContinuation(InvokeContinuation node) {
125 if (!node.isRecursive) { 122 if (!node.isRecursive) {
126 nullCheckedValue = nullCheckedValueAt[node.continuation.definition]; 123 nullCheckedValue = nullCheckedValueAt[node.continuation.definition];
127 } 124 }
128 } 125 }
129 } 126 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/cps_ir/cps_ir_nodes.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698