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

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

Issue 1273503002: dart2js: Add --fast-startup flag. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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 | « pkg/compiler/lib/src/js_backend/backend.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) 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 = 8 const USE_STARTUP_EMITTER =
Siggi Cherem (dart-lang) 2015/08/04 16:38:02 delete?
floitsch 2015/08/05 11:06:10 Done.
9 const bool.fromEnvironment("dart2js.use.startup.emitter"); 9 const bool.fromEnvironment("dart2js.use.startup.emitter");
10 10
11 /** 11 /**
12 * 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
13 * 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.
14 * 14 *
15 * 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`.
16 */ 16 */
17 class CodeEmitterTask extends CompilerTask { 17 class CodeEmitterTask extends CompilerTask {
18 // TODO(floitsch): the code-emitter task should not need a namer. 18 // TODO(floitsch): the code-emitter task should not need a namer.
19 final Namer namer; 19 final Namer namer;
20 final TypeTestRegistry typeTestRegistry; 20 final TypeTestRegistry typeTestRegistry;
21 NativeEmitter nativeEmitter; 21 NativeEmitter nativeEmitter;
22 MetadataCollector metadataCollector; 22 MetadataCollector metadataCollector;
23 Emitter emitter; 23 Emitter emitter;
24 24
25 /// Records if a type variable is read dynamically for type tests. 25 /// Records if a type variable is read dynamically for type tests.
26 final Set<TypeVariableElement> readTypeVariables = 26 final Set<TypeVariableElement> readTypeVariables =
27 new Set<TypeVariableElement>(); 27 new Set<TypeVariableElement>();
28 28
29 JavaScriptBackend get backend => compiler.backend; 29 JavaScriptBackend get backend => compiler.backend;
30 30
31 @deprecated 31 @deprecated
32 // This field should be removed. It's currently only needed for dump-info and 32 // This field should be removed. It's currently only needed for dump-info and
33 // tests. 33 // tests.
34 // The field is set after the program has been emitted. 34 // The field is set after the program has been emitted.
35 /// Contains a list of all classes that are emitted. 35 /// Contains a list of all classes that are emitted.
36 Set<ClassElement> neededClasses; 36 Set<ClassElement> neededClasses;
37 37
38 CodeEmitterTask(Compiler compiler, Namer namer, bool generateSourceMap) 38 CodeEmitterTask(Compiler compiler, Namer namer, bool generateSourceMap,
39 bool useStartupEmitter)
39 : super(compiler), 40 : super(compiler),
40 this.namer = namer, 41 this.namer = namer,
41 this.typeTestRegistry = new TypeTestRegistry(compiler) { 42 this.typeTestRegistry = new TypeTestRegistry(compiler) {
42 nativeEmitter = new NativeEmitter(this); 43 nativeEmitter = new NativeEmitter(this);
43 if (USE_LAZY_EMITTER) { 44 if (USE_LAZY_EMITTER) {
44 emitter = new lazy_js_emitter.Emitter(compiler, namer, nativeEmitter); 45 emitter = new lazy_js_emitter.Emitter(compiler, namer, nativeEmitter);
45 } else if (USE_STARTUP_EMITTER) { 46 } else if (useStartupEmitter) {
46 emitter = new startup_js_emitter.Emitter( 47 emitter = new startup_js_emitter.Emitter(
47 compiler, namer, nativeEmitter, generateSourceMap); 48 compiler, namer, nativeEmitter, generateSourceMap);
48 } else { 49 } else {
49 emitter = 50 emitter =
50 new full_js_emitter.Emitter(compiler, namer, generateSourceMap, this); 51 new full_js_emitter.Emitter(compiler, namer, generateSourceMap, this);
51 } 52 }
52 metadataCollector = new MetadataCollector(compiler, emitter); 53 metadataCollector = new MetadataCollector(compiler, emitter);
53 } 54 }
54 55
55 String get name => 'Code emitter'; 56 String get name => 'Code emitter';
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); 203 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant);
203 204
204 /// Returns the JS code for accessing the given [constant]. 205 /// Returns the JS code for accessing the given [constant].
205 jsAst.Expression constantReference(ConstantValue constant); 206 jsAst.Expression constantReference(ConstantValue constant);
206 207
207 /// Returns the JS template for the given [builtin]. 208 /// Returns the JS template for the given [builtin].
208 jsAst.Template templateForBuiltin(JsBuiltin builtin); 209 jsAst.Template templateForBuiltin(JsBuiltin builtin);
209 210
210 void invalidateCaches(); 211 void invalidateCaches();
211 } 212 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/backend.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698