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 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 } | 127 } |
128 queue.add(new CodegenWorkItem(_compiler, element)); | 128 queue.add(new CodegenWorkItem(_compiler, element)); |
129 if (options.dumpInfo) { | 129 if (options.dumpInfo) { |
130 // TODO(sigmund): add other missing dependencies (internals, selectors | 130 // TODO(sigmund): add other missing dependencies (internals, selectors |
131 // enqueued after allocations), also enable only for the codegen enqueuer. | 131 // enqueued after allocations), also enable only for the codegen enqueuer. |
132 _compiler.dumpInfoTask | 132 _compiler.dumpInfoTask |
133 .registerDependency(_compiler.currentElement, element); | 133 .registerDependency(_compiler.currentElement, element); |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 /// Apply the [worldImpact] of processing [element] to this enqueuer. | 137 void applyImpact(WorldImpact worldImpact, {Element impactSource}) { |
138 void applyImpact(Element element, WorldImpact worldImpact) { | |
139 _compiler.impactStrategy | 138 _compiler.impactStrategy |
140 .visitImpact(element, worldImpact, impactVisitor, impactUse); | 139 .visitImpact(impactSource, worldImpact, impactVisitor, impactUse); |
141 } | 140 } |
142 | 141 |
143 void registerInstantiatedType(InterfaceType type, {bool mirrorUsage: false}) { | 142 void registerInstantiatedType(InterfaceType type, {bool mirrorUsage: false}) { |
144 task.measure(() { | 143 task.measure(() { |
145 ClassElement cls = type.element; | 144 ClassElement cls = type.element; |
146 bool isNative = backend.isNative(cls); | 145 bool isNative = backend.isNative(cls); |
147 _universe.registerTypeInstantiation(type, | 146 _universe.registerTypeInstantiation(type, |
148 isNative: isNative, | 147 isNative: isNative, |
149 byMirrors: mirrorUsage, onImplemented: (ClassElement cls) { | 148 byMirrors: mirrorUsage, onImplemented: (ClassElement cls) { |
150 backend.registerImplementedClass(cls, this, globalDependencies); | 149 backend.registerImplementedClass(cls, this, globalDependencies); |
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
506 */ | 505 */ |
507 void registerStaticUse(StaticUse staticUse) { | 506 void registerStaticUse(StaticUse staticUse) { |
508 strategy.processStaticUse(this, staticUse); | 507 strategy.processStaticUse(this, staticUse); |
509 } | 508 } |
510 | 509 |
511 void registerStaticUseInternal(StaticUse staticUse) { | 510 void registerStaticUseInternal(StaticUse staticUse) { |
512 Element element = staticUse.element; | 511 Element element = staticUse.element; |
513 assert(invariant(element, element.isDeclaration, | 512 assert(invariant(element, element.isDeclaration, |
514 message: "Element ${element} is not the declaration.")); | 513 message: "Element ${element} is not the declaration.")); |
515 _universe.registerStaticUse(staticUse); | 514 _universe.registerStaticUse(staticUse); |
516 backend.registerStaticUse(element, this); | 515 backend.registerStaticUse(element, forResolution: false); |
517 bool addElement = true; | 516 bool addElement = true; |
518 switch (staticUse.kind) { | 517 switch (staticUse.kind) { |
519 case StaticUseKind.STATIC_TEAR_OFF: | 518 case StaticUseKind.STATIC_TEAR_OFF: |
520 backend.registerGetOfStaticFunction(this); | 519 backend.registerGetOfStaticFunction(this); |
521 break; | 520 break; |
522 case StaticUseKind.FIELD_GET: | 521 case StaticUseKind.FIELD_GET: |
523 case StaticUseKind.FIELD_SET: | 522 case StaticUseKind.FIELD_SET: |
524 case StaticUseKind.CLOSURE: | 523 case StaticUseKind.CLOSURE: |
525 // TODO(johnniwinther): Avoid this. Currently [FIELD_GET] and | 524 // TODO(johnniwinther): Avoid this. Currently [FIELD_GET] and |
526 // [FIELD_SET] contains [BoxFieldElement]s which we cannot enqueue. | 525 // [FIELD_SET] contains [BoxFieldElement]s which we cannot enqueue. |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
700 @override | 699 @override |
701 void visitStaticUse(StaticUse staticUse) { | 700 void visitStaticUse(StaticUse staticUse) { |
702 enqueuer.registerStaticUse(staticUse); | 701 enqueuer.registerStaticUse(staticUse); |
703 } | 702 } |
704 | 703 |
705 @override | 704 @override |
706 void visitTypeUse(TypeUse typeUse) { | 705 void visitTypeUse(TypeUse typeUse) { |
707 enqueuer.registerTypeUse(typeUse); | 706 enqueuer.registerTypeUse(typeUse); |
708 } | 707 } |
709 } | 708 } |
OLD | NEW |