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

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

Issue 2936693002: Reapply "Separate out loop closure information." (Closed)
Patch Set: call with ast.node instead of ir.Node until we update that path. 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 502e88cd1f229bfba518a48a1f49d76808026c35..ade11d4865dc4f1c6123113b926c21ecb851241c 100644
--- a/pkg/compiler/lib/src/ssa/builder.dart
+++ b/pkg/compiler/lib/src/ssa/builder.dart
@@ -1037,9 +1037,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;
@@ -1727,7 +1731,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) {
@@ -1737,7 +1746,12 @@ class SsaBuilder extends ast.Visitor
return popBoolified();
}
- loopHandler.handleLoop(node, () {}, buildCondition, () {}, () {
+ loopHandler.handleLoop(
+ node,
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node),
+ () {},
+ buildCondition,
+ () {}, () {
visit(node.body);
});
}
@@ -1745,7 +1759,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;
@@ -1763,7 +1779,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
@@ -5452,7 +5468,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(),
@@ -5519,7 +5540,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) {
@@ -5638,7 +5664,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) {
@@ -5985,7 +6016,13 @@ class SsaBuilder extends ast.Visitor
}
void buildLoop() {
- loopHandler.handleLoop(node, () {}, buildCondition, () {}, buildSwitch);
+ loopHandler.handleLoop(
+ node,
+ closureToClassMapper.getClosureRepresentationInfoForLoop(node),
+ () {},
+ buildCondition,
+ () {},
+ buildSwitch);
}
if (hasDefault) {
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart ('k') | pkg/compiler/lib/src/ssa/builder_kernel.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698