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

Side by Side Diff: pkg/compiler/lib/src/closure.dart

Issue 2318593003: Split Universe into ResolutionUniverse and CodegenUniverse (Closed)
Patch Set: Created 4 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
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 closureToClassMapper; 5 library closureToClassMapper;
6 6
7 import 'common/names.dart' show Identifiers; 7 import 'common/names.dart' show Identifiers;
8 import 'common/resolution.dart' show ParsingContext, Resolution; 8 import 'common/resolution.dart' show ParsingContext, Resolution;
9 import 'common/tasks.dart' show CompilerTask; 9 import 'common/tasks.dart' show CompilerTask;
10 import 'common.dart'; 10 import 'common.dart';
11 import 'compiler.dart' show Compiler; 11 import 'compiler.dart' show Compiler;
12 import 'constants/expressions.dart'; 12 import 'constants/expressions.dart';
13 import 'dart_types.dart'; 13 import 'dart_types.dart';
14 import 'elements/elements.dart'; 14 import 'elements/elements.dart';
15 import 'elements/modelx.dart' 15 import 'elements/modelx.dart'
16 show BaseFunctionElementX, ClassElementX, ElementX; 16 show BaseFunctionElementX, ClassElementX, ElementX;
17 import 'elements/visitor.dart' show ElementVisitor; 17 import 'elements/visitor.dart' show ElementVisitor;
18 import 'js_backend/js_backend.dart' show JavaScriptBackend; 18 import 'js_backend/js_backend.dart' show JavaScriptBackend;
19 import 'resolution/tree_elements.dart' show TreeElements; 19 import 'resolution/tree_elements.dart' show TreeElements;
20 import 'tokens/token.dart' show Token; 20 import 'tokens/token.dart' show Token;
21 import 'tree/tree.dart'; 21 import 'tree/tree.dart';
22 import 'universe/universe.dart' show Universe; 22 import 'universe/universe.dart' show CodegenUniverse;
23 import 'util/util.dart'; 23 import 'util/util.dart';
24 24
25 class ClosureTask extends CompilerTask { 25 class ClosureTask extends CompilerTask {
26 Map<Node, ClosureClassMap> closureMappingCache; 26 Map<Node, ClosureClassMap> closureMappingCache;
27 Compiler compiler; 27 Compiler compiler;
28 ClosureTask(Compiler compiler) 28 ClosureTask(Compiler compiler)
29 : closureMappingCache = new Map<Node, ClosureClassMap>(), 29 : closureMappingCache = new Map<Node, ClosureClassMap>(),
30 compiler = compiler, 30 compiler = compiler,
31 super(compiler.measurer); 31 super(compiler.measurer);
32 32
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
510 void forEachBoxedVariable( 510 void forEachBoxedVariable(
511 void f(LocalVariableElement local, BoxFieldElement field)) { 511 void f(LocalVariableElement local, BoxFieldElement field)) {
512 freeVariableMap.forEach((variable, copy) { 512 freeVariableMap.forEach((variable, copy) {
513 if (!isVariableBoxed(variable)) return; 513 if (!isVariableBoxed(variable)) return;
514 f(variable, copy); 514 f(variable, copy);
515 }); 515 });
516 capturingScopes.values.forEach((ClosureScope scope) { 516 capturingScopes.values.forEach((ClosureScope scope) {
517 scope.forEachCapturedVariable(f); 517 scope.forEachCapturedVariable(f);
518 }); 518 });
519 } 519 }
520
521 void removeMyselfFrom(Universe universe) {
522 freeVariableMap.values.forEach((e) {
523 universe.closurizedMembers.remove(e);
524 universe.fieldSetters.remove(e);
525 universe.fieldGetters.remove(e);
526 });
527 }
528 } 520 }
529 521
530 class ClosureTranslator extends Visitor { 522 class ClosureTranslator extends Visitor {
531 final Compiler compiler; 523 final Compiler compiler;
532 final TreeElements elements; 524 final TreeElements elements;
533 int closureFieldCounter = 0; 525 int closureFieldCounter = 0;
534 int boxedFieldCounter = 0; 526 int boxedFieldCounter = 0;
535 bool inTryStatement = false; 527 bool inTryStatement = false;
536 528
537 final Map<Node, ClosureClassMap> closureMappingCache; 529 final Map<Node, ClosureClassMap> closureMappingCache;
(...skipping 653 matching lines...) Expand 10 before | Expand all | Expand 10 after
1191 /// 1183 ///
1192 /// Move the below classes to a JS model eventually. 1184 /// Move the below classes to a JS model eventually.
1193 /// 1185 ///
1194 abstract class JSEntity implements Entity { 1186 abstract class JSEntity implements Entity {
1195 Entity get declaredEntity; 1187 Entity get declaredEntity;
1196 } 1188 }
1197 1189
1198 abstract class PrivatelyNamedJSEntity implements JSEntity { 1190 abstract class PrivatelyNamedJSEntity implements JSEntity {
1199 Entity get rootOfScope; 1191 Entity get rootOfScope;
1200 } 1192 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/common/backend_api.dart » ('j') | pkg/compiler/lib/src/compiler.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698