Chromium Code Reviews| 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/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 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 106 | 106 |
| 107 /// Called to notify to the backend that a class is implemented by an | 107 /// Called to notify to the backend that a class is implemented by an |
| 108 /// instantiated class. Any backend specific [WorldImpact] of this is | 108 /// instantiated class. Any backend specific [WorldImpact] of this is |
| 109 /// returned. | 109 /// returned. |
| 110 WorldImpact registerImplementedClass(ClassEntity cls); | 110 WorldImpact registerImplementedClass(ClassEntity cls); |
| 111 | 111 |
| 112 /// Called to register that a static function has been closurized. Any backend | 112 /// Called to register that a static function has been closurized. Any backend |
| 113 /// specific [WorldImpact] of this is returned. | 113 /// specific [WorldImpact] of this is returned. |
| 114 WorldImpact registerGetOfStaticFunction(); | 114 WorldImpact registerGetOfStaticFunction(); |
| 115 | 115 |
| 116 /// Called to instruct the backend to register that a closure exists for a | |
| 117 /// function on an instantiated generic class. Any backend specific | |
| 118 /// [WorldImpact] of this is returned. | |
| 119 WorldImpact registerClosureWithFreeTypeVariables(MemberEntity member); | |
| 120 | |
| 121 /// Called to register that a member has been closurized. Any backend specific | 116 /// Called to register that a member has been closurized. Any backend specific |
|
Siggi Cherem (dart-lang)
2017/03/14 03:02:34
a member => [member]
Johnni Winther
2017/03/14 16:59:46
Done.
| |
| 122 /// [WorldImpact] of this is returned. | 117 /// [WorldImpact] of this is returned. |
| 123 WorldImpact registerBoundClosure(); | 118 WorldImpact registerClosurizedMember(MemberEntity member); |
| 124 | 119 |
| 125 /// Called to register that [element] is statically known to be used. Any | 120 /// Called to register that [element] is statically known to be used. Any |
| 126 /// backend specific [WorldImpact] of this is returned. | 121 /// backend specific [WorldImpact] of this is returned. |
| 127 WorldImpact registerUsedElement(MemberEntity member); | 122 WorldImpact registerUsedElement(MemberEntity member); |
| 128 | 123 |
| 129 void onQueueOpen(Enqueuer enqueuer, FunctionEntity mainMethod, | 124 void onQueueOpen(Enqueuer enqueuer, FunctionEntity mainMethod, |
| 130 Iterable<LibraryEntity> libraries); | 125 Iterable<LibraryEntity> libraries); |
| 131 | 126 |
| 132 /// Called when [enqueuer]'s queue is empty, but before it is closed. | 127 /// Called when [enqueuer]'s queue is empty, but before it is closed. |
| 133 /// | 128 /// |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 361 void _registerIsCheck(ResolutionDartType type) { | 356 void _registerIsCheck(ResolutionDartType type) { |
| 362 type = _worldBuilder.registerIsCheck(type); | 357 type = _worldBuilder.registerIsCheck(type); |
| 363 // Even in checked mode, type annotations for return type and argument | 358 // Even in checked mode, type annotations for return type and argument |
| 364 // types do not imply type checks, so there should never be a check | 359 // types do not imply type checks, so there should never be a check |
| 365 // against the type variable of a typedef. | 360 // against the type variable of a typedef. |
| 366 assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef); | 361 assert(!type.isTypeVariable || !type.element.enclosingElement.isTypedef); |
| 367 } | 362 } |
| 368 | 363 |
| 369 void _registerClosurizedMember(MemberElement element) { | 364 void _registerClosurizedMember(MemberElement element) { |
| 370 assert(element.isInstanceMember); | 365 assert(element.isInstanceMember); |
| 371 if (element.type.containsTypeVariables) { | 366 applyImpact(listener.registerClosurizedMember(element)); |
| 372 applyImpact(listener.registerClosureWithFreeTypeVariables(element)); | |
| 373 _worldBuilder.registerClosureWithFreeTypeVariables(element); | |
| 374 } | |
| 375 applyImpact(listener.registerBoundClosure()); | |
| 376 _worldBuilder.registerClosurizedMember(element); | 367 _worldBuilder.registerClosurizedMember(element); |
| 377 } | 368 } |
| 378 | 369 |
| 379 void forEach(void f(WorkItem work)) { | 370 void forEach(void f(WorkItem work)) { |
| 380 do { | 371 do { |
| 381 while (_queue.isNotEmpty) { | 372 while (_queue.isNotEmpty) { |
| 382 // TODO(johnniwinther): Find an optimal process order. | 373 // TODO(johnniwinther): Find an optimal process order. |
| 383 WorkItem work = _queue.removeLast(); | 374 WorkItem work = _queue.removeLast(); |
| 384 if (!_processedEntities.contains(work.element)) { | 375 if (!_processedEntities.contains(work.element)) { |
| 385 strategy.processWorkItem(f, work); | 376 strategy.processWorkItem(f, work); |
| (...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 588 @override | 579 @override |
| 589 WorkItem createWorkItem(MemberElement element) { | 580 WorkItem createWorkItem(MemberElement element) { |
| 590 assert(invariant(element, element.isDeclaration)); | 581 assert(invariant(element, element.isDeclaration)); |
| 591 if (element.isMalformed) return null; | 582 if (element.isMalformed) return null; |
| 592 | 583 |
| 593 assert(invariant(element, element is AnalyzableElement, | 584 assert(invariant(element, element is AnalyzableElement, |
| 594 message: 'Element $element is not analyzable.')); | 585 message: 'Element $element is not analyzable.')); |
| 595 return _resolution.createWorkItem(element); | 586 return _resolution.createWorkItem(element); |
| 596 } | 587 } |
| 597 } | 588 } |
| OLD | NEW |