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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/old_emitter/emitter.dart

Issue 830923003: dart2js: make "boilerplate" function in Native generator. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rebase Created 5 years, 11 months 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) 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
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 NativeGenerator nativeGenerator = 946 bool initializeAffinityTag = backend.needToInitializeIsolateAffinityTag;
947 new NativeGenerator(generateEmbeddedGlobalAccess); 947 jsAst.Statement nativeBoilerPlate = NativeGenerator.generateBoilerPlate(
948 if (backend.needToInitializeIsolateAffinityTag) { 948 generateEmbeddedGlobalAccess,
949 buffer.write( 949 initializeIsolateAffinityTag: initializeAffinityTag,
950 jsAst.prettyPrint( 950 initializeDispatchProperty: backend.needToInitializeDispatchProperty);
951 nativeGenerator.generateIsolateAffinityTagInitialization(), 951 buffer.write(jsAst.prettyPrint(nativeBoilerPlate,
952 compiler, monitor: compiler.dumpInfoTask)); 952 compiler, monitor: compiler.dumpInfoTask));
953 buffer.write(N);
954 }
955 if (backend.needToInitializeDispatchProperty) {
956 assert(backend.needToInitializeIsolateAffinityTag);
957 buffer.write(
958 jsAst.prettyPrint(
959 nativeGenerator.generateDispatchPropertyNameInitialization(),
960 compiler, monitor: compiler.dumpInfoTask));
961 buffer.write(N);
962 }
963 953
964 jsAst.Expression currentScriptAccess = 954 jsAst.Expression currentScriptAccess =
965 generateEmbeddedGlobalAccess(embeddedNames.CURRENT_SCRIPT); 955 generateEmbeddedGlobalAccess(embeddedNames.CURRENT_SCRIPT);
966 956
967 addComment('BEGIN invoke [main].', buffer); 957 addComment('BEGIN invoke [main].', buffer);
968 // This code finds the currently executing script by listening to the 958 // This code finds the currently executing script by listening to the
969 // onload event of all script tags and getting the first script which 959 // onload event of all script tags and getting the first script which
970 // finishes. Since onload is called immediately after execution this should 960 // finishes. Since onload is called immediately after execution this should
971 // not substantially change execution order. 961 // not substantially change execution order.
972 jsAst.Statement invokeMain = js.statement(''' 962 jsAst.Statement invokeMain = js.statement('''
(...skipping 1066 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2029 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2040 if (element.isInstanceMember) { 2030 if (element.isInstanceMember) {
2041 cachedClassBuilders.remove(element.enclosingClass); 2031 cachedClassBuilders.remove(element.enclosingClass);
2042 2032
2043 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2033 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2044 2034
2045 } 2035 }
2046 } 2036 }
2047 } 2037 }
2048 } 2038 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698