| 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 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 // dependencies. | 163 // dependencies. |
| 164 compiler.backend.registerInstantiatedClass( | 164 compiler.backend.registerInstantiatedClass( |
| 165 cls, this, compiler.globalDependencies); | 165 cls, this, compiler.globalDependencies); |
| 166 } | 166 } |
| 167 | 167 |
| 168 void registerInstantiatedClass(ClassElement cls, TreeElements elements) { | 168 void registerInstantiatedClass(ClassElement cls, TreeElements elements) { |
| 169 cls.ensureResolved(compiler); | 169 cls.ensureResolved(compiler); |
| 170 registerInstantiatedType(cls.rawType, elements); | 170 registerInstantiatedType(cls.rawType, elements); |
| 171 } | 171 } |
| 172 | 172 |
| 173 void registerTypeLiteral(Element element, TreeElements elements) { |
| 174 registerInstantiatedClass(compiler.typeClass, elements); |
| 175 compiler.backend.registerTypeLiteral(elements); |
| 176 if (compiler.mirrorsEnabled) { |
| 177 // In order to use reflectClass, we need to find the constructor. |
| 178 registerInstantiatedClass(element, elements); |
| 179 } |
| 180 } |
| 181 |
| 173 bool checkNoEnqueuedInvokedInstanceMethods() { | 182 bool checkNoEnqueuedInvokedInstanceMethods() { |
| 174 task.measure(() { | 183 task.measure(() { |
| 175 // Run through the classes and see if we need to compile methods. | 184 // Run through the classes and see if we need to compile methods. |
| 176 for (ClassElement classElement in universe.instantiatedClasses) { | 185 for (ClassElement classElement in universe.instantiatedClasses) { |
| 177 for (ClassElement currentClass = classElement; | 186 for (ClassElement currentClass = classElement; |
| 178 currentClass != null; | 187 currentClass != null; |
| 179 currentClass = currentClass.superclass) { | 188 currentClass = currentClass.superclass) { |
| 180 processInstantiatedClass(currentClass); | 189 processInstantiatedClass(currentClass); |
| 181 } | 190 } |
| 182 } | 191 } |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 342 task.measure(() { | 351 task.measure(() { |
| 343 registerNewSelector(setterName, selector, universe.invokedSetters); | 352 registerNewSelector(setterName, selector, universe.invokedSetters); |
| 344 }); | 353 }); |
| 345 } | 354 } |
| 346 | 355 |
| 347 /// Called when [:const Symbol(name):] is seen. | 356 /// Called when [:const Symbol(name):] is seen. |
| 348 void registerConstSymbol(String name, TreeElements elements) { | 357 void registerConstSymbol(String name, TreeElements elements) { |
| 349 // If dart:mirrors is loaded, a const symbol may be used to call a | 358 // If dart:mirrors is loaded, a const symbol may be used to call a |
| 350 // static/top-level method or accessor, instantiate a class, call | 359 // static/top-level method or accessor, instantiate a class, call |
| 351 // an instance method or accessor with the given name. | 360 // an instance method or accessor with the given name. |
| 352 if (compiler.mirrorSystemClass == null) return; | 361 if (!compiler.mirrorsEnabled) return; |
| 353 | 362 |
| 354 task.ensureAllElementsByName(); | 363 task.ensureAllElementsByName(); |
| 355 | 364 |
| 356 for (var link = task.allElementsByName[name]; | 365 for (var link = task.allElementsByName[name]; |
| 357 link != null && !link.isEmpty; | 366 link != null && !link.isEmpty; |
| 358 link = link.tail) { | 367 link = link.tail) { |
| 359 Element element = link.head; | 368 Element element = link.head; |
| 360 if (Elements.isUnresolved(element)) { | 369 if (Elements.isUnresolved(element)) { |
| 361 // Ignore. | 370 // Ignore. |
| 362 } else if (element.isConstructor()) { | 371 } else if (element.isConstructor()) { |
| (...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 759 while(!queue.isEmpty) { | 768 while(!queue.isEmpty) { |
| 760 // TODO(johnniwinther): Find an optimal process order for codegen. | 769 // TODO(johnniwinther): Find an optimal process order for codegen. |
| 761 f(queue.removeLast()); | 770 f(queue.removeLast()); |
| 762 } | 771 } |
| 763 } | 772 } |
| 764 | 773 |
| 765 void _logSpecificSummary(log(message)) { | 774 void _logSpecificSummary(log(message)) { |
| 766 log('Compiled ${generatedCode.length} methods.'); | 775 log('Compiled ${generatedCode.length} methods.'); |
| 767 } | 776 } |
| 768 } | 777 } |
| OLD | NEW |