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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/builder.dart

Issue 54623002: Fix bug in our SSA optimizations: by giving an empty type to a box, we were assuming that anything … (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 2 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: sdk/lib/_internal/compiler/implementation/ssa/builder.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/builder.dart (revision 29654)
+++ sdk/lib/_internal/compiler/implementation/ssa/builder.dart (working copy)
@@ -369,8 +369,12 @@
} else if (isStoredInClosureField(element)) {
Element redirect = redirectionMapping[element];
HInstruction receiver = readLocal(closureData.closureElement);
- HInstruction fieldGet = new HFieldGet(
- redirect, receiver, builder.getTypeOfCapturedVariable(redirect));
+ HType type = (element.kind == ElementKind.VARIABLE_LIST)
+ ? builder.backend.nonNullType
+ : builder.getTypeOfCapturedVariable(redirect);
+ assert(element.kind != ElementKind.VARIABLE_LIST
+ || element is BoxElement);
+ HInstruction fieldGet = new HFieldGet(redirect, receiver, type);
builder.add(fieldGet);
return fieldGet;
} else if (isBoxed(element)) {
@@ -380,7 +384,7 @@
// accessed through a closure-field.
// Calling [readLocal] makes sure we generate the correct code to get
// the box.
- assert(redirect.enclosingElement.isVariable());
+ assert(redirect.enclosingElement is BoxElement);
HInstruction box = readLocal(redirect.enclosingElement);
HInstruction lookup = new HFieldGet(
redirect, box, builder.getTypeOfCapturedVariable(redirect));
@@ -434,7 +438,7 @@
// is captured will be boxed, but the box itself will be a local.
// Inside the closure the box is stored in a closure-field and cannot
// be accessed directly.
- assert(redirect.enclosingElement.isVariable());
+ assert(redirect.enclosingElement is BoxElement);
HInstruction box = readLocal(redirect.enclosingElement);
builder.add(new HFieldSet(redirect, box, value));
} else {

Powered by Google App Engine
This is Rietveld 408576698