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

Side by Side Diff: pkg/compiler/lib/src/common/codegen.dart

Issue 2302363003: No longer store the compilation-context in WorkItem. (Closed)
Patch Set: ... lint 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 dart2js.common.codegen; 5 library dart2js.common.codegen;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../constants/values.dart' show ConstantValue; 9 import '../constants/values.dart' show ConstantValue;
10 import '../dart_types.dart' show DartType, InterfaceType; 10 import '../dart_types.dart' show DartType, InterfaceType;
11 import '../elements/elements.dart' 11 import '../elements/elements.dart'
12 show 12 show
13 AstElement, 13 AstElement,
14 ClassElement, 14 ClassElement,
15 Element, 15 Element,
16 FunctionElement, 16 FunctionElement,
17 LocalFunctionElement, 17 LocalFunctionElement,
18 ResolvedAst; 18 ResolvedAst;
19 import '../enqueue.dart' show Enqueuer; 19 import '../enqueue.dart' show Enqueuer;
20 import '../universe/use.dart' show DynamicUse, StaticUse, TypeUse; 20 import '../universe/use.dart' show DynamicUse, StaticUse, TypeUse;
21 import '../universe/world_impact.dart' 21 import '../universe/world_impact.dart'
22 show WorldImpact, WorldImpactBuilder, WorldImpactVisitor; 22 show WorldImpact, WorldImpactBuilder, WorldImpactVisitor;
23 import '../util/util.dart' show Pair, Setlet; 23 import '../util/util.dart' show Pair, Setlet;
24 import 'registry.dart' show Registry, EagerRegistry; 24 import 'registry.dart' show Registry, EagerRegistry;
25 import 'work.dart' show ItemCompilationContext, WorkItem; 25 import 'work.dart' show WorkItem;
26 26
27 class CodegenImpact extends WorldImpact { 27 class CodegenImpact extends WorldImpact {
28 const CodegenImpact(); 28 const CodegenImpact();
29 29
30 // TODO(johnniwinther): Remove this. 30 // TODO(johnniwinther): Remove this.
31 Registry get registry => null; 31 Registry get registry => null;
32 32
33 Iterable<ConstantValue> get compileTimeConstants => const <ConstantValue>[]; 33 Iterable<ConstantValue> get compileTimeConstants => const <ConstantValue>[];
34 34
35 Iterable<Pair<DartType, DartType>> get typeVariableBoundsSubtypeChecks { 35 Iterable<Pair<DartType, DartType>> get typeVariableBoundsSubtypeChecks {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
220 void registerAsyncMarker(FunctionElement element) { 220 void registerAsyncMarker(FunctionElement element) {
221 worldImpact.registerAsyncMarker(element); 221 worldImpact.registerAsyncMarker(element);
222 } 222 }
223 } 223 }
224 224
225 /// [WorkItem] used exclusively by the [CodegenEnqueuer]. 225 /// [WorkItem] used exclusively by the [CodegenEnqueuer].
226 class CodegenWorkItem extends WorkItem { 226 class CodegenWorkItem extends WorkItem {
227 CodegenRegistry registry; 227 CodegenRegistry registry;
228 final ResolvedAst resolvedAst; 228 final ResolvedAst resolvedAst;
229 229
230 factory CodegenWorkItem(Compiler compiler, AstElement element, 230 factory CodegenWorkItem(Compiler compiler, AstElement element) {
231 ItemCompilationContext compilationContext) {
232 // If this assertion fails, the resolution callbacks of the backend may be 231 // If this assertion fails, the resolution callbacks of the backend may be
233 // missing call of form registry.registerXXX. Alternatively, the code 232 // missing call of form registry.registerXXX. Alternatively, the code
234 // generation could spuriously be adding dependencies on things we know we 233 // generation could spuriously be adding dependencies on things we know we
235 // don't need. 234 // don't need.
236 assert(invariant(element, element.hasResolvedAst, 235 assert(invariant(element, element.hasResolvedAst,
237 message: "$element has no resolved ast.")); 236 message: "$element has no resolved ast."));
238 ResolvedAst resolvedAst = element.resolvedAst; 237 ResolvedAst resolvedAst = element.resolvedAst;
239 return new CodegenWorkItem.internal(resolvedAst, compilationContext); 238 return new CodegenWorkItem.internal(resolvedAst);
240 } 239 }
241 240
242 CodegenWorkItem.internal( 241 CodegenWorkItem.internal(ResolvedAst resolvedAst)
243 ResolvedAst resolvedAst, ItemCompilationContext compilationContext)
244 : this.resolvedAst = resolvedAst, 242 : this.resolvedAst = resolvedAst,
245 super(resolvedAst.element, compilationContext); 243 super(resolvedAst.element);
246 244
247 WorldImpact run(Compiler compiler, Enqueuer world) { 245 WorldImpact run(Compiler compiler, Enqueuer world) {
248 if (world.isProcessed(element)) return const WorldImpact(); 246 if (world.isProcessed(element)) return const WorldImpact();
249 247
250 registry = new CodegenRegistry(compiler, element); 248 registry = new CodegenRegistry(compiler, element);
251 return compiler.codegen(this, world); 249 return compiler.codegen(this, world);
252 } 250 }
253 251
254 String toString() => 'CodegenWorkItem(${resolvedAst.element})'; 252 String toString() => 'CodegenWorkItem(${resolvedAst.element})';
255 } 253 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/common/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698