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

Side by Side Diff: pkg/compiler/lib/src/common/codegen.dart

Issue 2603263002: Prefix resolution_types with Resolution. (Closed)
Patch Set: Rebased Created 3 years, 11 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) 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 library dart2js.common.codegen; 5 library dart2js.common.codegen;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/backend_api.dart' show Backend; 8 import '../common/backend_api.dart' show Backend;
9 import '../constants/values.dart' show ConstantValue; 9 import '../constants/values.dart' show ConstantValue;
10 import '../elements/resolution_types.dart' show DartType, InterfaceType; 10 import '../elements/resolution_types.dart'
11 show ResolutionDartType, ResolutionInterfaceType;
11 import '../elements/elements.dart' 12 import '../elements/elements.dart'
12 show 13 show
13 AstElement, 14 AstElement,
14 ClassElement, 15 ClassElement,
15 Element, 16 Element,
16 FunctionElement, 17 FunctionElement,
17 LocalFunctionElement, 18 LocalFunctionElement,
18 ResolvedAst; 19 ResolvedAst;
19 import '../enqueue.dart' show Enqueuer; 20 import '../enqueue.dart' show Enqueuer;
20 import '../universe/use.dart' show DynamicUse, StaticUse, TypeUse; 21 import '../universe/use.dart' show DynamicUse, StaticUse, TypeUse;
21 import '../universe/world_impact.dart' 22 import '../universe/world_impact.dart'
22 show WorldImpact, WorldImpactBuilderImpl, WorldImpactVisitor; 23 show WorldImpact, WorldImpactBuilderImpl, WorldImpactVisitor;
23 import '../util/util.dart' show Pair, Setlet; 24 import '../util/util.dart' show Pair, Setlet;
24 import 'work.dart' show WorkItem; 25 import 'work.dart' show WorkItem;
25 26
26 class CodegenImpact extends WorldImpact { 27 class CodegenImpact extends WorldImpact {
27 const CodegenImpact(); 28 const CodegenImpact();
28 29
29 Iterable<ConstantValue> get compileTimeConstants => const <ConstantValue>[]; 30 Iterable<ConstantValue> get compileTimeConstants => const <ConstantValue>[];
30 31
31 Iterable<Pair<DartType, DartType>> get typeVariableBoundsSubtypeChecks { 32 Iterable<Pair<ResolutionDartType, ResolutionDartType>>
32 return const <Pair<DartType, DartType>>[]; 33 get typeVariableBoundsSubtypeChecks {
34 return const <Pair<ResolutionDartType, ResolutionDartType>>[];
33 } 35 }
34 36
35 Iterable<String> get constSymbols => const <String>[]; 37 Iterable<String> get constSymbols => const <String>[];
36 38
37 Iterable<Set<ClassElement>> get specializedGetInterceptors { 39 Iterable<Set<ClassElement>> get specializedGetInterceptors {
38 return const <Set<ClassElement>>[]; 40 return const <Set<ClassElement>>[];
39 } 41 }
40 42
41 bool get usesInterceptor => false; 43 bool get usesInterceptor => false;
42 44
43 Iterable<ClassElement> get typeConstants => const <ClassElement>[]; 45 Iterable<ClassElement> get typeConstants => const <ClassElement>[];
44 46
45 Iterable<Element> get asyncMarkers => const <FunctionElement>[]; 47 Iterable<Element> get asyncMarkers => const <FunctionElement>[];
46 } 48 }
47 49
48 class _CodegenImpact extends WorldImpactBuilderImpl implements CodegenImpact { 50 class _CodegenImpact extends WorldImpactBuilderImpl implements CodegenImpact {
49 Setlet<ConstantValue> _compileTimeConstants; 51 Setlet<ConstantValue> _compileTimeConstants;
50 Setlet<Pair<DartType, DartType>> _typeVariableBoundsSubtypeChecks; 52 Setlet<Pair<ResolutionDartType, ResolutionDartType>>
53 _typeVariableBoundsSubtypeChecks;
51 Setlet<String> _constSymbols; 54 Setlet<String> _constSymbols;
52 List<Set<ClassElement>> _specializedGetInterceptors; 55 List<Set<ClassElement>> _specializedGetInterceptors;
53 bool _usesInterceptor = false; 56 bool _usesInterceptor = false;
54 Setlet<ClassElement> _typeConstants; 57 Setlet<ClassElement> _typeConstants;
55 Setlet<FunctionElement> _asyncMarkers; 58 Setlet<FunctionElement> _asyncMarkers;
56 59
57 _CodegenImpact(); 60 _CodegenImpact();
58 61
59 void apply(WorldImpactVisitor visitor) { 62 void apply(WorldImpactVisitor visitor) {
60 staticUses.forEach(visitor.visitStaticUse); 63 staticUses.forEach(visitor.visitStaticUse);
61 dynamicUses.forEach(visitor.visitDynamicUse); 64 dynamicUses.forEach(visitor.visitDynamicUse);
62 typeUses.forEach(visitor.visitTypeUse); 65 typeUses.forEach(visitor.visitTypeUse);
63 } 66 }
64 67
65 void registerCompileTimeConstant(ConstantValue constant) { 68 void registerCompileTimeConstant(ConstantValue constant) {
66 if (_compileTimeConstants == null) { 69 if (_compileTimeConstants == null) {
67 _compileTimeConstants = new Setlet<ConstantValue>(); 70 _compileTimeConstants = new Setlet<ConstantValue>();
68 } 71 }
69 _compileTimeConstants.add(constant); 72 _compileTimeConstants.add(constant);
70 } 73 }
71 74
72 Iterable<ConstantValue> get compileTimeConstants { 75 Iterable<ConstantValue> get compileTimeConstants {
73 return _compileTimeConstants != null 76 return _compileTimeConstants != null
74 ? _compileTimeConstants 77 ? _compileTimeConstants
75 : const <ConstantValue>[]; 78 : const <ConstantValue>[];
76 } 79 }
77 80
78 void registerTypeVariableBoundsSubtypeCheck( 81 void registerTypeVariableBoundsSubtypeCheck(
79 DartType subtype, DartType supertype) { 82 ResolutionDartType subtype, ResolutionDartType supertype) {
80 if (_typeVariableBoundsSubtypeChecks == null) { 83 if (_typeVariableBoundsSubtypeChecks == null) {
81 _typeVariableBoundsSubtypeChecks = new Setlet<Pair<DartType, DartType>>(); 84 _typeVariableBoundsSubtypeChecks =
85 new Setlet<Pair<ResolutionDartType, ResolutionDartType>>();
82 } 86 }
83 _typeVariableBoundsSubtypeChecks 87 _typeVariableBoundsSubtypeChecks.add(
84 .add(new Pair<DartType, DartType>(subtype, supertype)); 88 new Pair<ResolutionDartType, ResolutionDartType>(subtype, supertype));
85 } 89 }
86 90
87 Iterable<Pair<DartType, DartType>> get typeVariableBoundsSubtypeChecks { 91 Iterable<Pair<ResolutionDartType, ResolutionDartType>>
92 get typeVariableBoundsSubtypeChecks {
88 return _typeVariableBoundsSubtypeChecks != null 93 return _typeVariableBoundsSubtypeChecks != null
89 ? _typeVariableBoundsSubtypeChecks 94 ? _typeVariableBoundsSubtypeChecks
90 : const <Pair<DartType, DartType>>[]; 95 : const <Pair<ResolutionDartType, ResolutionDartType>>[];
91 } 96 }
92 97
93 void registerConstSymbol(String name) { 98 void registerConstSymbol(String name) {
94 if (_constSymbols == null) { 99 if (_constSymbols == null) {
95 _constSymbols = new Setlet<String>(); 100 _constSymbols = new Setlet<String>();
96 } 101 }
97 _constSymbols.add(name); 102 _constSymbols.add(name);
98 } 103 }
99 104
100 Iterable<String> get constSymbols { 105 Iterable<String> get constSymbols {
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 182
178 void registerTypeUse(TypeUse typeUse) { 183 void registerTypeUse(TypeUse typeUse) {
179 worldImpact.registerTypeUse(typeUse); 184 worldImpact.registerTypeUse(typeUse);
180 } 185 }
181 186
182 void registerCompileTimeConstant(ConstantValue constant) { 187 void registerCompileTimeConstant(ConstantValue constant) {
183 worldImpact.registerCompileTimeConstant(constant); 188 worldImpact.registerCompileTimeConstant(constant);
184 } 189 }
185 190
186 void registerTypeVariableBoundsSubtypeCheck( 191 void registerTypeVariableBoundsSubtypeCheck(
187 DartType subtype, DartType supertype) { 192 ResolutionDartType subtype, ResolutionDartType supertype) {
188 worldImpact.registerTypeVariableBoundsSubtypeCheck(subtype, supertype); 193 worldImpact.registerTypeVariableBoundsSubtypeCheck(subtype, supertype);
189 } 194 }
190 195
191 void registerInstantiatedClosure(LocalFunctionElement element) { 196 void registerInstantiatedClosure(LocalFunctionElement element) {
192 worldImpact.registerStaticUse(new StaticUse.closure(element)); 197 worldImpact.registerStaticUse(new StaticUse.closure(element));
193 } 198 }
194 199
195 void registerConstSymbol(String name) { 200 void registerConstSymbol(String name) {
196 worldImpact.registerConstSymbol(name); 201 worldImpact.registerConstSymbol(name);
197 } 202 }
198 203
199 void registerSpecializedGetInterceptor(Set<ClassElement> classes) { 204 void registerSpecializedGetInterceptor(Set<ClassElement> classes) {
200 worldImpact.registerSpecializedGetInterceptor(classes); 205 worldImpact.registerSpecializedGetInterceptor(classes);
201 } 206 }
202 207
203 void registerUseInterceptor() { 208 void registerUseInterceptor() {
204 worldImpact.registerUseInterceptor(); 209 worldImpact.registerUseInterceptor();
205 } 210 }
206 211
207 void registerTypeConstant(ClassElement element) { 212 void registerTypeConstant(ClassElement element) {
208 worldImpact.registerTypeConstant(element); 213 worldImpact.registerTypeConstant(element);
209 } 214 }
210 215
211 void registerInstantiation(InterfaceType type) { 216 void registerInstantiation(ResolutionInterfaceType type) {
212 registerTypeUse(new TypeUse.instantiation(type)); 217 registerTypeUse(new TypeUse.instantiation(type));
213 } 218 }
214 219
215 void registerAsyncMarker(FunctionElement element) { 220 void registerAsyncMarker(FunctionElement element) {
216 worldImpact.registerAsyncMarker(element); 221 worldImpact.registerAsyncMarker(element);
217 } 222 }
218 } 223 }
219 224
220 /// [WorkItem] used exclusively by the [CodegenEnqueuer]. 225 /// [WorkItem] used exclusively by the [CodegenEnqueuer].
221 class CodegenWorkItem extends WorkItem { 226 class CodegenWorkItem extends WorkItem {
(...skipping 16 matching lines...) Expand all
238 : this.resolvedAst = resolvedAst, 243 : this.resolvedAst = resolvedAst,
239 super(resolvedAst.element); 244 super(resolvedAst.element);
240 245
241 WorldImpact run() { 246 WorldImpact run() {
242 registry = new CodegenRegistry(element); 247 registry = new CodegenRegistry(element);
243 return backend.codegen(this); 248 return backend.codegen(this);
244 } 249 }
245 250
246 String toString() => 'CodegenWorkItem(${resolvedAst.element})'; 251 String toString() => 'CodegenWorkItem(${resolvedAst.element})';
247 } 252 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/common/backend_api.dart ('k') | pkg/compiler/lib/src/common/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698