Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 part of dart2js; | 5 part of dart2js; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * If true, print a warning for each method that was resolved, but not | 8 * If true, print a warning for each method that was resolved, but not |
| 9 * compiled. | 9 * compiled. |
| 10 */ | 10 */ |
| (...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 510 hasCrashed = true; | 510 hasCrashed = true; |
| 511 throw new CompilerCancelledException('The compiler crashed.'); | 511 throw new CompilerCancelledException('The compiler crashed.'); |
| 512 } on CompilerCancelledException catch (ex) { | 512 } on CompilerCancelledException catch (ex) { |
| 513 rethrow; | 513 rethrow; |
| 514 } on StackOverflowError catch (ex) { | 514 } on StackOverflowError catch (ex) { |
| 515 // We cannot report anything useful in this case, because we | 515 // We cannot report anything useful in this case, because we |
| 516 // do not have enough stack space. | 516 // do not have enough stack space. |
| 517 rethrow; | 517 rethrow; |
| 518 } catch (ex, s) { | 518 } catch (ex, s) { |
| 519 if (hasCrashed) rethrow; | 519 if (hasCrashed) rethrow; |
| 520 String message = 'The compiler crashed: ${tryToString(ex)}.'; | 520 // @lry debug |
| 521 String message = 'The compiler crashed: ${tryToString(ex)}.\n${ex.stackTra ce}'; | |
|
kasperl
2013/11/06 08:30:04
Long line.
lukas
2013/11/06 11:36:08
will be removed
| |
| 521 try { | 522 try { |
| 522 unhandledExceptionOnElement(element, s, message); | 523 unhandledExceptionOnElement(element, s, message); |
| 523 } catch (doubleFault) { | 524 } catch (doubleFault) { |
| 524 // Ignoring exceptions in exception handling. | 525 // Ignoring exceptions in exception handling. |
| 525 } | 526 } |
| 526 throw new CompilerCancelledException(message); | 527 throw new CompilerCancelledException(message); |
| 527 } finally { | 528 } finally { |
| 528 _currentElement = old; | 529 _currentElement = old; |
| 529 } | 530 } |
| 530 } | 531 } |
| 531 | 532 |
| 532 List<CompilerTask> tasks; | 533 List<CompilerTask> tasks; |
| 533 ScannerTask scanner; | 534 ScannerTask scanner; |
| 534 DietParserTask dietParser; | 535 DietParserTask dietParser; |
| 535 ParserTask parser; | 536 ParserTask parser; |
| 536 PatchParserTask patchParser; | 537 PatchParserTask patchParser; |
| 537 LibraryLoader libraryLoader; | 538 LibraryLoader libraryLoader; |
| 538 TreeValidatorTask validator; | 539 TreeValidatorTask validator; |
| 539 ResolverTask resolver; | 540 ResolverTask resolver; |
| 540 closureMapping.ClosureTask closureToClassMapper; | 541 closureMapping.ClosureTask closureToClassMapper; |
| 541 TypeCheckerTask checker; | 542 TypeCheckerTask checker; |
| 543 IrBuilderTask irBuilder; | |
| 542 ti.TypesTask typesTask; | 544 ti.TypesTask typesTask; |
| 543 Backend backend; | 545 Backend backend; |
| 544 ConstantHandler constantHandler; | 546 ConstantHandler constantHandler; |
| 545 EnqueueTask enqueuer; | 547 EnqueueTask enqueuer; |
| 546 DeferredLoadTask deferredLoadTask; | 548 DeferredLoadTask deferredLoadTask; |
| 547 MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask; | 549 MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask; |
| 548 String buildId; | 550 String buildId; |
| 549 | 551 |
| 550 static const String MAIN = 'main'; | 552 static const String MAIN = 'main'; |
| 551 static const String CALL_OPERATOR_NAME = 'call'; | 553 static const String CALL_OPERATOR_NAME = 'call'; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 644 | 646 |
| 645 tasks = [ | 647 tasks = [ |
| 646 libraryLoader = new LibraryLoaderTask(this), | 648 libraryLoader = new LibraryLoaderTask(this), |
| 647 scanner = new ScannerTask(this), | 649 scanner = new ScannerTask(this), |
| 648 dietParser = new DietParserTask(this), | 650 dietParser = new DietParserTask(this), |
| 649 parser = new ParserTask(this), | 651 parser = new ParserTask(this), |
| 650 patchParser = new PatchParserTask(this), | 652 patchParser = new PatchParserTask(this), |
| 651 resolver = new ResolverTask(this), | 653 resolver = new ResolverTask(this), |
| 652 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer), | 654 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer), |
| 653 checker = new TypeCheckerTask(this), | 655 checker = new TypeCheckerTask(this), |
| 656 irBuilder = new IrBuilderTask(this), | |
| 654 typesTask = new ti.TypesTask(this), | 657 typesTask = new ti.TypesTask(this), |
| 655 constantHandler = new ConstantHandler(this, backend.constantSystem), | 658 constantHandler = new ConstantHandler(this, backend.constantSystem), |
| 656 deferredLoadTask = new DeferredLoadTask(this), | 659 deferredLoadTask = new DeferredLoadTask(this), |
| 657 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 660 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
| 658 enqueuer = new EnqueueTask(this)]; | 661 enqueuer = new EnqueueTask(this)]; |
| 659 | 662 |
| 660 tasks.addAll(backend.tasks); | 663 tasks.addAll(backend.tasks); |
| 661 } | 664 } |
| 662 | 665 |
| 663 Universe get resolverWorld => enqueuer.resolution.universe; | 666 Universe get resolverWorld => enqueuer.resolution.universe; |
| (...skipping 430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1094 | 1097 |
| 1095 // TODO(ahe): Remove this line. Eventually, enqueuer.resolution | 1098 // TODO(ahe): Remove this line. Eventually, enqueuer.resolution |
| 1096 // should know this. | 1099 // should know this. |
| 1097 world.populate(); | 1100 world.populate(); |
| 1098 // Compute whole-program-knowledge that the backend needs. (This might | 1101 // Compute whole-program-knowledge that the backend needs. (This might |
| 1099 // require the information computed in [world.populate].) | 1102 // require the information computed in [world.populate].) |
| 1100 backend.onResolutionComplete(); | 1103 backend.onResolutionComplete(); |
| 1101 | 1104 |
| 1102 deferredLoadTask.onResolutionComplete(main); | 1105 deferredLoadTask.onResolutionComplete(main); |
| 1103 | 1106 |
| 1107 log('Building IR...'); | |
| 1108 irBuilder.buildNodes(); | |
| 1109 | |
| 1104 log('Inferring types...'); | 1110 log('Inferring types...'); |
| 1105 typesTask.onResolutionComplete(main); | 1111 typesTask.onResolutionComplete(main); |
| 1106 | 1112 |
| 1107 log('Compiling...'); | 1113 log('Compiling...'); |
| 1108 phase = PHASE_COMPILING; | 1114 phase = PHASE_COMPILING; |
| 1109 // TODO(johnniwinther): Move these to [CodegenEnqueuer]. | 1115 // TODO(johnniwinther): Move these to [CodegenEnqueuer]. |
| 1110 if (hasIsolateSupport()) { | 1116 if (hasIsolateSupport()) { |
| 1111 enqueuer.codegen.addToWorkList( | 1117 enqueuer.codegen.addToWorkList( |
| 1112 isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE)); | 1118 isolateHelperLibrary.find(Compiler.START_ROOT_ISOLATE)); |
| 1113 enqueuer.codegen.registerGetOfStaticFunction(mainApp.find(MAIN)); | 1119 enqueuer.codegen.registerGetOfStaticFunction(mainApp.find(MAIN)); |
| (...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1645 | 1651 |
| 1646 void close() {} | 1652 void close() {} |
| 1647 | 1653 |
| 1648 toString() => name; | 1654 toString() => name; |
| 1649 | 1655 |
| 1650 /// Convenience method for getting an [api.CompilerOutputProvider]. | 1656 /// Convenience method for getting an [api.CompilerOutputProvider]. |
| 1651 static NullSink outputProvider(String name, String extension) { | 1657 static NullSink outputProvider(String name, String extension) { |
| 1652 return new NullSink('$name.$extension'); | 1658 return new NullSink('$name.$extension'); |
| 1653 } | 1659 } |
| 1654 } | 1660 } |
| OLD | NEW |