| 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 1645 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1656 ClassElement get mapImplementation => mapLiteralClass; | 1656 ClassElement get mapImplementation => mapLiteralClass; |
| 1657 ClassElement get constMapImplementation => constMapLiteralClass; | 1657 ClassElement get constMapImplementation => constMapLiteralClass; |
| 1658 ClassElement get typeImplementation => typeLiteralClass; | 1658 ClassElement get typeImplementation => typeLiteralClass; |
| 1659 ClassElement get boolImplementation => jsBoolClass; | 1659 ClassElement get boolImplementation => jsBoolClass; |
| 1660 ClassElement get nullImplementation => jsNullClass; | 1660 ClassElement get nullImplementation => jsNullClass; |
| 1661 | 1661 |
| 1662 void registerStaticUse(Element element, Enqueuer enqueuer) { | 1662 void registerStaticUse(Element element, Enqueuer enqueuer) { |
| 1663 if (element == disableTreeShakingMarker) { | 1663 if (element == disableTreeShakingMarker) { |
| 1664 compiler.disableTypeInferenceForMirrors = true; | 1664 compiler.disableTypeInferenceForMirrors = true; |
| 1665 isTreeShakingDisabled = true; | 1665 isTreeShakingDisabled = true; |
| 1666 typeVariableHandler.onTreeShakingDisabled(enqueuer); |
| 1666 } else if (element == preserveNamesMarker) { | 1667 } else if (element == preserveNamesMarker) { |
| 1667 mustPreserveNames = true; | 1668 mustPreserveNames = true; |
| 1668 } else if (element == preserveMetadataMarker) { | 1669 } else if (element == preserveMetadataMarker) { |
| 1669 mustRetainMetadata = true; | 1670 mustRetainMetadata = true; |
| 1670 } | 1671 } |
| 1671 customElementsAnalysis.registerStaticUse(element, enqueuer); | 1672 customElementsAnalysis.registerStaticUse(element, enqueuer); |
| 1672 } | 1673 } |
| 1673 | 1674 |
| 1674 /// Called when [:const Symbol(name):] is seen. | 1675 /// Called when [:const Symbol(name):] is seen. |
| 1675 void registerConstSymbol(String name, TreeElements elements) { | 1676 void registerConstSymbol(String name, TreeElements elements) { |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1881 compiler.log('Retaining metadata.'); | 1882 compiler.log('Retaining metadata.'); |
| 1882 | 1883 |
| 1883 compiler.libraries.values.forEach(retainMetadataOf); | 1884 compiler.libraries.values.forEach(retainMetadataOf); |
| 1884 for (Dependency dependency in metadataConstants) { | 1885 for (Dependency dependency in metadataConstants) { |
| 1885 registerCompileTimeConstant( | 1886 registerCompileTimeConstant( |
| 1886 dependency.constant, dependency.user); | 1887 dependency.constant, dependency.user); |
| 1887 } | 1888 } |
| 1888 metadataConstants.clear(); | 1889 metadataConstants.clear(); |
| 1889 } | 1890 } |
| 1890 | 1891 |
| 1891 if (isTreeShakingDisabled) { | |
| 1892 if (enqueuer.isResolutionQueue) { | |
| 1893 typeVariableHandler.onResolutionQueueEmpty(enqueuer); | |
| 1894 } else { | |
| 1895 typeVariableHandler.onCodegenQueueEmpty(); | |
| 1896 } | |
| 1897 } | |
| 1898 customElementsAnalysis.onQueueEmpty(enqueuer); | 1892 customElementsAnalysis.onQueueEmpty(enqueuer); |
| 1899 } | 1893 } |
| 1900 | 1894 |
| 1901 void onElementResolved(Element element, TreeElements elements) { | 1895 void onElementResolved(Element element, TreeElements elements) { |
| 1902 LibraryElement library = element.getLibrary(); | 1896 LibraryElement library = element.getLibrary(); |
| 1903 if (!library.isPlatformLibrary && !library.canUseNative) return; | 1897 if (!library.isPlatformLibrary && !library.canUseNative) return; |
| 1904 bool hasNoInline = false; | 1898 bool hasNoInline = false; |
| 1905 bool hasNoThrows = false; | 1899 bool hasNoThrows = false; |
| 1906 bool hasNoSideEffects = false; | 1900 bool hasNoSideEffects = false; |
| 1907 for (MetadataAnnotation metadata in element.metadata) { | 1901 for (MetadataAnnotation metadata in element.metadata) { |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1995 copy(constant.values); | 1989 copy(constant.values); |
| 1996 copy(constant.protoValue); | 1990 copy(constant.protoValue); |
| 1997 copy(constant); | 1991 copy(constant); |
| 1998 } | 1992 } |
| 1999 | 1993 |
| 2000 void visitConstructed(ConstructedConstant constant) { | 1994 void visitConstructed(ConstructedConstant constant) { |
| 2001 copy(constant.fields); | 1995 copy(constant.fields); |
| 2002 copy(constant); | 1996 copy(constant); |
| 2003 } | 1997 } |
| 2004 } | 1998 } |
| OLD | NEW |