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

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: Address comment. 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
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/native_generator.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 926 matching lines...) Expand 10 before | Expand all | Expand 10 after
937 backend.isolateHelperLibrary.find(JavaScriptBackend.START_ROOT_ISOLATE); 937 backend.isolateHelperLibrary.find(JavaScriptBackend.START_ROOT_ISOLATE);
938 mainCallClosure = buildIsolateSetupClosure(main, isolateMain); 938 mainCallClosure = buildIsolateSetupClosure(main, isolateMain);
939 } else if (compiler.hasIncrementalSupport) { 939 } else if (compiler.hasIncrementalSupport) {
940 mainCallClosure = js( 940 mainCallClosure = js(
941 'function() { return #(); }', 941 'function() { return #(); }',
942 backend.emitter.staticFunctionAccess(main)); 942 backend.emitter.staticFunctionAccess(main));
943 } else { 943 } else {
944 mainCallClosure = backend.emitter.staticFunctionAccess(main); 944 mainCallClosure = backend.emitter.staticFunctionAccess(main);
945 } 945 }
946 946
947 NativeGenerator nativeGenerator = 947 bool initializeAffinityTag = backend.needToInitializeIsolateAffinityTag;
948 new NativeGenerator(generateEmbeddedGlobalAccess); 948 jsAst.Statement nativeBoilerPlate =
949 if (backend.needToInitializeIsolateAffinityTag) { 949 NativeGenerator.generateIsolateAffinityTagInitialization(
950 buffer.write( 950 generateEmbeddedGlobalAccess,
951 jsAst.prettyPrint( 951 initializeIsolateAffinityTag: initializeAffinityTag,
952 nativeGenerator.generateIsolateAffinityTagInitialization(), 952 initializeDispatchProperty: backend.needToInitializeDispatchProperty);
953 compiler, monitor: compiler.dumpInfoTask)); 953 buffer.write(jsAst.prettyPrint(nativeBoilerPlate,
954 buffer.write(N); 954 compiler, monitor: compiler.dumpInfoTask));
955 }
956 if (backend.needToInitializeDispatchProperty) {
957 assert(backend.needToInitializeIsolateAffinityTag);
958 buffer.write(
959 jsAst.prettyPrint(
960 nativeGenerator.generateDispatchPropertyNameInitialization(),
961 compiler, monitor: compiler.dumpInfoTask));
962 buffer.write(N);
963 }
964 955
965 jsAst.Expression currentScriptAccess = 956 jsAst.Expression currentScriptAccess =
966 generateEmbeddedGlobalAccess(embeddedNames.CURRENT_SCRIPT); 957 generateEmbeddedGlobalAccess(embeddedNames.CURRENT_SCRIPT);
967 958
968 addComment('BEGIN invoke [main].', buffer); 959 addComment('BEGIN invoke [main].', buffer);
969 // This code finds the currently executing script by listening to the 960 // This code finds the currently executing script by listening to the
970 // onload event of all script tags and getting the first script which 961 // onload event of all script tags and getting the first script which
971 // finishes. Since onload is called immediately after execution this should 962 // finishes. Since onload is called immediately after execution this should
972 // not substantially change execution order. 963 // not substantially change execution order.
973 jsAst.Statement invokeMain = js.statement(''' 964 jsAst.Statement invokeMain = js.statement('''
(...skipping 1065 matching lines...) Expand 10 before | Expand all | Expand 10 after
2039 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2030 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2040 if (element.isInstanceMember) { 2031 if (element.isInstanceMember) {
2041 cachedClassBuilders.remove(element.enclosingClass); 2032 cachedClassBuilders.remove(element.enclosingClass);
2042 2033
2043 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2034 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2044 2035
2045 } 2036 }
2046 } 2037 }
2047 } 2038 }
2048 } 2039 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/native_generator.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698