| 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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 class EnqueueTask extends CompilerTask { | 7 class EnqueueTask extends CompilerTask { |
| 8 final ResolutionEnqueuer resolution; | 8 final ResolutionEnqueuer resolution; |
| 9 final CodegenEnqueuer codegen; | 9 final CodegenEnqueuer codegen; |
| 10 | 10 |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 565 ItemCompilationContext itemCompilationContextCreator()) | 565 ItemCompilationContext itemCompilationContextCreator()) |
| 566 : super('resolution enqueuer', compiler, itemCompilationContextCreator), | 566 : super('resolution enqueuer', compiler, itemCompilationContextCreator), |
| 567 resolvedElements = new LinkedHashMap<Element, TreeElements>(), | 567 resolvedElements = new LinkedHashMap<Element, TreeElements>(), |
| 568 queue = new Queue<ResolutionWorkItem>(), | 568 queue = new Queue<ResolutionWorkItem>(), |
| 569 postQueue = new Queue<PostProcessTask>(); | 569 postQueue = new Queue<PostProcessTask>(); |
| 570 | 570 |
| 571 bool get isResolutionQueue => true; | 571 bool get isResolutionQueue => true; |
| 572 | 572 |
| 573 bool isProcessed(Element member) => resolvedElements.containsKey(member); | 573 bool isProcessed(Element member) => resolvedElements.containsKey(member); |
| 574 | 574 |
| 575 /// Returns [:true:] if [element] has actually been used. |
| 576 bool isLive(Element element) { |
| 577 if (seenClasses.contains(element)) return true; |
| 578 if (getCachedElements(element) != null) return true; |
| 579 return false; |
| 580 } |
| 581 |
| 575 TreeElements getCachedElements(Element element) { | 582 TreeElements getCachedElements(Element element) { |
| 576 // TODO(ngeoffray): Get rid of this check. | 583 // TODO(ngeoffray): Get rid of this check. |
| 577 if (element.enclosingElement.isClosure()) { | 584 if (element.enclosingElement.isClosure()) { |
| 578 closureMapping.ClosureClassElement cls = element.enclosingElement; | 585 closureMapping.ClosureClassElement cls = element.enclosingElement; |
| 579 element = cls.methodElement; | 586 element = cls.methodElement; |
| 580 } else if (element.isGenerativeConstructorBody()) { | 587 } else if (element.isGenerativeConstructorBody()) { |
| 581 ConstructorBodyElement body = element; | 588 ConstructorBodyElement body = element; |
| 582 element = body.constructor; | 589 element = body.constructor; |
| 583 } | 590 } |
| 584 Element owner = element.getOutermostEnclosingMemberOrTopLevel(); | 591 Element owner = element.getOutermostEnclosingMemberOrTopLevel(); |
| (...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 726 while(!queue.isEmpty) { | 733 while(!queue.isEmpty) { |
| 727 // TODO(johnniwinther): Find an optimal process order for codegen. | 734 // TODO(johnniwinther): Find an optimal process order for codegen. |
| 728 f(queue.removeLast()); | 735 f(queue.removeLast()); |
| 729 } | 736 } |
| 730 } | 737 } |
| 731 | 738 |
| 732 void _logSpecificSummary(log(message)) { | 739 void _logSpecificSummary(log(message)) { |
| 733 log('Compiled ${generatedCode.length} methods.'); | 740 log('Compiled ${generatedCode.length} methods.'); |
| 734 } | 741 } |
| 735 } | 742 } |
| OLD | NEW |