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

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

Issue 1225293002: dart2js: add skeleton of startup-emitter. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Reupload Created 5 years, 5 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/js_emitter.dart » ('j') | 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) 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 dart2js.js_emitter; 5 part of dart2js.js_emitter;
6 6
7 const USE_LAZY_EMITTER = const bool.fromEnvironment("dart2js.use.lazy.emitter"); 7 const USE_LAZY_EMITTER = const bool.fromEnvironment("dart2js.use.lazy.emitter");
8 const USE_STARTUP_EMITTER =
9 const bool.fromEnvironment("dart2js.use.startup.emitter");
8 10
9 /** 11 /**
10 * Generates the code for all used classes in the program. Static fields (even 12 * Generates the code for all used classes in the program. Static fields (even
11 * in classes) are ignored, since they can be treated as non-class elements. 13 * in classes) are ignored, since they can be treated as non-class elements.
12 * 14 *
13 * The code for the containing (used) methods must exist in the `universe`. 15 * The code for the containing (used) methods must exist in the `universe`.
14 */ 16 */
15 class CodeEmitterTask extends CompilerTask { 17 class CodeEmitterTask extends CompilerTask {
16 // TODO(floitsch): the code-emitter task should not need a namer. 18 // TODO(floitsch): the code-emitter task should not need a namer.
17 final Namer namer; 19 final Namer namer;
(...skipping 13 matching lines...) Expand all
31 // tests. 33 // tests.
32 // The field is set after the program has been emitted. 34 // The field is set after the program has been emitted.
33 /// Contains a list of all classes that are emitted. 35 /// Contains a list of all classes that are emitted.
34 Set<ClassElement> neededClasses; 36 Set<ClassElement> neededClasses;
35 37
36 CodeEmitterTask(Compiler compiler, Namer namer, bool generateSourceMap) 38 CodeEmitterTask(Compiler compiler, Namer namer, bool generateSourceMap)
37 : super(compiler), 39 : super(compiler),
38 this.namer = namer, 40 this.namer = namer,
39 this.typeTestRegistry = new TypeTestRegistry(compiler) { 41 this.typeTestRegistry = new TypeTestRegistry(compiler) {
40 nativeEmitter = new NativeEmitter(this); 42 nativeEmitter = new NativeEmitter(this);
41 emitter = USE_LAZY_EMITTER 43 if (USE_LAZY_EMITTER) {
42 ? new lazy_js_emitter.Emitter(compiler, namer, nativeEmitter) 44 emitter = new lazy_js_emitter.Emitter(compiler, namer, nativeEmitter);
43 : new full_js_emitter.Emitter(compiler, namer, generateSourceMap, this); 45 } else if (USE_STARTUP_EMITTER) {
46 emitter = new startup_js_emitter.Emitter(compiler, namer, nativeEmitter);
47 } else {
48 emitter =
49 new full_js_emitter.Emitter(compiler, namer, generateSourceMap, this);
50 }
44 metadataCollector = new MetadataCollector(compiler, emitter); 51 metadataCollector = new MetadataCollector(compiler, emitter);
45 } 52 }
46 53
47 String get name => 'Code emitter'; 54 String get name => 'Code emitter';
48 55
49 /// Returns the closure expression of a static function. 56 /// Returns the closure expression of a static function.
50 jsAst.Expression isolateStaticClosureAccess(FunctionElement element) { 57 jsAst.Expression isolateStaticClosureAccess(FunctionElement element) {
51 return emitter.isolateStaticClosureAccess(element); 58 return emitter.isolateStaticClosureAccess(element);
52 } 59 }
53 60
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); 190 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant);
184 191
185 /// Returns the JS code for accessing the given [constant]. 192 /// Returns the JS code for accessing the given [constant].
186 jsAst.Expression constantReference(ConstantValue constant); 193 jsAst.Expression constantReference(ConstantValue constant);
187 194
188 /// Returns the JS template for the given [builtin]. 195 /// Returns the JS template for the given [builtin].
189 jsAst.Template templateForBuiltin(JsBuiltin builtin); 196 jsAst.Template templateForBuiltin(JsBuiltin builtin);
190 197
191 void invalidateCaches(); 198 void invalidateCaches();
192 } 199 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/js_emitter.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698