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 class JavaScriptItemCompilationContext extends ItemCompilationContext { | 7 class JavaScriptItemCompilationContext extends ItemCompilationContext { |
| 8 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); | 8 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); |
| 9 final Set<HInstruction> allocatedFixedLists = new Set<HInstruction>(); | 9 final Set<HInstruction> allocatedFixedLists = new Set<HInstruction>(); |
| 10 } | 10 } |
| (...skipping 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1287 LibraryElement importedLibrary = library.getLibraryFromTag(tag); | 1287 LibraryElement importedLibrary = library.getLibraryFromTag(tag); |
| 1288 if (importedLibrary != compiler.mirrorsLibrary) continue; | 1288 if (importedLibrary != compiler.mirrorsLibrary) continue; |
| 1289 compiler.withCurrentElement(library, () { | 1289 compiler.withCurrentElement(library, () { |
| 1290 compiler.reportInfo(importTag, MessageKind.MIRROR_IMPORT); | 1290 compiler.reportInfo(importTag, MessageKind.MIRROR_IMPORT); |
| 1291 }); | 1291 }); |
| 1292 } | 1292 } |
| 1293 } | 1293 } |
| 1294 } | 1294 } |
| 1295 } | 1295 } |
| 1296 | 1296 |
| 1297 Element getDartClass(Element element) { | |
|
Johnni Winther
2013/11/14 19:14:19
We have the reverse relation encoded somewhere in
karlklose
2013/11/15 08:44:52
It just below ;-)
Done.
| |
| 1298 if (element == jsIntClass) { | |
| 1299 return compiler.intClass; | |
| 1300 } else if (element == jsBoolClass) { | |
| 1301 return compiler.boolClass; | |
| 1302 } else if (element == jsNumberClass) { | |
| 1303 return compiler.numClass; | |
| 1304 } else if (element == jsDoubleClass) { | |
| 1305 return compiler.doubleClass; | |
| 1306 } else if (element == jsStringClass) { | |
| 1307 return compiler.stringClass; | |
| 1308 } else if (element == jsArrayClass) { | |
| 1309 return compiler.listClass; | |
| 1310 } else { | |
| 1311 return element; | |
| 1312 } | |
| 1313 } | |
| 1314 | |
| 1297 Element getImplementationClass(Element element) { | 1315 Element getImplementationClass(Element element) { |
| 1298 if (element == compiler.intClass) { | 1316 if (element == compiler.intClass) { |
| 1299 return jsIntClass; | 1317 return jsIntClass; |
| 1300 } else if (element == compiler.boolClass) { | 1318 } else if (element == compiler.boolClass) { |
| 1301 return jsBoolClass; | 1319 return jsBoolClass; |
| 1302 } else if (element == compiler.numClass) { | 1320 } else if (element == compiler.numClass) { |
| 1303 return jsNumberClass; | 1321 return jsNumberClass; |
| 1304 } else if (element == compiler.doubleClass) { | 1322 } else if (element == compiler.doubleClass) { |
| 1305 return jsDoubleClass; | 1323 return jsDoubleClass; |
| 1306 } else if (element == compiler.stringClass) { | 1324 } else if (element == compiler.stringClass) { |
| (...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1730 if (hasInsufficientMirrorsUsed) return true; | 1748 if (hasInsufficientMirrorsUsed) return true; |
| 1731 return isNeededForReflection(element); | 1749 return isNeededForReflection(element); |
| 1732 } | 1750 } |
| 1733 | 1751 |
| 1734 /** | 1752 /** |
| 1735 * Returns `true` if the emitter must emit the element even though there | 1753 * Returns `true` if the emitter must emit the element even though there |
| 1736 * is no direct use in the program, but because the reflective system may | 1754 * is no direct use in the program, but because the reflective system may |
| 1737 * need to access it. | 1755 * need to access it. |
| 1738 */ | 1756 */ |
| 1739 bool isNeededForReflection(Element element) { | 1757 bool isNeededForReflection(Element element) { |
| 1758 element = getDartClass(element); | |
| 1740 if (hasInsufficientMirrorsUsed) return isTreeShakingDisabled; | 1759 if (hasInsufficientMirrorsUsed) return isTreeShakingDisabled; |
| 1741 /// Record the name of [element] in [symbolsUsed]. Return true for | 1760 /// Record the name of [element] in [symbolsUsed]. Return true for |
| 1742 /// convenience. | 1761 /// convenience. |
| 1743 bool registerNameOf(Element element) { | 1762 bool registerNameOf(Element element) { |
| 1744 symbolsUsed.add(element.name); | 1763 symbolsUsed.add(element.name); |
| 1745 if (element.isConstructor()) { | 1764 if (element.isConstructor()) { |
| 1746 symbolsUsed.add(element.getEnclosingClass().name); | 1765 symbolsUsed.add(element.getEnclosingClass().name); |
| 1747 } | 1766 } |
| 1748 return true; | 1767 return true; |
| 1749 } | 1768 } |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1902 copy(constant.values); | 1921 copy(constant.values); |
| 1903 copy(constant.protoValue); | 1922 copy(constant.protoValue); |
| 1904 copy(constant); | 1923 copy(constant); |
| 1905 } | 1924 } |
| 1906 | 1925 |
| 1907 void visitConstructed(ConstructedConstant constant) { | 1926 void visitConstructed(ConstructedConstant constant) { |
| 1908 copy(constant.fields); | 1927 copy(constant.fields); |
| 1909 copy(constant); | 1928 copy(constant); |
| 1910 } | 1929 } |
| 1911 } | 1930 } |
| OLD | NEW |