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

Unified Diff: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart

Issue 1220123004: dart2js cps: Ensure definitions are specialized before their uses. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
diff --git a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
index 933c907cc41282eda1c21e4f342c2f47da289523..6ca4430ebf569a99918714077052503e282eda30 100644
--- a/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
+++ b/pkg/compiler/lib/src/tree_ir/tree_ir_builder.dart
@@ -54,15 +54,6 @@ class Builder implements cps_ir.Visitor<Node> {
// is the mapping from continuations to labels.
final Map<cps_ir.Continuation, Label> labels = <cps_ir.Continuation, Label>{};
- /// A stack of singly-used labels that can be safely inlined at their use
- /// site.
- ///
- /// Code for continuations with exactly one use is inlined at the use site.
- /// This is not safe if the code is moved inside the scope of an exception
- /// handler (i.e., into a try block). We keep a stack of singly-referenced
- /// continuations that are in scope without crossing a binding for a handler.
- List<cps_ir.Continuation> safeForInlining = <cps_ir.Continuation>[];
-
ExecutableElement currentElement;
/// The 'this' Parameter for currentElement or the enclosing method.
cps_ir.Parameter thisParameter;
@@ -318,16 +309,12 @@ class Builder implements cps_ir.Visitor<Node> {
Statement visitLetCont(cps_ir.LetCont node) {
// Introduce labels for continuations that need them.
- int safeForInliningLengthOnEntry = safeForInlining.length;
for (cps_ir.Continuation continuation in node.continuations) {
if (continuation.hasMultipleUses || continuation.isRecursive) {
labels[continuation] = new Label();
- } else {
- safeForInlining.add(continuation);
}
}
Statement body = visit(node.body);
- safeForInlining.length = safeForInliningLengthOnEntry;
// Continuations are bound at the same level, but they have to be
// translated as if nested. This is because the body can invoke any
// of them from anywhere, so it must be nested inside all of them.
@@ -352,10 +339,7 @@ class Builder implements cps_ir.Visitor<Node> {
}
Statement visitLetHandler(cps_ir.LetHandler node) {
- List<cps_ir.Continuation> saved = safeForInlining;
- safeForInlining = <cps_ir.Continuation>[];
Statement tryBody = visit(node.body);
- safeForInlining = saved;
List<Variable> catchParameters =
node.handler.parameters.map(getVariable).toList();
Statement catchBody = visit(node.handler.body);
@@ -490,7 +474,7 @@ class Builder implements cps_ir.Visitor<Node> {
: new WhileTrue(labels[cont], visit(cont.body));
} else {
if (cont.hasExactlyOneUse) {
- if (safeForInlining.contains(cont)) {
+ if (!node.isEscapingTry) {
return visit(cont.body);
}
labels[cont] = new Label();

Powered by Google App Engine
This is Rietveld 408576698