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

Side by Side Diff: pkg/kernel/lib/transformations/closure/context.dart

Issue 3008923002: Improve the performance of closure-converted code. (Closed)
Patch Set: Additional bug fixes. Created 3 years, 3 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 unified diff | Download patch
« no previous file with comments | « no previous file | pkg/kernel/lib/transformations/closure/rewriter.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library kernel.transformations.closure.context; 5 library kernel.transformations.closure.context;
6 6
7 import '../../ast.dart' 7 import '../../ast.dart'
8 show 8 show
9 Expression, 9 Expression,
10 FunctionNode,
10 NullLiteral, 11 NullLiteral,
11 StringLiteral, 12 StringLiteral,
12 Throw, 13 Throw,
13 TreeNode, 14 TreeNode,
14 VariableDeclaration, 15 VariableDeclaration,
15 VariableGet, 16 VariableGet,
16 VariableSet, 17 VariableSet,
17 VectorCreation, 18 VectorCreation,
18 VectorGet, 19 VectorGet,
19 VectorSet, 20 VectorSet,
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 131
131 void extend(VariableDeclaration variable, Expression value) { 132 void extend(VariableDeclaration variable, Expression value) {
132 // Increase index by 2, because the type arguments vector occupies position 133 // Increase index by 2, because the type arguments vector occupies position
133 // 0, the parent occupies position 1, and all other variables are therefore 134 // 0, the parent occupies position 1, and all other variables are therefore
134 // shifted by 2. 135 // shifted by 2.
135 VectorSet initializer = 136 VectorSet initializer =
136 new VectorSet(expression, variables.length + 2, value); 137 new VectorSet(expression, variables.length + 2, value);
137 value.parent = initializer; 138 value.parent = initializer;
138 139
139 converter.rewriter.insertExtendContext(initializer); 140 converter.rewriter.insertExtendContext(initializer);
141 if (variable.parent is FunctionNode) {
142 converter.rewriter.insertZeroOutParameter(variable);
143 }
140 144
141 ++vectorCreation.length; 145 ++vectorCreation.length;
142 variables.add(variable); 146 variables.add(variable);
143 initializers[variable] = initializer; 147 initializers[variable] = initializer;
144 } 148 }
145 149
146 void update(VariableDeclaration variable, Expression value) { 150 void update(VariableDeclaration variable, Expression value) {
147 VectorSet initializer = initializers[variable]; 151 VectorSet initializer = initializers[variable];
148 initializer.value = value; 152 initializer.value = value;
149 value.parent = initializer; 153 value.parent = initializer;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
238 // Item 1 of a context always points to its parent. 242 // Item 1 of a context always points to its parent.
239 context = new VectorGet(context, 1); 243 context = new VectorGet(context, 1);
240 } 244 }
241 throw 'Unbound NestedContext.lookup($variable)'; 245 throw 'Unbound NestedContext.lookup($variable)';
242 } 246 }
243 247
244 Context toNestedContext([Accessor accessor]) { 248 Context toNestedContext([Accessor accessor]) {
245 return new NestedContext(converter, accessor ?? this.accessor, variabless); 249 return new NestedContext(converter, accessor ?? this.accessor, variabless);
246 } 250 }
247 } 251 }
OLDNEW
« no previous file with comments | « no previous file | pkg/kernel/lib/transformations/closure/rewriter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698