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

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

Issue 10633006: Process all resolver treeshaked elements in Dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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
« no previous file with comments | « no previous file | lib/compiler/implementation/dart_backend/backend.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 } finally { 226 } finally {
227 _currentElement = old; 227 _currentElement = old;
228 } 228 }
229 } 229 }
230 230
231 List<CompilerTask> tasks; 231 List<CompilerTask> tasks;
232 ScannerTask scanner; 232 ScannerTask scanner;
233 DietParserTask dietParser; 233 DietParserTask dietParser;
234 ParserTask parser; 234 ParserTask parser;
235 TreeValidatorTask validator; 235 TreeValidatorTask validator;
236 UnparseValidator unparseValidator;
237 ResolverTask resolver; 236 ResolverTask resolver;
238 TypeCheckerTask checker; 237 TypeCheckerTask checker;
239 Backend backend; 238 Backend backend;
240 ConstantHandler constantHandler; 239 ConstantHandler constantHandler;
241 EnqueueTask enqueuer; 240 EnqueueTask enqueuer;
242 241
243 static final SourceString MAIN = const SourceString('main'); 242 static final SourceString MAIN = const SourceString('main');
244 static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); 243 static final SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod');
245 static final SourceString NO_SUCH_METHOD_EXCEPTION = 244 static final SourceString NO_SUCH_METHOD_EXCEPTION =
246 const SourceString('NoSuchMethodException'); 245 const SourceString('NoSuchMethodException');
(...skipping 17 matching lines...) Expand all
264 generateSourceMap = true]) 263 generateSourceMap = true])
265 : libraries = new Map<String, LibraryElement>(), 264 : libraries = new Map<String, LibraryElement>(),
266 world = new World(), 265 world = new World(),
267 progress = new Stopwatch.start() { 266 progress = new Stopwatch.start() {
268 namer = new Namer(this); 267 namer = new Namer(this);
269 constantHandler = new ConstantHandler(this); 268 constantHandler = new ConstantHandler(this);
270 scanner = new ScannerTask(this); 269 scanner = new ScannerTask(this);
271 dietParser = new DietParserTask(this); 270 dietParser = new DietParserTask(this);
272 parser = new ParserTask(this); 271 parser = new ParserTask(this);
273 validator = new TreeValidatorTask(this); 272 validator = new TreeValidatorTask(this);
274 unparseValidator = new UnparseValidator(this, validateUnparse);
275 resolver = new ResolverTask(this); 273 resolver = new ResolverTask(this);
276 checker = new TypeCheckerTask(this); 274 checker = new TypeCheckerTask(this);
277 backend = emitJavascript ? 275 backend = emitJavascript ?
278 new JavaScriptBackend(this, generateSourceMap) : 276 new JavaScriptBackend(this, generateSourceMap) :
279 new dart_backend.DartBackend(this); 277 new dart_backend.DartBackend(this, validateUnparse);
280 enqueuer = new EnqueueTask(this); 278 enqueuer = new EnqueueTask(this);
281 tasks = [scanner, dietParser, parser, resolver, checker, 279 tasks = [scanner, dietParser, parser, resolver, checker,
282 unparseValidator, constantHandler, enqueuer]; 280 constantHandler, enqueuer];
283 tasks.addAll(backend.tasks); 281 tasks.addAll(backend.tasks);
284 } 282 }
285 283
286 Universe get resolverWorld() => enqueuer.resolution.universe; 284 Universe get resolverWorld() => enqueuer.resolution.universe;
287 Universe get codegenWorld() => enqueuer.codegen.universe; 285 Universe get codegenWorld() => enqueuer.codegen.universe;
288 286
289 int getNextFreeClassId() => nextFreeClassId++; 287 int getNextFreeClassId() => nextFreeClassId++;
290 288
291 void ensure(bool condition) { 289 void ensure(bool condition) {
292 if (!condition) cancel('failed assertion in leg'); 290 if (!condition) cancel('failed assertion in leg');
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
600 | ElementCategory.FACTORY; 598 | ElementCategory.FACTORY;
601 ElementKind kind = element.kind; 599 ElementKind kind = element.kind;
602 if (!element.isAccessor() && 600 if (!element.isAccessor() &&
603 ((kind === ElementKind.ABSTRACT_FIELD) || 601 ((kind === ElementKind.ABSTRACT_FIELD) ||
604 (kind.category & allowed) == 0)) { 602 (kind.category & allowed) == 0)) {
605 return null; 603 return null;
606 } 604 }
607 assert(parser !== null); 605 assert(parser !== null);
608 Node tree = parser.parse(element); 606 Node tree = parser.parse(element);
609 validator.validate(tree); 607 validator.validate(tree);
610 unparseValidator.check(element);
611 elements = resolver.resolve(element); 608 elements = resolver.resolve(element);
612 checker.check(tree, elements); 609 checker.check(tree, elements);
613 return elements; 610 return elements;
614 } 611 }
615 612
616 TreeElements analyze(WorkItem work, Enqueuer world) { 613 TreeElements analyze(WorkItem work, Enqueuer world) {
617 if (work.isAnalyzed()) return work.resolutionTree; 614 if (work.isAnalyzed()) return work.resolutionTree;
618 if (progress.elapsedInMs() > 500) { 615 if (progress.elapsedInMs() > 500) {
619 // TODO(ahe): Add structured diagnostics to the compiler API and 616 // TODO(ahe): Add structured diagnostics to the compiler API and
620 // use it to separate this from the --verbose option. 617 // use it to separate this from the --verbose option.
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
834 // invariant that endOffset > beginOffset, but for EOF the 831 // invariant that endOffset > beginOffset, but for EOF the
835 // charoffset of the next token may be [beginOffset]. This can 832 // charoffset of the next token may be [beginOffset]. This can
836 // also happen for synthetized tokens that are produced during 833 // also happen for synthetized tokens that are produced during
837 // error handling. 834 // error handling.
838 final endOffset = 835 final endOffset =
839 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1); 836 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1);
840 assert(endOffset > beginOffset); 837 assert(endOffset > beginOffset);
841 return f(beginOffset, endOffset); 838 return f(beginOffset, endOffset);
842 } 839 }
843 } 840 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/dart_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698