| OLD | NEW |
| 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/tasks.dart' show CompilerTask; | 9 import 'common/tasks.dart' show CompilerTask; |
| 10 import 'common/work.dart' show WorkItem; | 10 import 'common/work.dart' show WorkItem; |
| 11 import 'common.dart'; | 11 import 'common.dart'; |
| 12 import 'common_elements.dart' show ElementEnvironment; | 12 import 'common_elements.dart' show ElementEnvironment; |
| 13 import 'constants/values.dart'; | 13 import 'constants/values.dart'; |
| 14 import 'compiler.dart' show Compiler; | 14 import 'compiler.dart' show Compiler; |
| 15 import 'options.dart'; | 15 import 'options.dart'; |
| 16 import 'elements/entities.dart'; | 16 import 'elements/entities.dart'; |
| 17 import 'elements/resolution_types.dart' show ResolutionTypedefType; | 17 import 'elements/resolution_types.dart' show ResolutionTypedefType; |
| 18 import 'elements/types.dart'; | 18 import 'elements/types.dart'; |
| 19 import 'js_backend/enqueuer.dart'; |
| 19 import 'universe/world_builder.dart'; | 20 import 'universe/world_builder.dart'; |
| 20 import 'universe/use.dart' | 21 import 'universe/use.dart' |
| 21 show | 22 show |
| 22 ConstantUse, | 23 ConstantUse, |
| 23 DynamicUse, | 24 DynamicUse, |
| 24 StaticUse, | 25 StaticUse, |
| 25 StaticUseKind, | 26 StaticUseKind, |
| 26 TypeUse, | 27 TypeUse, |
| 27 TypeUseKind; | 28 TypeUseKind; |
| 28 import 'universe/world_impact.dart' | 29 import 'universe/world_impact.dart' |
| 29 show ImpactStrategy, ImpactUseCase, WorldImpact, WorldImpactVisitor; | 30 show ImpactStrategy, ImpactUseCase, WorldImpact, WorldImpactVisitor; |
| 30 import 'util/enumset.dart'; | 31 import 'util/enumset.dart'; |
| 31 import 'util/util.dart' show Setlet; | 32 import 'util/util.dart' show Setlet; |
| 32 import 'world.dart' show ClosedWorld; | 33 import 'world.dart' show ClosedWorld; |
| 33 | 34 |
| 34 class EnqueueTask extends CompilerTask { | 35 class EnqueueTask extends CompilerTask { |
| 35 ResolutionEnqueuer _resolution; | 36 ResolutionEnqueuer _resolution; |
| 37 CodegenEnqueuer codegenEnqueuerForTesting; |
| 36 final Compiler compiler; | 38 final Compiler compiler; |
| 37 | 39 |
| 38 String get name => 'Enqueue'; | 40 String get name => 'Enqueue'; |
| 39 | 41 |
| 40 EnqueueTask(Compiler compiler) | 42 EnqueueTask(Compiler compiler) |
| 41 : this.compiler = compiler, | 43 : this.compiler = compiler, |
| 42 super(compiler.measurer); | 44 super(compiler.measurer); |
| 43 | 45 |
| 44 // TODO(johnniwinther): Remove the need for this. | 46 // TODO(johnniwinther): Remove the need for this. |
| 45 bool get hasResolution => _resolution != null; | 47 bool get hasResolution => _resolution != null; |
| 46 | 48 |
| 47 // TODO(johnniwinther): Remove the need for this. | 49 // TODO(johnniwinther): Remove the need for this. |
| 48 ResolutionEnqueuer get resolution { | 50 ResolutionEnqueuer get resolution { |
| 49 assert(invariant(NO_LOCATION_SPANNABLE, _resolution != null, | 51 assert(invariant(NO_LOCATION_SPANNABLE, _resolution != null, |
| 50 message: "ResolutionEnqueuer has not been created yet.")); | 52 message: "ResolutionEnqueuer has not been created yet.")); |
| 51 return _resolution; | 53 return _resolution; |
| 52 } | 54 } |
| 53 | 55 |
| 54 ResolutionEnqueuer createResolutionEnqueuer() { | 56 ResolutionEnqueuer createResolutionEnqueuer() { |
| 55 return _resolution ??= | 57 return _resolution ??= |
| 56 compiler.backend.createResolutionEnqueuer(this, compiler); | 58 compiler.backend.createResolutionEnqueuer(this, compiler); |
| 57 } | 59 } |
| 58 | 60 |
| 59 Enqueuer createCodegenEnqueuer(ClosedWorld closedWorld) { | 61 Enqueuer createCodegenEnqueuer(ClosedWorld closedWorld) { |
| 60 return compiler.backend.createCodegenEnqueuer(this, compiler, closedWorld); | 62 return codegenEnqueuerForTesting = |
| 63 compiler.backend.createCodegenEnqueuer(this, compiler, closedWorld); |
| 61 } | 64 } |
| 62 } | 65 } |
| 63 | 66 |
| 64 abstract class Enqueuer { | 67 abstract class Enqueuer { |
| 65 WorldBuilder get worldBuilder; | 68 WorldBuilder get worldBuilder; |
| 66 | 69 |
| 67 void open(ImpactStrategy impactStrategy, FunctionEntity mainMethod, | 70 void open(ImpactStrategy impactStrategy, FunctionEntity mainMethod, |
| 68 Iterable<LibraryEntity> libraries); | 71 Iterable<LibraryEntity> libraries); |
| 69 void close(); | 72 void close(); |
| 70 | 73 |
| (...skipping 521 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 592 final Entity element; | 595 final Entity element; |
| 593 final DeferredActionFunction action; | 596 final DeferredActionFunction action; |
| 594 | 597 |
| 595 DeferredAction(this.element, this.action); | 598 DeferredAction(this.element, this.action); |
| 596 } | 599 } |
| 597 | 600 |
| 598 /// Interface for creating work items for enqueued member entities. | 601 /// Interface for creating work items for enqueued member entities. |
| 599 abstract class WorkItemBuilder { | 602 abstract class WorkItemBuilder { |
| 600 WorkItem createWorkItem(MemberEntity entity); | 603 WorkItem createWorkItem(MemberEntity entity); |
| 601 } | 604 } |
| OLD | NEW |