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

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

Issue 2995353002: Test the CapturedScope for local functions (Closed)
Patch Set: Created 3 years, 4 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/locals_handler.dart
diff --git a/pkg/compiler/lib/src/ssa/locals_handler.dart b/pkg/compiler/lib/src/ssa/locals_handler.dart
index d75549764b314e63f7e0e868a3035dcd6211d2e6..5e0266b75c2b957f73e8e08fdadf53e097a66a25 100644
--- a/pkg/compiler/lib/src/ssa/locals_handler.dart
+++ b/pkg/compiler/lib/src/ssa/locals_handler.dart
@@ -130,7 +130,7 @@ class LocalsHandler {
assert(isStoredInClosureField(from) || isBoxed(from));
}
- HInstruction createBox() {
+ HInstruction createBoxObject() {
HInstruction box = new HCreateBox(commonMasks.nonNullType);
builder.add(box);
return box;
@@ -142,18 +142,19 @@ class LocalsHandler {
{bool forGenerativeConstructorBody: false}) {
// See if any variable in the top-scope of the function is captured. If yes
// we need to create a box-object.
- if (!closureInfo.requiresContextBox) return;
- HInstruction box;
+ if (!closureInfo.hasBox) return;
+ HInstruction boxObject;
// The scope has captured variables.
if (forGenerativeConstructorBody) {
// The box is passed as a parameter to a generative
// constructor body.
- box = builder.addParameter(closureInfo.context, commonMasks.nonNullType);
+ boxObject =
+ builder.addParameter(closureInfo.box, commonMasks.nonNullType);
} else {
- box = createBox();
+ boxObject = createBoxObject();
}
// Add the box to the known locals.
- directLocals[closureInfo.context] = box;
+ directLocals[closureInfo.box] = boxObject;
// Make sure that accesses to the boxed locals go into the box. We also
// need to make sure that parameters are copied into the box if necessary.
closureInfo.forEachBoxedVariable((_from, _to) {
@@ -190,7 +191,7 @@ class LocalsHandler {
// Create a new box and copy over the values from the old box into the
// new one.
HInstruction oldBox = readLocal(currentBox);
- HInstruction newBox = createBox();
+ HInstruction newBox = createBoxObject();
for (Local boxedVariable in toBeCopiedElements) {
// [readLocal] uses the [currentBox] to find its box. By replacing it
// behind its back we can still get to the old values.
@@ -551,7 +552,7 @@ class LocalsHandler {
// In all other cases a new box will be created when entering the body of
// the next iteration.
if (loopInfo.hasBoxedLoopVariables) {
- updateCaptureBox(loopInfo.context, loopInfo.boxedLoopVariables);
+ updateCaptureBox(loopInfo.box, loopInfo.boxedLoopVariables);
}
}

Powered by Google App Engine
This is Rietveld 408576698