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

Side by Side Diff: pkg/compiler/lib/src/ssa/locals_handler.dart

Issue 2387353002: Eagerly compute closure classes (Closed)
Patch Set: Add comments. Created 4 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 unified diff | Download patch
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 import '../closure.dart'; 5 import '../closure.dart';
6 import '../common.dart'; 6 import '../common.dart';
7 import '../compiler.dart' show Compiler; 7 import '../compiler.dart' show Compiler;
8 import '../dart_types.dart'; 8 import '../dart_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../io/source_information.dart'; 10 import '../io/source_information.dart';
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 } 179 }
180 updateLocal(boxElement, newBox); 180 updateLocal(boxElement, newBox);
181 } 181 }
182 182
183 /// Documentation wanted -- johnniwinther 183 /// Documentation wanted -- johnniwinther
184 /// 184 ///
185 /// Invariant: [function] must be an implementation element. 185 /// Invariant: [function] must be an implementation element.
186 void startFunction(AstElement element, ast.Node node) { 186 void startFunction(AstElement element, ast.Node node) {
187 assert(invariant(element, element.isImplementation)); 187 assert(invariant(element, element.isImplementation));
188 closureData = _compiler.closureToClassMapper 188 closureData = _compiler.closureToClassMapper
189 .computeClosureToClassMapping(element.resolvedAst); 189 .getClosureToClassMapping(element.resolvedAst);
190 190
191 if (element is FunctionElement) { 191 if (element is FunctionElement) {
192 FunctionElement functionElement = element; 192 FunctionElement functionElement = element;
193 FunctionSignature params = functionElement.functionSignature; 193 FunctionSignature params = functionElement.functionSignature;
194 ClosureScope scopeData = closureData.capturingScopes[node]; 194 ClosureScope scopeData = closureData.capturingScopes[node];
195 params.orderedForEachParameter((ParameterElement parameterElement) { 195 params.orderedForEachParameter((ParameterElement parameterElement) {
196 if (element.isGenerativeConstructorBody) { 196 if (element.isGenerativeConstructorBody) {
197 if (scopeData != null && 197 if (scopeData != null &&
198 scopeData.isCapturedVariable(parameterElement)) { 198 scopeData.isCapturedVariable(parameterElement)) {
199 // The parameter will be a field in the box passed as the 199 // The parameter will be a field in the box passed as the
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after
667 final ExecutableElement executableContext; 667 final ExecutableElement executableContext;
668 668
669 // Avoid slow Object.hashCode. 669 // Avoid slow Object.hashCode.
670 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30); 670 final int hashCode = _nextHashCode = (_nextHashCode + 1).toUnsigned(30);
671 static int _nextHashCode = 0; 671 static int _nextHashCode = 0;
672 672
673 SyntheticLocal(this.name, this.executableContext); 673 SyntheticLocal(this.name, this.executableContext);
674 674
675 toString() => 'SyntheticLocal($name)'; 675 toString() => 'SyntheticLocal($name)';
676 } 676 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/ssa/builder.dart ('k') | tests/compiler/dart2js/serialization/model_test_helper.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698