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

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

Issue 869513003: dart2js: Move metadata from old_emitter to shared directory. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 10 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) 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_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter"); 7 const USE_NEW_EMITTER = const bool.fromEnvironment("dart2js.use.new.emitter");
8 8
9 /** 9 /**
10 * Generates the code for all used classes in the program. Static fields (even 10 * 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. 11 * in classes) are ignored, since they can be treated as non-class elements.
12 * 12 *
13 * The code for the containing (used) methods must exist in the [:universe:]. 13 * The code for the containing (used) methods must exist in the [:universe:].
14 */ 14 */
15 class CodeEmitterTask extends CompilerTask { 15 class CodeEmitterTask extends CompilerTask {
16 // TODO(floitsch): the code-emitter task should not need a namer. 16 // TODO(floitsch): the code-emitter task should not need a namer.
17 final Namer namer; 17 final Namer namer;
18 final TypeTestRegistry typeTestRegistry; 18 final TypeTestRegistry typeTestRegistry;
19 NativeEmitter nativeEmitter; 19 NativeEmitter nativeEmitter;
20 MetadataEmitter metadataEmitter;
20 OldEmitter oldEmitter; 21 OldEmitter oldEmitter;
21 Emitter emitter; 22 Emitter emitter;
22 23
23 final Set<ClassElement> neededClasses = new Set<ClassElement>(); 24 final Set<ClassElement> neededClasses = new Set<ClassElement>();
24 final Map<OutputUnit, List<ClassElement>> outputClassLists = 25 final Map<OutputUnit, List<ClassElement>> outputClassLists =
25 new Map<OutputUnit, List<ClassElement>>(); 26 new Map<OutputUnit, List<ClassElement>>();
26 final Map<OutputUnit, List<ConstantValue>> outputConstantLists = 27 final Map<OutputUnit, List<ConstantValue>> outputConstantLists =
27 new Map<OutputUnit, List<ConstantValue>>(); 28 new Map<OutputUnit, List<ConstantValue>>();
28 final Map<OutputUnit, List<Element>> outputStaticLists = 29 final Map<OutputUnit, List<Element>> outputStaticLists =
29 new Map<OutputUnit, List<Element>>(); 30 new Map<OutputUnit, List<Element>>();
(...skipping 19 matching lines...) Expand all
49 50
50 CodeEmitterTask(Compiler compiler, Namer namer, bool generateSourceMap) 51 CodeEmitterTask(Compiler compiler, Namer namer, bool generateSourceMap)
51 : super(compiler), 52 : super(compiler),
52 this.namer = namer, 53 this.namer = namer,
53 this.typeTestRegistry = new TypeTestRegistry(compiler) { 54 this.typeTestRegistry = new TypeTestRegistry(compiler) {
54 oldEmitter = new OldEmitter(compiler, namer, generateSourceMap, this); 55 oldEmitter = new OldEmitter(compiler, namer, generateSourceMap, this);
55 emitter = USE_NEW_EMITTER 56 emitter = USE_NEW_EMITTER
56 ? new new_js_emitter.Emitter(compiler, namer) 57 ? new new_js_emitter.Emitter(compiler, namer)
57 : oldEmitter; 58 : oldEmitter;
58 nativeEmitter = new NativeEmitter(this); 59 nativeEmitter = new NativeEmitter(this);
60 metadataEmitter = new MetadataEmitter();
61 metadataEmitter.emitter = oldEmitter;
floitsch 2015/01/29 14:36:30 I intend to update this in the next commit.
59 } 62 }
60 63
61 /// Returns the closure expression of a static function. 64 /// Returns the closure expression of a static function.
62 jsAst.Expression isolateStaticClosureAccess(FunctionElement element) { 65 jsAst.Expression isolateStaticClosureAccess(FunctionElement element) {
63 return emitter.isolateStaticClosureAccess(element); 66 return emitter.isolateStaticClosureAccess(element);
64 } 67 }
65 68
66 /// Returns the JS function that must be invoked to get the value of the 69 /// Returns the JS function that must be invoked to get the value of the
67 /// lazily initialized static. 70 /// lazily initialized static.
68 jsAst.Expression isolateLazyInitializerAccess(FieldElement element) { 71 jsAst.Expression isolateLazyInitializerAccess(FieldElement element) {
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 jsAst.Expression typeAccess(Element e); 458 jsAst.Expression typeAccess(Element e);
456 459
457 /// Returns the JS expression representing a function that returns 'null' 460 /// Returns the JS expression representing a function that returns 'null'
458 jsAst.Expression generateFunctionThatReturnsNull(); 461 jsAst.Expression generateFunctionThatReturnsNull();
459 462
460 int compareConstants(ConstantValue a, ConstantValue b); 463 int compareConstants(ConstantValue a, ConstantValue b);
461 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant); 464 bool isConstantInlinedOrAlreadyEmitted(ConstantValue constant);
462 465
463 void invalidateCaches(); 466 void invalidateCaches();
464 } 467 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698