| 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.js.enqueue; | 5 library dart2js.js.enqueue; |
| 6 | 6 |
| 7 import 'dart:collection' show Queue; | 7 import 'dart:collection' show Queue; |
| 8 | 8 |
| 9 import '../common/backend_api.dart' show Backend; | 9 import '../common/backend_api.dart' show Backend; |
| 10 import '../common/codegen.dart' show CodegenWorkItem; | 10 import '../common/codegen.dart' show CodegenWorkItem; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 27 MemberElement, | 27 MemberElement, |
| 28 Name, | 28 Name, |
| 29 TypedElement, | 29 TypedElement, |
| 30 TypedefElement; | 30 TypedefElement; |
| 31 import '../enqueue.dart'; | 31 import '../enqueue.dart'; |
| 32 import '../js/js.dart' as js; | 32 import '../js/js.dart' as js; |
| 33 import '../native/native.dart' as native; | 33 import '../native/native.dart' as native; |
| 34 import '../options.dart'; | 34 import '../options.dart'; |
| 35 import '../types/types.dart' show TypeMaskStrategy; | 35 import '../types/types.dart' show TypeMaskStrategy; |
| 36 import '../universe/selector.dart' show Selector; | 36 import '../universe/selector.dart' show Selector; |
| 37 import '../universe/universe.dart'; | 37 import '../universe/world_builder.dart'; |
| 38 import '../universe/use.dart' | 38 import '../universe/use.dart' |
| 39 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind; | 39 show DynamicUse, StaticUse, StaticUseKind, TypeUse, TypeUseKind; |
| 40 import '../universe/world_impact.dart' | 40 import '../universe/world_impact.dart' |
| 41 show ImpactUseCase, WorldImpact, WorldImpactVisitor; | 41 show ImpactUseCase, WorldImpact, WorldImpactVisitor; |
| 42 import '../util/util.dart' show Setlet; | 42 import '../util/util.dart' show Setlet; |
| 43 import '../world.dart'; | 43 import '../world.dart'; |
| 44 | 44 |
| 45 /// [Enqueuer] which is specific to code generation. | 45 /// [Enqueuer] which is specific to code generation. |
| 46 class CodegenEnqueuer implements Enqueuer { | 46 class CodegenEnqueuer implements Enqueuer { |
| 47 final String name; | 47 final String name; |
| 48 @deprecated | 48 @deprecated |
| 49 final Compiler _compiler; // TODO(ahe): Remove this dependency. | 49 final Compiler _compiler; // TODO(ahe): Remove this dependency. |
| 50 final EnqueuerStrategy strategy; | 50 final EnqueuerStrategy strategy; |
| 51 final Map<String, Set<Element>> instanceMembersByName = | 51 final Map<String, Set<Element>> instanceMembersByName = |
| 52 new Map<String, Set<Element>>(); | 52 new Map<String, Set<Element>>(); |
| 53 final Map<String, Set<Element>> instanceFunctionsByName = | 53 final Map<String, Set<Element>> instanceFunctionsByName = |
| 54 new Map<String, Set<Element>>(); | 54 new Map<String, Set<Element>>(); |
| 55 final Set<ClassElement> _processedClasses = new Set<ClassElement>(); | 55 final Set<ClassElement> _processedClasses = new Set<ClassElement>(); |
| 56 Set<ClassElement> recentClasses = new Setlet<ClassElement>(); | 56 Set<ClassElement> recentClasses = new Setlet<ClassElement>(); |
| 57 final CodegenUniverseImpl _universe = | 57 final CodegenWorldBuilderImpl _universe = |
| 58 new CodegenUniverseImpl(const TypeMaskStrategy()); | 58 new CodegenWorldBuilderImpl(const TypeMaskStrategy()); |
| 59 | 59 |
| 60 static final TRACE_MIRROR_ENQUEUING = | 60 static final TRACE_MIRROR_ENQUEUING = |
| 61 const bool.fromEnvironment("TRACE_MIRROR_ENQUEUING"); | 61 const bool.fromEnvironment("TRACE_MIRROR_ENQUEUING"); |
| 62 | 62 |
| 63 bool queueIsClosed = false; | 63 bool queueIsClosed = false; |
| 64 EnqueueTask task; | 64 EnqueueTask task; |
| 65 native.NativeEnqueuer nativeEnqueuer; // Set by EnqueueTask | 65 native.NativeEnqueuer nativeEnqueuer; // Set by EnqueueTask |
| 66 | 66 |
| 67 bool hasEnqueuedReflectiveElements = false; | 67 bool hasEnqueuedReflectiveElements = false; |
| 68 bool hasEnqueuedReflectiveStaticFields = false; | 68 bool hasEnqueuedReflectiveStaticFields = false; |
| 69 | 69 |
| 70 WorldImpactVisitor impactVisitor; | 70 WorldImpactVisitor impactVisitor; |
| 71 | 71 |
| 72 CodegenEnqueuer(Compiler compiler, this.strategy) | 72 CodegenEnqueuer(Compiler compiler, this.strategy) |
| 73 : queue = new Queue<CodegenWorkItem>(), | 73 : queue = new Queue<CodegenWorkItem>(), |
| 74 newlyEnqueuedElements = compiler.cacheStrategy.newSet(), | 74 newlyEnqueuedElements = compiler.cacheStrategy.newSet(), |
| 75 newlySeenSelectors = compiler.cacheStrategy.newSet(), | 75 newlySeenSelectors = compiler.cacheStrategy.newSet(), |
| 76 this.name = 'codegen enqueuer', | 76 this.name = 'codegen enqueuer', |
| 77 this._compiler = compiler { | 77 this._compiler = compiler { |
| 78 impactVisitor = new _EnqueuerImpactVisitor(this); | 78 impactVisitor = new _EnqueuerImpactVisitor(this); |
| 79 } | 79 } |
| 80 | 80 |
| 81 CodegenUniverse get universe => _universe; | 81 CodegenWorldBuilder get universe => _universe; |
| 82 | 82 |
| 83 Backend get backend => _compiler.backend; | 83 Backend get backend => _compiler.backend; |
| 84 | 84 |
| 85 CompilerOptions get options => _compiler.options; | 85 CompilerOptions get options => _compiler.options; |
| 86 | 86 |
| 87 Registry get globalDependencies => _compiler.globalDependencies; | 87 Registry get globalDependencies => _compiler.globalDependencies; |
| 88 | 88 |
| 89 Registry get mirrorDependencies => _compiler.mirrorDependencies; | 89 Registry get mirrorDependencies => _compiler.mirrorDependencies; |
| 90 | 90 |
| 91 ClosedWorld get _world => _compiler.closedWorld; | 91 ClosedWorld get _world => _compiler.closedWorld; |
| (...skipping 607 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 699 @override | 699 @override |
| 700 void visitStaticUse(StaticUse staticUse) { | 700 void visitStaticUse(StaticUse staticUse) { |
| 701 enqueuer.registerStaticUse(staticUse); | 701 enqueuer.registerStaticUse(staticUse); |
| 702 } | 702 } |
| 703 | 703 |
| 704 @override | 704 @override |
| 705 void visitTypeUse(TypeUse typeUse) { | 705 void visitTypeUse(TypeUse typeUse) { |
| 706 enqueuer.registerTypeUse(typeUse); | 706 enqueuer.registerTypeUse(typeUse); |
| 707 } | 707 } |
| 708 } | 708 } |
| OLD | NEW |