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

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

Issue 2729383002: Prepare for late creation of ResolutionEnqueuer (Closed)
Patch Set: Created 3 years, 9 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
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.enqueue; 5 library dart2js.enqueue;
6 6
7 import 'dart:collection' show Queue; 7 import 'dart:collection' show Queue;
8 8
9 import 'common/resolution.dart' show Resolution; 9 import 'common/resolution.dart' show Resolution;
10 import 'common/tasks.dart' show CompilerTask; 10 import 'common/tasks.dart' show CompilerTask;
(...skipping 17 matching lines...) Expand all
28 28
29 class EnqueueTask extends CompilerTask { 29 class EnqueueTask extends CompilerTask {
30 ResolutionEnqueuer _resolution; 30 ResolutionEnqueuer _resolution;
31 final Compiler compiler; 31 final Compiler compiler;
32 32
33 String get name => 'Enqueue'; 33 String get name => 'Enqueue';
34 34
35 EnqueueTask(Compiler compiler) 35 EnqueueTask(Compiler compiler)
36 : this.compiler = compiler, 36 : this.compiler = compiler,
37 super(compiler.measurer) { 37 super(compiler.measurer) {
38 _resolution = new ResolutionEnqueuer( 38 createResolutionEnqueuer();
39 this,
40 compiler.options,
41 compiler.reporter,
42 compiler.options.analyzeOnly && compiler.options.analyzeMain
43 ? const DirectEnqueuerStrategy()
44 : const TreeShakingEnqueuerStrategy(),
45 compiler.backend.resolutionEnqueuerListener,
46 new ElementResolutionWorldBuilder(
47 compiler.backend, compiler.resolution, const OpenWorldStrategy()),
48 new ResolutionWorkItemBuilder(compiler.resolution));
49 } 39 }
50 40
51 ResolutionEnqueuer get resolution => _resolution; 41 ResolutionEnqueuer get resolution {
42 assert(invariant(NO_LOCATION_SPANNABLE, _resolution != null,
43 message: "ResolutionEnqueuer has not been created yet."));
44 return _resolution;
45 }
46
47 ResolutionEnqueuer createResolutionEnqueuer() {
48 return _resolution ??=
49 compiler.backend.createResolutionEnqueuer(this, compiler);
50 }
52 51
53 Enqueuer createCodegenEnqueuer(ClosedWorld closedWorld) { 52 Enqueuer createCodegenEnqueuer(ClosedWorld closedWorld) {
54 return compiler.backend.createCodegenEnqueuer(this, compiler, closedWorld); 53 return compiler.backend.createCodegenEnqueuer(this, compiler, closedWorld);
55 } 54 }
56 } 55 }
57 56
58 abstract class Enqueuer { 57 abstract class Enqueuer {
59 WorldBuilder get worldBuilder; 58 WorldBuilder get worldBuilder;
60 59
61 void open(ImpactStrategy impactStrategy, FunctionEntity mainMethod, 60 void open(ImpactStrategy impactStrategy, FunctionEntity mainMethod,
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 @override 560 @override
562 WorkItem createWorkItem(MemberElement element) { 561 WorkItem createWorkItem(MemberElement element) {
563 assert(invariant(element, element.isDeclaration)); 562 assert(invariant(element, element.isDeclaration));
564 if (element.isMalformed) return null; 563 if (element.isMalformed) return null;
565 564
566 assert(invariant(element, element is AnalyzableElement, 565 assert(invariant(element, element is AnalyzableElement,
567 message: 'Element $element is not analyzable.')); 566 message: 'Element $element is not analyzable.'));
568 return _resolution.createWorkItem(element); 567 return _resolution.createWorkItem(element);
569 } 568 }
570 } 569 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/compiler.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698