Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(94)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/emitter.dart

Issue 11574030: Revert r16155: unit tests of the dart2js compiler fail. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 /** 7 /**
8 * A function element that represents a closure call. The signature is copied 8 * A function element that represents a closure call. The signature is copied
9 * from the given element. 9 * from the given element.
10 */ 10 */
(...skipping 1838 matching lines...) Expand 10 before | Expand all | Expand 10 after
1849 compiler.codegenWorld.invokedNames.forEach(addNoSuchMethodHandlers); 1849 compiler.codegenWorld.invokedNames.forEach(addNoSuchMethodHandlers);
1850 compiler.codegenWorld.invokedGetters.forEach(addNoSuchMethodHandlers); 1850 compiler.codegenWorld.invokedGetters.forEach(addNoSuchMethodHandlers);
1851 compiler.codegenWorld.invokedSetters.forEach(addNoSuchMethodHandlers); 1851 compiler.codegenWorld.invokedSetters.forEach(addNoSuchMethodHandlers);
1852 } 1852 }
1853 1853
1854 String buildIsolateSetup(CodeBuffer buffer, 1854 String buildIsolateSetup(CodeBuffer buffer,
1855 Element appMain, 1855 Element appMain,
1856 Element isolateMain) { 1856 Element isolateMain) {
1857 String mainAccess = "${namer.isolateAccess(appMain)}"; 1857 String mainAccess = "${namer.isolateAccess(appMain)}";
1858 String currentIsolate = "${namer.CURRENT_ISOLATE}"; 1858 String currentIsolate = "${namer.CURRENT_ISOLATE}";
1859 String mainEnsureGetter = '';
1859 // Since we pass the closurized version of the main method to 1860 // Since we pass the closurized version of the main method to
1860 // the isolate method, we must make sure that it exists. 1861 // the isolate method, we must make sure that it exists.
1861 if (!compiler.codegenWorld.staticFunctionsNeedingGetter.contains(appMain)) { 1862 if (!compiler.codegenWorld.staticFunctionsNeedingGetter.contains(appMain)) {
1862 Selector selector = new Selector.callClosure(0); 1863 Selector selector = new Selector.callClosure(0);
1863 String invocationName = "${namer.closureInvocationName(selector)}"; 1864 String invocationName = "${namer.closureInvocationName(selector)}";
1864 buffer.add("$mainAccess.$invocationName = $mainAccess"); 1865 mainEnsureGetter = "$mainAccess.$invocationName = $mainAccess";
1865 } 1866 }
1866 return "${namer.isolateAccess(isolateMain)}($mainAccess)"; 1867 // TODO(ngeoffray): These globals are currently required by the isolate
1868 // library. They should be removed.
1869 buffer.add("""
1870 var \$globalThis = $currentIsolate;
1871 var \$globalState;
1872 var \$globals;
1873 var \$isWorker = false;
1874 var \$supportsWorkers = false;
1875 var \$thisScriptUrl;
1876 function \$static_init(){};
1877
1878 function \$initGlobals(context) {
1879 context.isolateStatics = new ${namer.isolateName}();
1880 }
1881 function \$setGlobals(context) {
1882 $currentIsolate = context.isolateStatics;
1883 \$globalThis = $currentIsolate;
1884 }
1885 $mainEnsureGetter
1886 """);
1887 return "${namer.isolateAccess(isolateMain)}($mainAccess)";
1867 } 1888 }
1868 1889
1869 emitMain(CodeBuffer buffer) { 1890 emitMain(CodeBuffer buffer) {
1870 if (compiler.isMockCompilation) return; 1891 if (compiler.isMockCompilation) return;
1871 Element main = compiler.mainApp.find(Compiler.MAIN); 1892 Element main = compiler.mainApp.find(Compiler.MAIN);
1872 String mainCall = null; 1893 String mainCall = null;
1873 if (compiler.hasIsolateSupport()) { 1894 if (compiler.isolateHelperLibrary != null) {
1874 Element isolateMain = 1895 Element isolateMain =
1875 compiler.isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE); 1896 compiler.isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE);
1876 mainCall = buildIsolateSetup(buffer, main, isolateMain); 1897 mainCall = buildIsolateSetup(buffer, main, isolateMain);
1877 } else { 1898 } else {
1878 mainCall = '${namer.isolateAccess(main)}()'; 1899 mainCall = '${namer.isolateAccess(main)}()';
1879 } 1900 }
1880 if (!compiler.enableMinification) { 1901 if (!compiler.enableMinification) {
1881 buffer.add(""" 1902 buffer.add("""
1882 1903
1883 // 1904 //
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
2060 """; 2081 """;
2061 const String HOOKS_API_USAGE = """ 2082 const String HOOKS_API_USAGE = """
2062 // The code supports the following hooks: 2083 // The code supports the following hooks:
2063 // dartPrint(message) - if this function is defined it is called 2084 // dartPrint(message) - if this function is defined it is called
2064 // instead of the Dart [print] method. 2085 // instead of the Dart [print] method.
2065 // dartMainRunner(main) - if this function is defined, the Dart [main] 2086 // dartMainRunner(main) - if this function is defined, the Dart [main]
2066 // method will not be invoked directly. 2087 // method will not be invoked directly.
2067 // Instead, a closure that will invoke [main] is 2088 // Instead, a closure that will invoke [main] is
2068 // passed to [dartMainRunner]. 2089 // passed to [dartMainRunner].
2069 """; 2090 """;
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698