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

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

Issue 3007743002: Add boxing for modified variables (Closed)
Patch Set: merged with master 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
« no previous file with comments | « pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart ('k') | tests/compiler/dart2js/closure/closure_test.dart » ('j') | 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 363511b1d4f915fcf257614e8481bead87a3a3cd..a161bdb49897f4041f85ceea00a4c2d1650cbe19 100644
--- a/pkg/compiler/lib/src/ssa/locals_handler.dart
+++ b/pkg/compiler/lib/src/ssa/locals_handler.dart
@@ -11,6 +11,7 @@ import '../io/source_information.dart';
import '../js_backend/native_data.dart';
import '../js_backend/interceptor_data.dart';
import '../js_model/closure.dart' show JRecordField, JClosureField;
+import '../js_model/locals.dart' show JLocal;
import '../tree/tree.dart' as ast;
import '../types/types.dart';
import '../world.dart' show ClosedWorld;
@@ -155,12 +156,17 @@ class LocalsHandler {
directLocals[closureInfo.context] = box;
// 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) {
- LocalVariableElement from = _from;
- BoxFieldElement to = _to;
+ closureInfo.forEachBoxedVariable((Local from, FieldEntity to) {
// The [from] can only be a parameter for function-scopes and not
// loop scopes.
- if (from.isRegularParameter && !forGenerativeConstructorBody) {
+ bool isParameter;
+ if (from is JLocal) {
+ isParameter = from.isRegularParameter;
+ } else if (from is LocalVariableElement) {
+ isParameter = from.isRegularParameter;
+ }
+ assert(isParameter != null);
+ if (isParameter && !forGenerativeConstructorBody) {
// Now that the redirection is set up, the update to the local will
// write the parameter value into the box.
// Store the captured parameter in the box. Get the current value
« no previous file with comments | « pkg/compiler/lib/src/ssa/kernel_ast_adapter.dart ('k') | tests/compiler/dart2js/closure/closure_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698