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

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

Issue 1537663002: dart2js: Initial implementation of inlining. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Rebaseline test expectations and fix a bug (typo). Created 4 years, 12 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
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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
159 return; 159 return;
160 } 160 }
161 161
162 // Remove the continuation. 162 // Remove the continuation.
163 Continuation cont = task.node; 163 Continuation cont = task.node;
164 _removeContinuation(cont); 164 _removeContinuation(cont);
165 165
166 InvokeContinuation invoke = cont.body; 166 InvokeContinuation invoke = cont.body;
167 Continuation wrappedCont = invoke.continuation.definition; 167 Continuation wrappedCont = invoke.continuation.definition;
168 168
169 // If the invocation of wrappedCont is escaping, then all invocations of
170 // cont will be as well, after the reduction.
171 if (invoke.isEscapingTry) {
172 Reference current = cont.firstRef;
173 while (current != null) {
174 InvokeContinuation owner = current.parent;
175 owner.isEscapingTry = true;
176 current = current.next;
177 }
178 }
179
169 // Replace all occurrences with the wrapped continuation. 180 // Replace all occurrences with the wrapped continuation.
170 cont.replaceUsesWith(wrappedCont); 181 cont.replaceUsesWith(wrappedCont);
171 182
172 // Perform bookkeeping on removed body and scan for new redexes. 183 // Perform bookkeeping on removed body and scan for new redexes.
173 new _RemovalVisitor(_worklist).visit(cont); 184 new _RemovalVisitor(_worklist).visit(cont);
174 } 185 }
175 186
176 void _reduceDeadParameter(_ReductionTask task) { 187 void _reduceDeadParameter(_ReductionTask task) {
177 // Continuation eta-reduction can destroy a dead parameter redex. For 188 // Continuation eta-reduction can destroy a dead parameter redex. For
178 // example, in the term: 189 // example, in the term:
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after
513 524
514 String toString() => "$kind: $node"; 525 String toString() => "$kind: $node";
515 } 526 }
516 527
517 /// A dummy class used solely to mark nodes as deleted once they are removed 528 /// A dummy class used solely to mark nodes as deleted once they are removed
518 /// from a term. 529 /// from a term.
519 class _DeletedNode extends Node { 530 class _DeletedNode extends Node {
520 accept(_) {} 531 accept(_) {}
521 setParentPointers() {} 532 setParentPointers() {}
522 } 533 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/optimizers.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698