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

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

Issue 2488353004: Remove Compiler access from ResolutionEnqueuer (Closed)
Patch Set: Updated cf. comments. Created 4 years, 1 month 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 types; 5 library types;
6 6
7 import '../common/tasks.dart' show CompilerTask; 7 import '../common/tasks.dart' show CompilerTask;
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../inferrer/type_graph_inferrer.dart' show TypeGraphInferrer; 10 import '../inferrer/type_graph_inferrer.dart' show TypeGraphInferrer;
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 TypeMask typeOfIteratorCurrent(ForIn node, elements) => 121 TypeMask typeOfIteratorCurrent(ForIn node, elements) =>
122 elements.getCurrentTypeMask(node); 122 elements.getCurrentTypeMask(node);
123 } 123 }
124 124
125 /// Global analysis that infers concrete types. 125 /// Global analysis that infers concrete types.
126 class GlobalTypeInferenceTask extends CompilerTask { 126 class GlobalTypeInferenceTask extends CompilerTask {
127 // TODO(sigmund): rename at the same time as our benchmarking tools. 127 // TODO(sigmund): rename at the same time as our benchmarking tools.
128 final String name = 'Type inference'; 128 final String name = 'Type inference';
129 129
130 final Compiler compiler; 130 final Compiler compiler;
131 TypesInferrer typesInferrer; 131
132 CommonMasks masks; 132 /// The [TypeInferrer] used by the global type inference. This should by
133 /// accessed from outside this class for testing only.
134 TypesInferrer typesInferrerInternal;
135
133 GlobalTypeInferenceResults results; 136 GlobalTypeInferenceResults results;
134 137
135 GlobalTypeInferenceTask(Compiler compiler) 138 GlobalTypeInferenceTask(Compiler compiler)
136 : masks = new CommonMasks(compiler), 139 : compiler = compiler,
137 compiler = compiler, 140 super(compiler.measurer);
138 super(compiler.measurer) {
139 typesInferrer = new TypeGraphInferrer(compiler, masks);
140 }
141 141
142 /// Runs the global type-inference algorithm once. 142 /// Runs the global type-inference algorithm once.
143 void runGlobalTypeInference(Element mainElement) { 143 void runGlobalTypeInference(Element mainElement) {
144 measure(() { 144 measure(() {
145 typesInferrer.analyzeMain(mainElement); 145 CommonMasks masks = compiler.closedWorld.commonMasks;
146 typesInferrer.clear(); 146 typesInferrerInternal ??= new TypeGraphInferrer(compiler, masks);
147 results = new GlobalTypeInferenceResults(typesInferrer, compiler, masks); 147 typesInferrerInternal.analyzeMain(mainElement);
148 typesInferrerInternal.clear();
149 results = new GlobalTypeInferenceResults(
150 typesInferrerInternal, compiler, masks);
148 }); 151 });
149 } 152 }
150 } 153 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/types/type_mask.dart ('k') | pkg/compiler/lib/src/types/union_type_mask.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698