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

Unified Diff: pkg/compiler/lib/src/ssa/builder.dart

Issue 2932103002: Separate out loop closure information. (Closed)
Patch Set: . Created 3 years, 6 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/ssa/builder.dart
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart
index 8cb36a9fac82514d94e568b997896946ea2a094e..3d73d73cc3d97c61d56b3305bfb49dd3e3bbe17c 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -1035,9 +1035,13 @@ class SsaBuilder extends ast.Visitor
closureToClassMapper.getMemberMap(callee);
localsHandler.closureData = newClosureData;
if (resolvedAst.kind == ResolvedAstKind.PARSED) {
- localsHandler.enterScope(
- newClosureData.capturingScopes[resolvedAst.node],
- forGenerativeConstructorBody: callee.isGenerativeConstructorBody);
+ // TODO(efortuna): Take out the test below for null once we are no
+ // longer dealing with the ClosureClassMap interface directly.
+ if (newClosureData.capturingScopes[resolvedAst.node] != null) {
+ localsHandler.enterScope(
+ newClosureData.capturingScopes[resolvedAst.node],
+ forGenerativeConstructorBody: callee.isGenerativeConstructorBody);
+ }
}
buildInitializers(callee, constructorResolvedAsts, fieldValues);
localsHandler.closureData = oldClosureData;
@@ -1725,7 +1729,12 @@ class SsaBuilder extends ast.Visitor
}
loopHandler.handleLoop(
- node, buildInitializer, buildCondition, buildUpdate, buildBody);
+ node,
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node),
+ buildInitializer,
+ buildCondition,
+ buildUpdate,
+ buildBody);
}
visitWhile(ast.While node) {
@@ -1735,7 +1744,12 @@ class SsaBuilder extends ast.Visitor
return popBoolified();
}
- loopHandler.handleLoop(node, () {}, buildCondition, () {}, () {
+ loopHandler.handleLoop(
+ node,
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node),
+ () {},
+ buildCondition,
+ () {}, () {
visit(node.body);
});
}
@@ -1743,7 +1757,9 @@ class SsaBuilder extends ast.Visitor
visitDoWhile(ast.DoWhile node) {
assert(isReachable);
LocalsHandler savedLocals = new LocalsHandler.from(localsHandler);
- localsHandler.startLoop(node);
+ var loopClosureInfo =
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node);
+ localsHandler.startLoop(loopClosureInfo);
loopDepth++;
JumpHandler jumpHandler = loopHandler.beginLoopHeader(node);
HLoopInformation loopInfo = current.loopInformation;
@@ -1761,7 +1777,7 @@ class SsaBuilder extends ast.Visitor
// Using a separate block is just a simple workaround.
bodyEntryBlock = openNewBlock();
}
- localsHandler.enterLoopBody(node);
+ localsHandler.enterLoopBody(loopClosureInfo);
visit(node.body);
// If there are no continues we could avoid the creation of the condition
@@ -5450,7 +5466,12 @@ class SsaBuilder extends ast.Visitor
buildProtectedByFinally(() {
loopHandler.handleLoop(
- node, buildInitializer, buildCondition, buildUpdate, buildBody);
+ node,
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node),
+ buildInitializer,
+ buildCondition,
+ buildUpdate,
+ buildBody);
}, () {
pushInvokeDynamic(node, Selectors.cancel, null, [streamIterator]);
push(new HAwait(pop(),
@@ -5517,7 +5538,12 @@ class SsaBuilder extends ast.Visitor
}
loopHandler.handleLoop(
- node, buildInitializer, buildCondition, () {}, buildBody);
+ node,
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node),
+ buildInitializer,
+ buildCondition,
+ () {},
+ buildBody);
}
buildAssignLoopVariable(ast.ForIn node, HInstruction value) {
@@ -5636,7 +5662,12 @@ class SsaBuilder extends ast.Visitor
}
loopHandler.handleLoop(
- node, buildInitializer, buildCondition, buildUpdate, buildBody);
+ node,
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node),
+ buildInitializer,
+ buildCondition,
+ buildUpdate,
+ buildBody);
}
visitLabel(ast.Label node) {
@@ -5983,7 +6014,13 @@ class SsaBuilder extends ast.Visitor
}
void buildLoop() {
- loopHandler.handleLoop(node, () {}, buildCondition, () {}, buildSwitch);
+ loopHandler.handleLoop(
+ node,
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node),
+ () {},
+ buildCondition,
+ () {},
+ buildSwitch);
}
if (hasDefault) {

Powered by Google App Engine
This is Rietveld 408576698