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

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

Issue 1223293002: dart2js: Rename old emitter to full emitter and make it its own library. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: 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
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 library dart2js.js_emitter.full_emitter;
6
7 import 'dart:convert';
8 import 'dart:collection' show HashMap;
9
10 import 'package:js_runtime/shared/embedded_names.dart' as embeddedNames;
11 import 'package:js_runtime/shared/embedded_names.dart' show JsBuiltin;
12
13 import '../js_emitter.dart' hide Emitter;
14 import '../js_emitter.dart' as js_emitter show Emitter;
15
16 import '../model.dart';
17 import '../program_builder/program_builder.dart';
18
19 import '../../common.dart';
20
21 import '../../constants/values.dart';
22
23 import '../../deferred_load.dart' show OutputUnit;
24
25 import '../../elements/elements.dart' show
26 ConstructorBodyElement,
27 ElementKind,
28 FieldElement,
29 ParameterElement,
30 TypeVariableElement,
31 MethodElement,
32 MemberElement;
33
34 import '../../hash/sha1.dart' show Hasher;
35
36 import '../../io/code_output.dart';
37
38 import '../../io/line_column_provider.dart' show
39 LineColumnCollector,
40 LineColumnProvider;
41
42 import '../../io/source_map_builder.dart' show
43 SourceMapBuilder;
44
45 import '../../js/js.dart' as jsAst;
46 import '../../js/js.dart' show js;
47
48 import '../../js_backend/js_backend.dart' show
49 CheckedModeHelper,
50 CompoundName,
51 ConstantEmitter,
52 CustomElementsAnalysis,
53 GetterName,
54 JavaScriptBackend,
55 JavaScriptConstantCompiler,
56 Namer,
57 RuntimeTypes,
58 SetterName,
59 Substitution,
60 TypeCheck,
61 TypeChecks,
62 TypeVariableHandler;
63
64 import '../../util/characters.dart' show
65 $$,
66 $A,
67 $HASH,
68 $PERIOD,
69 $Z,
70 $a,
71 $z;
72
73 import '../../util/uri_extras.dart' show
74 relativize;
75
76 import '../../util/util.dart' show
77 NO_LOCATION_SPANNABLE,
78 equalElements;
79
80 part 'class_builder.dart';
81 part 'class_emitter.dart';
82 part 'code_emitter_helper.dart';
83 part 'container_builder.dart';
84 part 'declarations.dart';
85 part 'deferred_output_unit_hash.dart';
86 part 'interceptor_emitter.dart';
87 part 'nsm_emitter.dart';
88 part 'setup_program_builder.dart';
6 89
7 90
8 class OldEmitter implements Emitter { 91 class Emitter implements js_emitter.Emitter {
9 final Compiler compiler; 92 final Compiler compiler;
10 final CodeEmitterTask task; 93 final CodeEmitterTask task;
11 94
12 // The following fields will be set to copies of the program-builder's 95 // The following fields will be set to copies of the program-builder's
13 // collector. 96 // collector.
14 Map<OutputUnit, List<VariableElement>> outputStaticNonFinalFieldLists; 97 Map<OutputUnit, List<VariableElement>> outputStaticNonFinalFieldLists;
15 Map<OutputUnit, Set<LibraryElement>> outputLibraryLists; 98 Map<OutputUnit, Set<LibraryElement>> outputLibraryLists;
16 List<TypedefElement> typedefsNeededForReflection; 99 List<TypedefElement> typedefsNeededForReflection;
17 100
18 final ContainerBuilder containerBuilder = new ContainerBuilder(); 101 final ContainerBuilder containerBuilder = new ContainerBuilder();
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 * 162 *
80 * See [getElementDescriptor]. 163 * See [getElementDescriptor].
81 */ 164 */
82 // TODO(ahe): Generate statics with their class, and store only libraries in 165 // TODO(ahe): Generate statics with their class, and store only libraries in
83 // this map. 166 // this map.
84 final Map<Fragment, Map<Element, ClassBuilder>> elementDescriptors = 167 final Map<Fragment, Map<Element, ClassBuilder>> elementDescriptors =
85 new Map<Fragment, Map<Element, ClassBuilder>>(); 168 new Map<Fragment, Map<Element, ClassBuilder>>();
86 169
87 final bool generateSourceMap; 170 final bool generateSourceMap;
88 171
89 OldEmitter(Compiler compiler, Namer namer, this.generateSourceMap, this.task) 172 Emitter(Compiler compiler, Namer namer, this.generateSourceMap, this.task)
90 : this.compiler = compiler, 173 : this.compiler = compiler,
91 this.namer = namer, 174 this.namer = namer,
92 cachedEmittedConstants = compiler.cacheStrategy.newSet(), 175 cachedEmittedConstants = compiler.cacheStrategy.newSet(),
93 cachedClassBuilders = compiler.cacheStrategy.newMap(), 176 cachedClassBuilders = compiler.cacheStrategy.newMap(),
94 cachedElements = compiler.cacheStrategy.newSet() { 177 cachedElements = compiler.cacheStrategy.newSet() {
95 constantEmitter = new ConstantEmitter( 178 constantEmitter = new ConstantEmitter(
96 compiler, namer, this.constantReference, constantListGenerator); 179 compiler, namer, this.constantReference, constantListGenerator);
97 containerBuilder.emitter = this; 180 containerBuilder.emitter = this;
98 classEmitter.emitter = this; 181 classEmitter.emitter = this;
99 nsmEmitter.emitter = this; 182 nsmEmitter.emitter = this;
(...skipping 1910 matching lines...) Expand 10 before | Expand all | Expand 10 after
2010 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) { 2093 for (Element element in compiler.enqueuer.codegen.newlyEnqueuedElements) {
2011 if (element.isInstanceMember) { 2094 if (element.isInstanceMember) {
2012 cachedClassBuilders.remove(element.enclosingClass); 2095 cachedClassBuilders.remove(element.enclosingClass);
2013 2096
2014 nativeEmitter.cachedBuilders.remove(element.enclosingClass); 2097 nativeEmitter.cachedBuilders.remove(element.enclosingClass);
2015 2098
2016 } 2099 }
2017 } 2100 }
2018 } 2101 }
2019 } 2102 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698