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

Side by Side Diff: lib/compiler/implementation/compiler.dart

Issue 10827180: Move types out of the HInstructions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Cosmetic change (updated comment). Created 8 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 | 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 5
6 /** 6 /**
7 * If true, print a warning for each method that was resolved, but not 7 * If true, print a warning for each method that was resolved, but not
8 * compiled. 8 * compiled.
9 */ 9 */
10 final bool REPORT_EXCESS_RESOLUTION = false; 10 final bool REPORT_EXCESS_RESOLUTION = false;
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 if (e.isFunction()) world.addToWorkList(e); 42 if (e.isFunction()) world.addToWorkList(e);
43 }); 43 });
44 } 44 }
45 45
46 abstract void enqueueHelpers(Enqueuer world); 46 abstract void enqueueHelpers(Enqueuer world);
47 abstract CodeBuffer codegen(WorkItem work); 47 abstract CodeBuffer codegen(WorkItem work);
48 abstract void processNativeClasses(Enqueuer world, 48 abstract void processNativeClasses(Enqueuer world,
49 Collection<LibraryElement> libraries); 49 Collection<LibraryElement> libraries);
50 abstract void assembleProgram(); 50 abstract void assembleProgram();
51 abstract List<CompilerTask> get tasks(); 51 abstract List<CompilerTask> get tasks();
52
53 WorkItem createWorkItem(Element element, TreeElements elements) {
54 return new WorkItem(element, elements);
55 }
56 }
57
58 class JavaScriptWorkItem extends WorkItem {
59 HTypeMap types;
60
61 JavaScriptWorkItem(Element element, TreeElements elements)
62 : types = new HTypeMap(),
63 super(element, elements);
52 } 64 }
53 65
54 class JavaScriptBackend extends Backend { 66 class JavaScriptBackend extends Backend {
55 SsaBuilderTask builder; 67 SsaBuilderTask builder;
56 SsaOptimizerTask optimizer; 68 SsaOptimizerTask optimizer;
57 SsaCodeGeneratorTask generator; 69 SsaCodeGeneratorTask generator;
58 CodeEmitterTask emitter; 70 CodeEmitterTask emitter;
59 final Map<Element, Map<Element, HType>> fieldInitializers; 71 final Map<Element, Map<Element, HType>> fieldInitializers;
60 final Map<Element, Map<Element, HType>> fieldConstructorSetters; 72 final Map<Element, Map<Element, HType>> fieldConstructorSetters;
61 final Map<Element, Map<Element, HType>> fieldSettersType; 73 final Map<Element, Map<Element, HType>> fieldSettersType;
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
197 HType fieldSettersTypeSoFar(Element field) { 209 HType fieldSettersTypeSoFar(Element field) {
198 assert(field.isField()); 210 assert(field.isField());
199 assert(field.enclosingElement.isClass()); 211 assert(field.enclosingElement.isClass());
200 if (!fieldSettersType.containsKey(field.enclosingElement)) { 212 if (!fieldSettersType.containsKey(field.enclosingElement)) {
201 return HType.CONFLICTING; 213 return HType.CONFLICTING;
202 } 214 }
203 Map<Element, HType> fields = fieldSettersType[field.enclosingElement]; 215 Map<Element, HType> fields = fieldSettersType[field.enclosingElement];
204 if (!fields.containsKey(field)) return HType.CONFLICTING; 216 if (!fields.containsKey(field)) return HType.CONFLICTING;
205 return fields[field]; 217 return fields[field];
206 } 218 }
219
220 JavaScriptWorkItem createWorkItem(Element element, TreeElements elements) {
221 return new JavaScriptWorkItem(element, elements);
222 }
207 } 223 }
208 224
209 class Compiler implements DiagnosticListener { 225 class Compiler implements DiagnosticListener {
210 final Map<String, LibraryElement> libraries; 226 final Map<String, LibraryElement> libraries;
211 int nextFreeClassId = 0; 227 int nextFreeClassId = 0;
212 World world; 228 World world;
213 String assembledCode; 229 String assembledCode;
214 Namer namer; 230 Namer namer;
215 Types types; 231 Types types;
216 final bool enableTypeAssertions; 232 final bool enableTypeAssertions;
(...skipping 848 matching lines...) Expand 10 before | Expand all | Expand 10 after
1065 String banner = 'compiler cancelled'; 1081 String banner = 'compiler cancelled';
1066 return (reason !== null) ? '$banner: $reason' : '$banner'; 1082 return (reason !== null) ? '$banner: $reason' : '$banner';
1067 } 1083 }
1068 } 1084 }
1069 1085
1070 class Tracer { 1086 class Tracer {
1071 final bool enabled = false; 1087 final bool enabled = false;
1072 1088
1073 const Tracer(); 1089 const Tracer();
1074 1090
1075 void traceCompilation(String methodName) { 1091 void traceCompilation(String methodName, WorkItem work) {
1076 } 1092 }
1077 1093
1078 void traceGraph(String name, var graph) { 1094 void traceGraph(String name, var graph) {
1079 } 1095 }
1080 1096
1081 void close() { 1097 void close() {
1082 } 1098 }
1083 } 1099 }
1084 1100
1085 class SourceSpan { 1101 class SourceSpan {
1086 final Uri uri; 1102 final Uri uri;
1087 final int begin; 1103 final int begin;
1088 final int end; 1104 final int end;
1089 1105
1090 const SourceSpan(this.uri, this.begin, this.end); 1106 const SourceSpan(this.uri, this.begin, this.end);
1091 1107
1092 static withCharacterOffsets(Token begin, Token end, 1108 static withCharacterOffsets(Token begin, Token end,
1093 f(int beginOffset, int endOffset)) { 1109 f(int beginOffset, int endOffset)) {
1094 final beginOffset = begin.charOffset; 1110 final beginOffset = begin.charOffset;
1095 final endOffset = end.charOffset + end.slowCharCount; 1111 final endOffset = end.charOffset + end.slowCharCount;
1096 1112
1097 // [begin] and [end] might be the same for the same empty token. This 1113 // [begin] and [end] might be the same for the same empty token. This
1098 // happens for instance when scanning '$$'. 1114 // happens for instance when scanning '$$'.
1099 assert(endOffset >= beginOffset); 1115 assert(endOffset >= beginOffset);
1100 return f(beginOffset, endOffset); 1116 return f(beginOffset, endOffset);
1101 } 1117 }
1102 1118
1103 String toString() => 'SourceSpan($uri, $begin, $end)'; 1119 String toString() => 'SourceSpan($uri, $begin, $end)';
1104 } 1120 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/enqueue.dart » ('j') | lib/compiler/implementation/enqueue.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698