| 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 1814 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1825 ClassElement cls = value.type.element; | 1825 ClassElement cls = value.type.element; |
| 1826 if (cls == noInlineClass) { | 1826 if (cls == noInlineClass) { |
| 1827 hasNoInline = true; | 1827 hasNoInline = true; |
| 1828 if (VERBOSE_OPTIMIZER_HINTS) { | 1828 if (VERBOSE_OPTIMIZER_HINTS) { |
| 1829 compiler.reportHere(element, "Cannot inline"); | 1829 compiler.reportHere(element, "Cannot inline"); |
| 1830 } | 1830 } |
| 1831 inlineCache.markAsNonInlinable(element); | 1831 inlineCache.markAsNonInlinable(element); |
| 1832 } else if (cls == noThrowsClass) { | 1832 } else if (cls == noThrowsClass) { |
| 1833 hasNoThrows = true; | 1833 hasNoThrows = true; |
| 1834 if (!Elements.isStaticOrTopLevelFunction(element)) { | 1834 if (!Elements.isStaticOrTopLevelFunction(element)) { |
| 1835 compiler.internalErrorOnElement( | 1835 compiler.internalError(element, |
| 1836 element, | |
| 1837 "@NoThrows() is currently limited to top-level" | 1836 "@NoThrows() is currently limited to top-level" |
| 1838 " or static functions"); | 1837 " or static functions"); |
| 1839 } | 1838 } |
| 1840 if (VERBOSE_OPTIMIZER_HINTS) { | 1839 if (VERBOSE_OPTIMIZER_HINTS) { |
| 1841 compiler.reportHere(element, "Cannot throw"); | 1840 compiler.reportHere(element, "Cannot throw"); |
| 1842 } | 1841 } |
| 1843 compiler.world.registerCannotThrow(element); | 1842 compiler.world.registerCannotThrow(element); |
| 1844 } else if (cls == noSideEffectsClass) { | 1843 } else if (cls == noSideEffectsClass) { |
| 1845 hasNoSideEffects = true; | 1844 hasNoSideEffects = true; |
| 1846 if (VERBOSE_OPTIMIZER_HINTS) { | 1845 if (VERBOSE_OPTIMIZER_HINTS) { |
| 1847 compiler.reportHere(element, "Has no side effects"); | 1846 compiler.reportHere(element, "Has no side effects"); |
| 1848 } | 1847 } |
| 1849 compiler.world.registerSideEffectsFree(element); | 1848 compiler.world.registerSideEffectsFree(element); |
| 1850 } | 1849 } |
| 1851 } | 1850 } |
| 1852 if (hasNoThrows && !hasNoInline) { | 1851 if (hasNoThrows && !hasNoInline) { |
| 1853 compiler.internalErrorOnElement( | 1852 compiler.internalError(element, |
| 1854 element, "@NoThrows() should always be combined with @NoInline"); | 1853 "@NoThrows() should always be combined with @NoInline."); |
| 1855 } | 1854 } |
| 1856 if (hasNoSideEffects && !hasNoInline) { | 1855 if (hasNoSideEffects && !hasNoInline) { |
| 1857 compiler.internalErrorOnElement( | 1856 compiler.internalError(element, |
| 1858 element, "@NoSideEffects() should always be combined with @NoInline"); | 1857 "@NoSideEffects() should always be combined with @NoInline."); |
| 1859 } | 1858 } |
| 1860 } | 1859 } |
| 1861 | 1860 |
| 1862 CodeBuffer codeOf(Element element) { | 1861 CodeBuffer codeOf(Element element) { |
| 1863 return generatedCode.containsKey(element) | 1862 return generatedCode.containsKey(element) |
| 1864 ? jsAst.prettyPrint(generatedCode[element], compiler) | 1863 ? jsAst.prettyPrint(generatedCode[element], compiler) |
| 1865 : null; | 1864 : null; |
| 1866 } | 1865 } |
| 1867 } | 1866 } |
| 1868 | 1867 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1917 copy(constant.values); | 1916 copy(constant.values); |
| 1918 copy(constant.protoValue); | 1917 copy(constant.protoValue); |
| 1919 copy(constant); | 1918 copy(constant); |
| 1920 } | 1919 } |
| 1921 | 1920 |
| 1922 void visitConstructed(ConstructedConstant constant) { | 1921 void visitConstructed(ConstructedConstant constant) { |
| 1923 copy(constant.fields); | 1922 copy(constant.fields); |
| 1924 copy(constant); | 1923 copy(constant); |
| 1925 } | 1924 } |
| 1926 } | 1925 } |
| OLD | NEW |