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

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

Issue 1538593003: dart2js cps: Backward redundant null check removal (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library cps_ir.cps_fragment; 5 library cps_ir.cps_fragment;
6 6
7 import 'cps_ir_nodes.dart'; 7 import 'cps_ir_nodes.dart';
8 import '../constants/values.dart'; 8 import '../constants/values.dart';
9 import '../universe/selector.dart' show Selector; 9 import '../universe/selector.dart' show Selector;
10 import '../types/types.dart' show TypeMask; 10 import '../types/types.dart' show TypeMask;
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
339 } 339 }
340 } 340 }
341 341
342 /// Removes [node], unlinking all its references and replaces it with [newNode]. 342 /// Removes [node], unlinking all its references and replaces it with [newNode].
343 void destroyAndReplace(Expression node, Expression newNode) { 343 void destroyAndReplace(Expression node, Expression newNode) {
344 InteriorNode parent = node.parent; 344 InteriorNode parent = node.parent;
345 RemovalVisitor.remove(node); 345 RemovalVisitor.remove(node);
346 parent.body = newNode; 346 parent.body = newNode;
347 newNode.parent = parent; 347 newNode.parent = parent;
348 } 348 }
349
350 /// Removes all [Refinement] uses of a given primitive that has no effective
351 /// uses.
352 void destroyRefinementsOfDeadPrimitive(Primitive prim) {
353 while (prim.firstRef != null) {
354 Refinement refine = prim.firstRef.parent;
355 destroyRefinementsOfDeadPrimitive(refine);
356 LetPrim letPrim = refine.parent;
357 InteriorNode parent = letPrim.parent;
358 parent.body = letPrim.body;
359 letPrim.body.parent = parent;
360 prim.firstRef.unlink();
361 }
362 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/backward_null_check_remover.dart ('k') | pkg/compiler/lib/src/cps_ir/optimizers.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698