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

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

Issue 1616673002: dart2js cps: Debugging utility and fix idempotency in shrinking reducer. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Do not run the same Pass instance twice 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 /// It has been determined that the null check in [prim] made redundant by 71 /// It has been determined that the null check in [prim] made redundant by
72 /// [newNullCheck]. Eliminate [prim] if it is not needed any more. 72 /// [newNullCheck]. Eliminate [prim] if it is not needed any more.
73 void tryEliminateRedundantNullCheck(Primitive prim, Primitive newNullCheck) { 73 void tryEliminateRedundantNullCheck(Primitive prim, Primitive newNullCheck) {
74 if (prim is NullCheck) { 74 if (prim is NullCheck) {
75 Primitive value = prim.value.definition; 75 Primitive value = prim.value.definition;
76 LetPrim let = prim.parent; 76 LetPrim let = prim.parent;
77 prim..replaceUsesWith(value)..destroy(); 77 prim..replaceUsesWith(value)..destroy();
78 let.remove(); 78 let.remove();
79 } else if (prim is GetLength || prim is GetField || prim is GetIndex) { 79 } else if (prim is GetLength || prim is GetField || prim is GetIndex) {
80 if (prim.hasNoEffectiveUses) { 80 if (prim.hasNoRefinedUses) {
81 destroyRefinementsOfDeadPrimitive(prim); 81 destroyRefinementsOfDeadPrimitive(prim);
82 LetPrim let = prim.parent; 82 LetPrim let = prim.parent;
83 prim..destroy(); 83 prim..destroy();
84 let.remove(); 84 let.remove();
85 } 85 }
86 } 86 }
87 } 87 }
88 88
89 /// True if [prim] can be moved above a null check. This is safe if [prim] 89 /// True if [prim] can be moved above a null check. This is safe if [prim]
90 /// cannot throw or have side effects and does not carry any path-sensitive 90 /// cannot throw or have side effects and does not carry any path-sensitive
(...skipping 29 matching lines...) Expand all
120 void visitLetHandler(LetHandler node) { 120 void visitLetHandler(LetHandler node) {
121 nullCheckedValue = null; 121 nullCheckedValue = null;
122 } 122 }
123 123
124 visitInvokeContinuation(InvokeContinuation node) { 124 visitInvokeContinuation(InvokeContinuation node) {
125 if (!node.isRecursive) { 125 if (!node.isRecursive) {
126 nullCheckedValue = nullCheckedValueAt[node.continuation.definition]; 126 nullCheckedValue = nullCheckedValueAt[node.continuation.definition];
127 } 127 }
128 } 128 }
129 } 129 }
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