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

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

Issue 1645933002: dart2js CPS: During shrinking reductions, mark deleted branches as deleted. (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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 dart2js.cps_ir.shrinking_reductions; 5 library dart2js.cps_ir.shrinking_reductions;
6 6
7 import 'cps_ir_nodes.dart'; 7 import 'cps_ir_nodes.dart';
8 import 'optimizers.dart'; 8 import 'optimizers.dart';
9 9
10 /** 10 /**
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 break; 125 break;
126 case _ReductionKind.ETA_CONT: 126 case _ReductionKind.ETA_CONT:
127 _reduceEtaCont(task); 127 _reduceEtaCont(task);
128 break; 128 break;
129 case _ReductionKind.DEAD_PARAMETER: 129 case _ReductionKind.DEAD_PARAMETER:
130 _reduceDeadParameter(task); 130 _reduceDeadParameter(task);
131 break; 131 break;
132 case _ReductionKind.BRANCH: 132 case _ReductionKind.BRANCH:
133 _reduceBranch(task); 133 _reduceBranch(task);
134 break; 134 break;
135 default:
136 assert(false);
137 } 135 }
138 } 136 }
139 137
140 /// Applies the dead-val reduction: 138 /// Applies the dead-val reduction:
141 /// letprim x = V in E -> E (x not free in E). 139 /// letprim x = V in E -> E (x not free in E).
142 void _reduceDeadVal(_ReductionTask task) { 140 void _reduceDeadVal(_ReductionTask task) {
143 if (_isRemoved(task.node)) return; 141 if (_isRemoved(task.node)) return;
144 assert(_isDeadVal(task.node)); 142 assert(_isDeadVal(task.node));
145 143
146 LetPrim deadLet = task.node; 144 LetPrim deadLet = task.node;
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 _RemovalVisitor(this.worklist); 629 _RemovalVisitor(this.worklist);
632 630
633 void processLetPrim(LetPrim node) { 631 void processLetPrim(LetPrim node) {
634 node.parent = null; 632 node.parent = null;
635 } 633 }
636 634
637 void processContinuation(Continuation node) { 635 void processContinuation(Continuation node) {
638 node.parent = null; 636 node.parent = null;
639 } 637 }
640 638
639 void processBranch(Branch node) {
640 node.parent = null;
641 }
642
641 void processReference(Reference reference) { 643 void processReference(Reference reference) {
642 reference.unlink(); 644 reference.unlink();
643 645
644 if (reference.definition is Primitive) { 646 if (reference.definition is Primitive) {
645 Primitive primitive = reference.definition.unrefined; 647 Primitive primitive = reference.definition.unrefined;
646 Node parent = primitive.parent; 648 Node parent = primitive.parent;
647 // The parent might be the deleted sentinel, or it might be a 649 // The parent might be the deleted sentinel, or it might be a
648 // Continuation or FunctionDefinition if the primitive is an argument. 650 // Continuation or FunctionDefinition if the primitive is an argument.
649 if (parent is LetPrim && _isDeadVal(parent)) { 651 if (parent is LetPrim && _isDeadVal(parent)) {
650 worklist.add(new _ReductionTask(_ReductionKind.DEAD_VAL, parent)); 652 worklist.add(new _ReductionTask(_ReductionKind.DEAD_VAL, parent));
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
700 assert(node is Continuation || node is LetPrim || node is Parameter || 702 assert(node is Continuation || node is LetPrim || node is Parameter ||
701 node is Branch); 703 node is Branch);
702 } 704 }
703 705
704 bool operator==(_ReductionTask that) { 706 bool operator==(_ReductionTask that) {
705 return (that.kind == this.kind && that.node == this.node); 707 return (that.kind == this.kind && that.node == this.node);
706 } 708 }
707 709
708 String toString() => "$kind: $node"; 710 String toString() => "$kind: $node";
709 } 711 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698