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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 const VERBOSE_OPTIMIZER_HINTS = false; | 7 const VERBOSE_OPTIMIZER_HINTS = false; |
| 8 | 8 |
| 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 9 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
| 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
| (...skipping 1732 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1743 // know if [mask] is not a more specific type than [indexing]. | 1743 // know if [mask] is not a more specific type than [indexing]. |
| 1744 return isTypedArray(mask) || mask.containsMask(indexing, compiler); | 1744 return isTypedArray(mask) || mask.containsMask(indexing, compiler); |
| 1745 } | 1745 } |
| 1746 | 1746 |
| 1747 /// Called when [enqueuer] is empty, but before it is closed. | 1747 /// Called when [enqueuer] is empty, but before it is closed. |
| 1748 void onQueueEmpty(Enqueuer enqueuer) { | 1748 void onQueueEmpty(Enqueuer enqueuer) { |
| 1749 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) { | 1749 if (!enqueuer.isResolutionQueue && preMirrorsMethodCount == 0) { |
| 1750 preMirrorsMethodCount = generatedCode.length; | 1750 preMirrorsMethodCount = generatedCode.length; |
| 1751 } | 1751 } |
| 1752 | 1752 |
| 1753 if (isTreeShakingDisabled) enqueuer.enqueueEverything(); | 1753 if (isTreeShakingDisabled) { |
| 1754 enqueuer.enqueueEverything(); | |
| 1755 } else if (!targetsUsed.isEmpty) { | |
| 1756 // Add all static elements (not classes) that have been requested for | |
| 1757 // reflection. If there is no mirror-usage these are probably not | |
| 1758 // necessary, but the backend relies on them being resolved. | |
| 1759 List staticFields = []; | |
|
kasperl
2014/01/30 13:37:15
If you only need them to be resolved, maybe you sh
floitsch
2014/01/30 14:10:24
Done.
| |
| 1760 for (Element target in targetsUsed) { | |
| 1761 if (target == null) continue; | |
| 1762 if (target.isField()) { | |
| 1763 staticFields.add(target); | |
| 1764 } else if (target.isLibrary() || target.isClass()) { | |
| 1765 ScopeContainerElement container = target; | |
| 1766 container.forEachLocalMember((Element member) { | |
| 1767 if (!member.isInstanceMember() && member.isField()) { | |
| 1768 staticFields.add(member); | |
| 1769 } | |
| 1770 }); | |
| 1771 } | |
| 1772 } | |
| 1773 enqueuer.enqueueReflectiveStaticFields(staticFields); | |
| 1774 } | |
| 1754 | 1775 |
| 1755 if (mustPreserveNames) compiler.log('Preserving names.'); | 1776 if (mustPreserveNames) compiler.log('Preserving names.'); |
| 1756 | 1777 |
| 1757 if (mustRetainMetadata) { | 1778 if (mustRetainMetadata) { |
| 1758 compiler.log('Retaining metadata.'); | 1779 compiler.log('Retaining metadata.'); |
| 1759 | 1780 |
| 1760 compiler.libraries.values.forEach(retainMetadataOf); | 1781 compiler.libraries.values.forEach(retainMetadataOf); |
| 1761 for (Dependency dependency in metadataConstants) { | 1782 for (Dependency dependency in metadataConstants) { |
| 1762 registerCompileTimeConstant( | 1783 registerCompileTimeConstant( |
| 1763 dependency.constant, dependency.user); | 1784 dependency.constant, dependency.user); |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1873 copy(constant.values); | 1894 copy(constant.values); |
| 1874 copy(constant.protoValue); | 1895 copy(constant.protoValue); |
| 1875 copy(constant); | 1896 copy(constant); |
| 1876 } | 1897 } |
| 1877 | 1898 |
| 1878 void visitConstructed(ConstructedConstant constant) { | 1899 void visitConstructed(ConstructedConstant constant) { |
| 1879 copy(constant.fields); | 1900 copy(constant.fields); |
| 1880 copy(constant); | 1901 copy(constant); |
| 1881 } | 1902 } |
| 1882 } | 1903 } |
| OLD | NEW |