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

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

Issue 10855125: Ensure supertypes are loaded safely. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 Stopwatch progress; 141 Stopwatch progress;
142 142
143 static final int PHASE_SCANNING = 0; 143 static final int PHASE_SCANNING = 0;
144 static final int PHASE_RESOLVING = 1; 144 static final int PHASE_RESOLVING = 1;
145 static final int PHASE_COMPILING = 2; 145 static final int PHASE_COMPILING = 2;
146 static final int PHASE_RECOMPILING = 3; 146 static final int PHASE_RECOMPILING = 3;
147 int phase; 147 int phase;
148 148
149 bool compilationFailed = false; 149 bool compilationFailed = false;
150 150
151 bool hasCrashed = false;
152
151 Compiler([this.tracer = const Tracer(), 153 Compiler([this.tracer = const Tracer(),
152 this.enableTypeAssertions = false, 154 this.enableTypeAssertions = false,
153 this.enableUserAssertions = false, 155 this.enableUserAssertions = false,
154 bool emitJavascript = true, 156 bool emitJavascript = true,
155 validateUnparse = false, 157 validateUnparse = false,
156 generateSourceMap = true]) 158 generateSourceMap = true])
157 : libraries = new Map<String, LibraryElement>(), 159 : libraries = new Map<String, LibraryElement>(),
158 world = new World(), 160 world = new World(),
159 progress = new Stopwatch.start() { 161 progress = new Stopwatch.start() {
160 namer = new Namer(this); 162 namer = new Namer(this);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 [Node node, Token token, HInstruction instruction, 198 [Node node, Token token, HInstruction instruction,
197 Element element]) { 199 Element element]) {
198 cancel('Internal error: $message', node, token, instruction, element); 200 cancel('Internal error: $message', node, token, instruction, element);
199 } 201 }
200 202
201 void internalErrorOnElement(Element element, String message) { 203 void internalErrorOnElement(Element element, String message) {
202 internalError(message, element: element); 204 internalError(message, element: element);
203 } 205 }
204 206
205 void unhandledExceptionOnElement(Element element) { 207 void unhandledExceptionOnElement(Element element) {
208 if (hasCrashed) return;
209 hasCrashed = true;
206 reportDiagnostic(spanFromElement(element), 210 reportDiagnostic(spanFromElement(element),
207 MessageKind.COMPILER_CRASHED.error().toString(), 211 MessageKind.COMPILER_CRASHED.error().toString(),
208 api.Diagnostic.CRASH); 212 api.Diagnostic.CRASH);
209 // TODO(ahe): Obtain the build ID. 213 // TODO(ahe): Obtain the build ID.
210 var buildId = 'build number could not be determined'; 214 var buildId = 'build number could not be determined';
211 print(MessageKind.PLEASE_REPORT_THE_CRASH.message([buildId])); 215 print(MessageKind.PLEASE_REPORT_THE_CRASH.message([buildId]));
212 } 216 }
213 217
214 void cancel([String reason, Node node, Token token, 218 void cancel([String reason, Node node, Token token,
215 HInstruction instruction, Element element]) { 219 HInstruction instruction, Element element]) {
(...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after
756 codegenWorld.addGeneratedCode(work, codeBuffer); 760 codegenWorld.addGeneratedCode(work, codeBuffer);
757 return codeBuffer.toString(); 761 return codeBuffer.toString();
758 } 762 }
759 } 763 }
760 764
761 void registerInstantiatedClass(ClassElement cls) { 765 void registerInstantiatedClass(ClassElement cls) {
762 enqueuer.resolution.registerInstantiatedClass(cls); 766 enqueuer.resolution.registerInstantiatedClass(cls);
763 enqueuer.codegen.registerInstantiatedClass(cls); 767 enqueuer.codegen.registerInstantiatedClass(cls);
764 } 768 }
765 769
766 void resolveClass(ClassElement element) {
767 withCurrentElement(element, () => resolver.resolveClass(element));
768 }
769
770 Type resolveTypeAnnotation(Element element, TypeAnnotation annotation) { 770 Type resolveTypeAnnotation(Element element, TypeAnnotation annotation) {
771 return resolver.resolveTypeAnnotation(element, annotation); 771 return resolver.resolveTypeAnnotation(element, annotation);
772 } 772 }
773 773
774 FunctionSignature resolveSignature(FunctionElement element) { 774 FunctionSignature resolveSignature(FunctionElement element) {
775 return withCurrentElement(element, 775 return withCurrentElement(element,
776 () => resolver.resolveSignature(element)); 776 () => resolver.resolveSignature(element));
777 } 777 }
778 778
779 FunctionSignature resolveFunctionExpression(Element element, 779 FunctionSignature resolveFunctionExpression(Element element,
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
946 final endOffset = end.charOffset + end.slowCharCount; 946 final endOffset = end.charOffset + end.slowCharCount;
947 947
948 // [begin] and [end] might be the same for the same empty token. This 948 // [begin] and [end] might be the same for the same empty token. This
949 // happens for instance when scanning '$$'. 949 // happens for instance when scanning '$$'.
950 assert(endOffset >= beginOffset); 950 assert(endOffset >= beginOffset);
951 return f(beginOffset, endOffset); 951 return f(beginOffset, endOffset);
952 } 952 }
953 953
954 String toString() => 'SourceSpan($uri, $begin, $end)'; 954 String toString() => 'SourceSpan($uri, $begin, $end)';
955 } 955 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698