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

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

Issue 2924693003: Entity-ify some portions of LocalsHandler and Closure. (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
« pkg/compiler/lib/src/closure.dart ('K') | « pkg/compiler/lib/src/closure.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 dccc72ec378fc3f00e673df830ce5a2b7323f663..e126e3a542e36a36f6e066736139eee6294c8d5a 100644
--- a/pkg/compiler/lib/src/ssa/locals_handler.dart
+++ b/pkg/compiler/lib/src/ssa/locals_handler.dart
@@ -30,8 +30,7 @@ class LocalsHandler {
/// e.g. Element hash codes. I'd prefer to use a SortedMap but some elements
/// don't have source locations for [Elements.compareByPosition].
Map<Local, HInstruction> directLocals = new Map<Local, HInstruction>();
- Map<Local, CapturedVariable> redirectionMapping =
- new Map<Local, CapturedVariable>();
+ Map<Local, FieldEntity> redirectionMapping = new Map<Local, FieldEntity>();
final GraphBuilder builder;
ClosureClassMap closureData;
Map<TypeVariableType, TypeVariableLocal> typeVariableLocals =
@@ -125,7 +124,7 @@ class LocalsHandler {
/// Redirects accesses from element [from] to element [to]. The [to] element
/// must be a boxed variable or a variable that is stored in a closure-field.
- void redirectElement(Local from, CapturedVariable to) {
+ void redirectElement(Local from, FieldEntity to) {
assert(redirectionMapping[from] == null);
redirectionMapping[from] = to;
assert(isStoredInClosureField(from) || isBoxed(from));
@@ -180,13 +179,12 @@ 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(
- BoxLocal boxElement, List<LocalVariableElement> toBeCopiedElements) {
+ void updateCaptureBox(Local boxElement, List<Local> toBeCopiedElements) {
// Create a new box and copy over the values from the old box into the
// new one.
HInstruction oldBox = readLocal(boxElement);
HInstruction newBox = createBox();
- for (LocalVariableElement boxedVariable in toBeCopiedElements) {
+ for (Local boxedVariable in toBeCopiedElements) {
// [readLocal] uses the [boxElement] to find its box. By replacing it
// behind its back we can still get to the old values.
updateLocal(boxElement, oldBox);
@@ -233,7 +231,7 @@ class LocalsHandler {
// If the freeVariableMapping is not empty, then this function was a
// nested closure that captures variables. Redirect the captured
// variables to fields in the closure.
- closureData.forEachFreeVariable((Local from, CapturedVariable to) {
+ closureData.forEachFreeVariable((Local from, FieldEntity to) {
redirectElement(from, to);
});
if (closureData.isClosure) {
@@ -306,7 +304,7 @@ class LocalsHandler {
bool isStoredInClosureField(Local local) {
assert(local != null);
if (isAccessedDirectly(local)) return false;
- CapturedVariable redirectTarget = redirectionMapping[local];
+ FieldEntity redirectTarget = redirectionMapping[local];
if (redirectTarget == null) return false;
return redirectTarget is ClosureFieldElement;
}
« pkg/compiler/lib/src/closure.dart ('K') | « pkg/compiler/lib/src/closure.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698