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

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

Issue 2964113004: Revert "Added for-loop variable tracking and regular closures/initializers captured variable tracki… (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/locals_handler.dart
diff --git a/pkg/compiler/lib/src/ssa/locals_handler.dart b/pkg/compiler/lib/src/ssa/locals_handler.dart
index 62f420add28d141d9d2fe432561241f7a71967d9..6c3bb870d8e88a70c69e9b2b79279e12bae32148 100644
--- a/pkg/compiler/lib/src/ssa/locals_handler.dart
+++ b/pkg/compiler/lib/src/ssa/locals_handler.dart
@@ -178,20 +178,21 @@ class LocalsHandler {
/// Replaces the current box with a new box and copies over the given list
/// of elements from the old box into the new box.
- void updateCaptureBox(Local currentBox, List<Local> toBeCopiedElements) {
+ void updateCaptureBox(LoopClosureScope loopInfo) {
+ Local boxElement = loopInfo.context;
// Create a new box and copy over the values from the old box into the
// new one.
- HInstruction oldBox = readLocal(currentBox);
+ HInstruction oldBox = readLocal(boxElement);
HInstruction newBox = createBox();
- for (Local boxedVariable in toBeCopiedElements) {
- // [readLocal] uses the [currentBox] to find its box. By replacing it
+ loopInfo.forEachBoxedVariable((Local boxedVariable, _) {
+ // [readLocal] uses the [boxElement] to find its box. By replacing it
// behind its back we can still get to the old values.
- updateLocal(currentBox, oldBox);
+ updateLocal(boxElement, oldBox);
HInstruction oldValue = readLocal(boxedVariable);
- updateLocal(currentBox, newBox);
+ updateLocal(boxElement, newBox);
updateLocal(boxedVariable, oldValue);
- }
- updateLocal(currentBox, newBox);
+ });
+ updateLocal(boxElement, newBox);
}
/// Documentation wanted -- johnniwinther
@@ -294,7 +295,7 @@ class LocalsHandler {
bool isAccessedDirectly(Local local) {
assert(local != null);
return !redirectionMapping.containsKey(local) &&
- !scopeInfo.localIsUsedInTryOrSync(local);
+ !scopeInfo.variableIsUsedInTryOrSync(local);
}
bool isStoredInClosureField(Local local) {
@@ -313,7 +314,7 @@ class LocalsHandler {
}
bool _isUsedInTryOrGenerator(Local local) {
- return scopeInfo.localIsUsedInTryOrSync(local);
+ return scopeInfo.variableIsUsedInTryOrSync(local);
}
/// Returns an [HInstruction] for the given element. If the element is
@@ -477,7 +478,7 @@ class LocalsHandler {
/// goto loop-entry;
/// loop-exit:
void startLoop(LoopClosureScope loopInfo) {
- if (loopInfo.hasBoxedLoopVariables) {
+ if (loopInfo.hasBoxedVariables) {
// If there are boxed loop variables then we set up the box and
// redirections already now. This way the initializer can write its
// values into the box.
@@ -512,7 +513,7 @@ class LocalsHandler {
void enterLoopBody(LoopClosureScope loopInfo) {
// If there are no declared boxed loop variables then we did not create the
// box before the initializer and we have to create the box now.
- if (!loopInfo.hasBoxedLoopVariables) {
+ if (!loopInfo.hasBoxedVariables) {
enterScope(loopInfo);
}
}
@@ -523,8 +524,8 @@ class LocalsHandler {
// updates.
// 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);
+ if (loopInfo.hasBoxedVariables) {
+ updateCaptureBox(loopInfo);
}
}
« no previous file with comments | « pkg/compiler/lib/src/kernel/kernel_backend_strategy.dart ('k') | tests/compiler/dart2js/closure/closure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698