| 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 925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 936 backend.isolateHelperLibrary.find(JavaScriptBackend.START_ROOT_ISOLATE); | 936 backend.isolateHelperLibrary.find(JavaScriptBackend.START_ROOT_ISOLATE); |
| 937 mainCallClosure = buildIsolateSetupClosure(main, isolateMain); | 937 mainCallClosure = buildIsolateSetupClosure(main, isolateMain); |
| 938 } else if (compiler.hasIncrementalSupport) { | 938 } else if (compiler.hasIncrementalSupport) { |
| 939 mainCallClosure = js( | 939 mainCallClosure = js( |
| 940 'function() { return #(); }', | 940 'function() { return #(); }', |
| 941 backend.emitter.staticFunctionAccess(main)); | 941 backend.emitter.staticFunctionAccess(main)); |
| 942 } else { | 942 } else { |
| 943 mainCallClosure = backend.emitter.staticFunctionAccess(main); | 943 mainCallClosure = backend.emitter.staticFunctionAccess(main); |
| 944 } | 944 } |
| 945 | 945 |
| 946 bool initializeAffinityTag = backend.needToInitializeIsolateAffinityTag; | 946 if (NativeGenerator.needsBoilerplate(backend)) { |
| 947 jsAst.Statement nativeBoilerPlate = NativeGenerator.generateBoilerPlate( | 947 jsAst.Statement nativeBoilerPlate = NativeGenerator.generateBoilerplate( |
| 948 generateEmbeddedGlobalAccess, | 948 backend, |
| 949 initializeIsolateAffinityTag: initializeAffinityTag, | 949 generateEmbeddedGlobalAccess, |
| 950 initializeDispatchProperty: backend.needToInitializeDispatchProperty); | 950 js("convertToFastObject", [])); |
| 951 buffer.write(jsAst.prettyPrint(nativeBoilerPlate, | 951 buffer.write(jsAst.prettyPrint(nativeBoilerPlate, |
| 952 compiler, monitor: compiler.dumpInfoTask)); | 952 compiler, monitor: compiler.dumpInfoTask)); |
| 953 } |
| 953 | 954 |
| 954 jsAst.Expression currentScriptAccess = | 955 jsAst.Expression currentScriptAccess = |
| 955 generateEmbeddedGlobalAccess(embeddedNames.CURRENT_SCRIPT); | 956 generateEmbeddedGlobalAccess(embeddedNames.CURRENT_SCRIPT); |
| 956 | 957 |
| 957 addComment('BEGIN invoke [main].', buffer); | 958 addComment('BEGIN invoke [main].', buffer); |
| 958 // This code finds the currently executing script by listening to the | 959 // This code finds the currently executing script by listening to the |
| 959 // onload event of all script tags and getting the first script which | 960 // onload event of all script tags and getting the first script which |
| 960 // finishes. Since onload is called immediately after execution this should | 961 // finishes. Since onload is called immediately after execution this should |
| 961 // not substantially change execution order. | 962 // not substantially change execution order. |
| 962 jsAst.Statement invokeMain = js.statement(''' | 963 jsAst.Statement invokeMain = js.statement(''' |
| (...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2029 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { | 2030 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { |
| 2030 if (element.isInstanceMember) { | 2031 if (element.isInstanceMember) { |
| 2031 cachedClassBuilders.remove(element.enclosingClass); | 2032 cachedClassBuilders.remove(element.enclosingClass); |
| 2032 | 2033 |
| 2033 nativeEmitter.cachedBuilders.remove(element.enclosingClass); | 2034 nativeEmitter.cachedBuilders.remove(element.enclosingClass); |
| 2034 | 2035 |
| 2035 } | 2036 } |
| 2036 } | 2037 } |
| 2037 } | 2038 } |
| 2038 } | 2039 } |
| OLD | NEW |