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.js_emitter; | 5 part of dart2js.js_emitter; |
6 | 6 |
7 /** | 7 /** |
8 * Generates the code for all used classes in the program. Static fields (even | 8 * Generates the code for all used classes in the program. Static fields (even |
9 * in classes) are ignored, since they can be treated as non-class elements. | 9 * in classes) are ignored, since they can be treated as non-class elements. |
10 * | 10 * |
(...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
787 needed.addAll(interceptorEmitter.interceptorsReferencedFromConstants()); | 787 needed.addAll(interceptorEmitter.interceptorsReferencedFromConstants()); |
788 | 788 |
789 // Add unneeded interceptors to the [unneededClasses] set. | 789 // Add unneeded interceptors to the [unneededClasses] set. |
790 for (ClassElement interceptor in backend.interceptedClasses) { | 790 for (ClassElement interceptor in backend.interceptedClasses) { |
791 if (!needed.contains(interceptor) | 791 if (!needed.contains(interceptor) |
792 && interceptor != compiler.objectClass) { | 792 && interceptor != compiler.objectClass) { |
793 unneededClasses.add(interceptor); | 793 unneededClasses.add(interceptor); |
794 } | 794 } |
795 } | 795 } |
796 | 796 |
| 797 // These classes are just helpers for the backend's type system. |
| 798 unneededClasses.add(backend.jsMutableArrayClass); |
| 799 unneededClasses.add(backend.jsFixedArrayClass); |
| 800 unneededClasses.add(backend.jsExtendableArrayClass); |
| 801 unneededClasses.add(backend.jsUInt32Class); |
| 802 unneededClasses.add(backend.jsUInt31Class); |
| 803 |
797 return (ClassElement cls) => !unneededClasses.contains(cls); | 804 return (ClassElement cls) => !unneededClasses.contains(cls); |
798 } | 805 } |
799 | 806 |
800 void emitFinishClassesInvocationIfNecessary(CodeBuffer buffer) { | 807 void emitFinishClassesInvocationIfNecessary(CodeBuffer buffer) { |
801 if (needsDefineClass) { | 808 if (needsDefineClass) { |
802 buffer.write('$finishClassesName($classesCollector,' | 809 buffer.write('$finishClassesName($classesCollector,' |
803 '$_$isolateProperties,' | 810 '$_$isolateProperties,' |
804 '${_}null)$N'); | 811 '${_}null)$N'); |
805 | 812 |
806 // Reset the map. | 813 // Reset the map. |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1592 } | 1599 } |
1593 | 1600 |
1594 bool isDeferred(Element element) { | 1601 bool isDeferred(Element element) { |
1595 return compiler.deferredLoadTask.isDeferred(element); | 1602 return compiler.deferredLoadTask.isDeferred(element); |
1596 } | 1603 } |
1597 | 1604 |
1598 bool get areAnyElementsDeferred { | 1605 bool get areAnyElementsDeferred { |
1599 return compiler.deferredLoadTask.areAnyElementsDeferred; | 1606 return compiler.deferredLoadTask.areAnyElementsDeferred; |
1600 } | 1607 } |
1601 } | 1608 } |
OLD | NEW |