| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 class OldEmitter implements Emitter { | 8 class OldEmitter implements Emitter { |
| 9 final Compiler compiler; | 9 final Compiler compiler; |
| 10 final CodeEmitterTask task; | 10 final CodeEmitterTask task; |
| (...skipping 1805 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1816 | 1816 |
| 1817 outputBuffer..write(buildGeneratedBy()) | 1817 outputBuffer..write(buildGeneratedBy()) |
| 1818 ..write('${deferredInitializers}.current$_=$_' | 1818 ..write('${deferredInitializers}.current$_=$_' |
| 1819 'function$_(${globalsHolder}) {$N'); | 1819 'function$_(${globalsHolder}) {$N'); |
| 1820 for (String globalObject in Namer.reservedGlobalObjectNames) { | 1820 for (String globalObject in Namer.reservedGlobalObjectNames) { |
| 1821 outputBuffer | 1821 outputBuffer |
| 1822 .write('var $globalObject$_=$_' | 1822 .write('var $globalObject$_=$_' |
| 1823 '${globalsHolder}.$globalObject$N'); | 1823 '${globalsHolder}.$globalObject$N'); |
| 1824 } | 1824 } |
| 1825 outputBuffer | 1825 outputBuffer |
| 1826 .write('var init$_=$_${globalsHolder}.init$N'); | 1826 ..write('var init$_=$_${globalsHolder}.init$N') |
| 1827 ..write('var ${namer.isolateName}$_=$_' |
| 1828 '${globalsHolder}.${namer.isolateName}$N'); |
| 1827 if (libraryDescriptorBuffer != null) { | 1829 if (libraryDescriptorBuffer != null) { |
| 1828 // TODO(ahe): This defines a lot of properties on the | 1830 // TODO(ahe): This defines a lot of properties on the |
| 1829 // Isolate.prototype object. We know this will turn it into a | 1831 // Isolate.prototype object. We know this will turn it into a |
| 1830 // slow object in V8, so instead we should do something similar | 1832 // slow object in V8, so instead we should do something similar |
| 1831 // to Isolate.$finishIsolateConstructor. | 1833 // to Isolate.$finishIsolateConstructor. |
| 1832 outputBuffer | 1834 outputBuffer |
| 1833 ..write('var ${namer.isolateName}$_=$_' | 1835 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N') |
| 1834 '${globalsHolder}.${namer.isolateName}$N') | 1836 // The classesCollector object ($$). |
| 1835 ..write('var ${namer.currentIsolate}$_=$_$isolatePropertiesName$N') | 1837 ..write('$classesCollector$_=${_}Object.create(null);$n') |
| 1836 // The classesCollector object ($$). | 1838 ..write('(') |
| 1837 ..write('$classesCollector$_=${_}Object.create(null);$n') | 1839 ..write( |
| 1838 ..write('(') | 1840 jsAst.prettyPrint( |
| 1839 ..write( | 1841 getReflectionDataParser(classesCollector, backend), |
| 1840 jsAst.prettyPrint( | 1842 compiler, monitor: compiler.dumpInfoTask)) |
| 1841 getReflectionDataParser(classesCollector, backend), | 1843 ..write(')') |
| 1842 compiler, monitor: compiler.dumpInfoTask)) | 1844 ..write('([$n') |
| 1843 ..write(')') | 1845 ..addBuffer(libraryDescriptorBuffer) |
| 1844 ..write('([$n') | 1846 ..write('])$N'); |
| 1845 ..addBuffer(libraryDescriptorBuffer) | |
| 1846 ..write('])$N'); | |
| 1847 | 1847 |
| 1848 if (outputClassLists.containsKey(outputUnit)) { | 1848 if (outputClassLists.containsKey(outputUnit)) { |
| 1849 outputBuffer.write( | 1849 outputBuffer.write( |
| 1850 '$finishClassesName($classesCollector,$_${namer.currentIsolate},' | 1850 '$finishClassesName($classesCollector,$_${namer.currentIsolate},' |
| 1851 '$_$isolatePropertiesName)$N'); | 1851 '$_$isolatePropertiesName)$N'); |
| 1852 } | 1852 } |
| 1853 | 1853 |
| 1854 } | 1854 } |
| 1855 | 1855 |
| 1856 classesCollector = oldClassesCollector; | 1856 classesCollector = oldClassesCollector; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1919 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 1919 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 1920 if (element.isInstanceMember) { | 1920 if (element.isInstanceMember) { |
| 1921 cachedClassBuilders.remove(element.enclosingClass); | 1921 cachedClassBuilders.remove(element.enclosingClass); |
| 1922 | 1922 |
| 1923 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 1923 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 1924 | 1924 |
| 1925 } | 1925 } |
| 1926 } | 1926 } |
| 1927 } | 1927 } |
| 1928 } | 1928 } |
| OLD | NEW |