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

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

Issue 1892093003: Support deserialized compilation of the empty program. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Updated cf. comments Created 4 years, 8 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 '../closure.dart' show SynthesizedCallMethodElementX;
7 import '../common.dart'; 8 import '../common.dart';
8 import '../compiler.dart' show Compiler; 9 import '../compiler.dart' show Compiler;
9 import '../constants/values.dart' show ConstantValue; 10 import '../constants/values.dart' show ConstantValue;
10 import '../dart_types.dart' show DartType, InterfaceType; 11 import '../dart_types.dart' show DartType, InterfaceType;
11 import '../elements/elements.dart' 12 import '../elements/elements.dart'
12 show 13 show
13 AstElement, 14 AstElement,
14 ClassElement, 15 ClassElement,
15 Element, 16 Element,
16 FunctionElement, 17 FunctionElement,
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
218 } 219 }
219 220
220 void registerAsyncMarker(FunctionElement element) { 221 void registerAsyncMarker(FunctionElement element) {
221 worldImpact.registerAsyncMarker(element); 222 worldImpact.registerAsyncMarker(element);
222 } 223 }
223 } 224 }
224 225
225 /// [WorkItem] used exclusively by the [CodegenEnqueuer]. 226 /// [WorkItem] used exclusively by the [CodegenEnqueuer].
226 class CodegenWorkItem extends WorkItem { 227 class CodegenWorkItem extends WorkItem {
227 CodegenRegistry registry; 228 CodegenRegistry registry;
229 final ResolvedAst resolvedAst;
228 230
229 factory CodegenWorkItem(Compiler compiler, AstElement element, 231 factory CodegenWorkItem(Compiler compiler, AstElement element,
230 ItemCompilationContext compilationContext) { 232 ItemCompilationContext compilationContext) {
231 // If this assertion fails, the resolution callbacks of the backend may be 233 // If this assertion fails, the resolution callbacks of the backend may be
232 // missing call of form registry.registerXXX. Alternatively, the code 234 // missing call of form registry.registerXXX. Alternatively, the code
233 // generation could spuriously be adding dependencies on things we know we 235 // generation could spuriously be adding dependencies on things we know we
234 // don't need. 236 // don't need.
235 assert(invariant( 237 assert(invariant(
236 element, compiler.enqueuer.resolution.hasBeenProcessed(element), 238 element, compiler.enqueuer.resolution.hasBeenProcessed(element),
237 message: "$element has not been resolved.")); 239 message: "$element has not been resolved."));
238 assert(invariant(element, element.hasResolvedAst, 240 ResolvedAst resolvedAst = compiler.backend.frontend.getResolvedAst(element);
239 message: 'Resolution tree is null for $element in codegen work item')); 241 return new CodegenWorkItem.internal(resolvedAst, compilationContext);
240 return new CodegenWorkItem.internal(element, compilationContext);
241 } 242 }
242 243
243 CodegenWorkItem.internal( 244 CodegenWorkItem.internal(
244 AstElement element, ItemCompilationContext compilationContext) 245 ResolvedAst resolvedAst, ItemCompilationContext compilationContext)
245 : super(element, compilationContext); 246 : this.resolvedAst = resolvedAst,
246 247 super(resolvedAst.element, compilationContext);
247 ResolvedAst get resolvedAst => element.resolvedAst;
248 248
249 WorldImpact run(Compiler compiler, CodegenEnqueuer world) { 249 WorldImpact run(Compiler compiler, CodegenEnqueuer world) {
250 if (world.isProcessed(element)) return const WorldImpact(); 250 if (world.isProcessed(element)) return const WorldImpact();
251 251
252 registry = new CodegenRegistry(compiler, element); 252 registry = new CodegenRegistry(compiler, element);
253 return compiler.codegen(this, world); 253 return compiler.codegen(this, world);
254 } 254 }
255 } 255 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698