| 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 typedef ItemCompilationContext ItemCompilationContextCreator(); |
| 8 |
| 7 class EnqueueTask extends CompilerTask { | 9 class EnqueueTask extends CompilerTask { |
| 8 final ResolutionEnqueuer resolution; | 10 final ResolutionEnqueuer resolution; |
| 9 final CodegenEnqueuer codegen; | 11 final CodegenEnqueuer codegen; |
| 10 | 12 |
| 11 /// A reverse map from name to *all* elements with that name, not | 13 /// A reverse map from name to *all* elements with that name, not |
| 12 /// just instance members of instantiated classes. | 14 /// just instance members of instantiated classes. |
| 13 final Map<String, Link<Element>> allElementsByName | 15 final Map<String, Link<Element>> allElementsByName |
| 14 = new Map<String, Link<Element>>(); | 16 = new Map<String, Link<Element>>(); |
| 15 | 17 |
| 16 void ensureAllElementsByName() { | 18 void ensureAllElementsByName() { |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 66 |
| 65 codegen.nativeEnqueuer = compiler.backend.nativeCodegenEnqueuer(codegen); | 67 codegen.nativeEnqueuer = compiler.backend.nativeCodegenEnqueuer(codegen); |
| 66 resolution.nativeEnqueuer = | 68 resolution.nativeEnqueuer = |
| 67 compiler.backend.nativeResolutionEnqueuer(resolution); | 69 compiler.backend.nativeResolutionEnqueuer(resolution); |
| 68 } | 70 } |
| 69 } | 71 } |
| 70 | 72 |
| 71 abstract class Enqueuer { | 73 abstract class Enqueuer { |
| 72 final String name; | 74 final String name; |
| 73 final Compiler compiler; // TODO(ahe): Remove this dependency. | 75 final Compiler compiler; // TODO(ahe): Remove this dependency. |
| 74 final Function itemCompilationContextCreator; | 76 final ItemCompilationContextCreator itemCompilationContextCreator; |
| 75 final Map<String, Link<Element>> instanceMembersByName | 77 final Map<String, Link<Element>> instanceMembersByName |
| 76 = new Map<String, Link<Element>>(); | 78 = new Map<String, Link<Element>>(); |
| 77 final Map<String, Link<Element>> instanceFunctionsByName | 79 final Map<String, Link<Element>> instanceFunctionsByName |
| 78 = new Map<String, Link<Element>>(); | 80 = new Map<String, Link<Element>>(); |
| 79 final Set<ClassElement> seenClasses = new Set<ClassElement>(); | 81 final Set<ClassElement> seenClasses = new Set<ClassElement>(); |
| 80 final Universe universe = new Universe(); | 82 final Universe universe = new Universe(); |
| 81 | 83 |
| 82 bool queueIsClosed = false; | 84 bool queueIsClosed = false; |
| 83 EnqueueTask task; | 85 EnqueueTask task; |
| 84 native.NativeEnqueuer nativeEnqueuer; // Set by EnqueueTask | 86 native.NativeEnqueuer nativeEnqueuer; // Set by EnqueueTask |
| 85 | 87 |
| 86 bool hasEnqueuedEverything = false; | 88 bool hasEnqueuedEverything = false; |
| 87 | 89 |
| 88 Enqueuer(this.name, this.compiler, | 90 Enqueuer(this.name, this.compiler, this.itemCompilationContextCreator); |
| 89 ItemCompilationContext itemCompilationContextCreator()) | |
| 90 : this.itemCompilationContextCreator = itemCompilationContextCreator; | |
| 91 | 91 |
| 92 Queue<WorkItem> get queue; | 92 Queue<WorkItem> get queue; |
| 93 | 93 |
| 94 /// Returns [:true:] if this enqueuer is the resolution enqueuer. | 94 /// Returns [:true:] if this enqueuer is the resolution enqueuer. |
| 95 bool get isResolutionQueue => false; | 95 bool get isResolutionQueue => false; |
| 96 | 96 |
| 97 /// Returns [:true:] if [member] has been processed by this enqueuer. | 97 /// Returns [:true:] if [member] has been processed by this enqueuer. |
| 98 bool isProcessed(Element member); | 98 bool isProcessed(Element member); |
| 99 | 99 |
| 100 /** | 100 /** |
| (...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 730 } | 730 } |
| 731 CodegenWorkItem workItem = new CodegenWorkItem( | 731 CodegenWorkItem workItem = new CodegenWorkItem( |
| 732 element, itemCompilationContextCreator()); | 732 element, itemCompilationContextCreator()); |
| 733 queue.add(workItem); | 733 queue.add(workItem); |
| 734 } | 734 } |
| 735 | 735 |
| 736 void _logSpecificSummary(log(message)) { | 736 void _logSpecificSummary(log(message)) { |
| 737 log('Compiled ${generatedCode.length} methods.'); | 737 log('Compiled ${generatedCode.length} methods.'); |
| 738 } | 738 } |
| 739 } | 739 } |
| OLD | NEW |