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

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

Issue 784843002: Move isolateStaticClosureAccess and isolateLazyInitializerAccess from namer to emitter. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 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) 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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 174
175 jsAst.Expression generateEmbeddedGlobalAccess(String global) { 175 jsAst.Expression generateEmbeddedGlobalAccess(String global) {
176 return js(generateEmbeddedGlobalAccessString(global)); 176 return js(generateEmbeddedGlobalAccessString(global));
177 } 177 }
178 178
179 String generateEmbeddedGlobalAccessString(String global) { 179 String generateEmbeddedGlobalAccessString(String global) {
180 // TODO(floitsch): don't use 'init' as global embedder storage. 180 // TODO(floitsch): don't use 'init' as global embedder storage.
181 return '$initName.$global'; 181 return '$initName.$global';
182 } 182 }
183 183
184 jsAst.Expression isolateLazyInitializerAccess(Element element) {
185 return jsAst.js('#.#', [namer.globalObjectFor(element),
186 namer.getLazyInitializerName(element)]);
187 }
188
189 jsAst.Expression isolateStaticClosureAccess(Element element) {
190 return jsAst.js('#.#()',
191 [namer.globalObjectFor(element), namer.getStaticClosureName(element)]);
192 }
193
184 jsAst.PropertyAccess globalPropertyAccess(Element element) { 194 jsAst.PropertyAccess globalPropertyAccess(Element element) {
185 String name = namer.getNameX(element); 195 String name = namer.getNameX(element);
186 jsAst.PropertyAccess pa = new jsAst.PropertyAccess.field( 196 jsAst.PropertyAccess pa = new jsAst.PropertyAccess.field(
187 new jsAst.VariableUse(namer.globalObjectFor(element)), 197 new jsAst.VariableUse(namer.globalObjectFor(element)),
188 name); 198 name);
189 return pa; 199 return pa;
190 } 200 }
191 201
192 jsAst.PropertyAccess staticFieldAccess(Element element) { 202 jsAst.PropertyAccess staticFieldAccess(Element element) {
193 return globalPropertyAccess(element); 203 return globalPropertyAccess(element);
(...skipping 862 matching lines...) Expand 10 before | Expand all | Expand 10 after
1056 }''', 1066 }''',
1057 [namer.isolateName, makeConstListProperty]), 1067 [namer.isolateName, makeConstListProperty]),
1058 compiler, monitor: compiler.dumpInfoTask)); 1068 compiler, monitor: compiler.dumpInfoTask));
1059 buffer.write(N); 1069 buffer.write(N);
1060 } 1070 }
1061 1071
1062 /// Returns the code equivalent to: 1072 /// Returns the code equivalent to:
1063 /// `function(args) { $.startRootIsolate(X.main$closure(), args); }` 1073 /// `function(args) { $.startRootIsolate(X.main$closure(), args); }`
1064 jsAst.Expression buildIsolateSetupClosure(Element appMain, 1074 jsAst.Expression buildIsolateSetupClosure(Element appMain,
1065 Element isolateMain) { 1075 Element isolateMain) {
1066 jsAst.Expression mainAccess = namer.isolateStaticClosureAccess(appMain); 1076 jsAst.Expression mainAccess = isolateStaticClosureAccess(appMain);
1067 // Since we pass the closurized version of the main method to 1077 // Since we pass the closurized version of the main method to
1068 // the isolate method, we must make sure that it exists. 1078 // the isolate method, we must make sure that it exists.
1069 return js('function(a){ #(#, a); }', 1079 return js('function(a){ #(#, a); }',
1070 [backend.emitter.staticFunctionAccess(isolateMain), mainAccess]); 1080 [backend.emitter.staticFunctionAccess(isolateMain), mainAccess]);
1071 } 1081 }
1072 1082
1073 /** 1083 /**
1074 * Emits code that sets the `isolateTag embedded global to a unique string. 1084 * Emits code that sets the `isolateTag embedded global to a unique string.
1075 */ 1085 */
1076 jsAst.Expression generateIsolateAffinityTagInitialization() { 1086 jsAst.Expression generateIsolateAffinityTagInitialization() {
(...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after
2093 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2103 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2094 if (element.isInstanceMember) { 2104 if (element.isInstanceMember) {
2095 cachedClassBuilders.remove(element.enclosingClass); 2105 cachedClassBuilders.remove(element.enclosingClass);
2096 2106
2097 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2107 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2098 2108
2099 } 2109 }
2100 } 2110 }
2101 } 2111 }
2102 } 2112 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_emitter/new_emitter/emitter.dart ('k') | pkg/compiler/lib/src/ssa/codegen.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698