| 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 library dart2js.compiler_base; | 5 library dart2js.compiler_base; |
| 6 | 6 |
| 7 import 'dart:async' show Future; | 7 import 'dart:async' show Future; |
| 8 | 8 |
| 9 import '../compiler_new.dart' as api; | 9 import '../compiler_new.dart' as api; |
| 10 import 'backend_strategy.dart'; | 10 import 'backend_strategy.dart'; |
| (...skipping 592 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 globalInference.runGlobalTypeInference( | 603 globalInference.runGlobalTypeInference( |
| 604 mainFunction, closedWorld, closedWorldRefiner); | 604 mainFunction, closedWorld, closedWorldRefiner); |
| 605 | 605 |
| 606 if (stopAfterTypeInference) return; | 606 if (stopAfterTypeInference) return; |
| 607 | 607 |
| 608 backend.onTypeInferenceComplete(globalInference.results); | 608 backend.onTypeInferenceComplete(globalInference.results); |
| 609 | 609 |
| 610 reporter.log('Compiling...'); | 610 reporter.log('Compiling...'); |
| 611 phase = PHASE_COMPILING; | 611 phase = PHASE_COMPILING; |
| 612 | 612 |
| 613 Enqueuer codegenEnqueuer = startCodegen(closedWorld); | 613 Enqueuer codegenEnqueuer = enqueuer.createCodegenEnqueuer(closedWorld); |
| 614 _codegenWorldBuilder = codegenEnqueuer.worldBuilder; |
| 615 codegenEnqueuer.applyImpact( |
| 616 backend.onCodegenStart(closedWorld, _codegenWorldBuilder)); |
| 614 if (compileAll) { | 617 if (compileAll) { |
| 615 libraryLoader.libraries.forEach((LibraryEntity library) { | 618 libraryLoader.libraries.forEach((LibraryEntity library) { |
| 616 codegenEnqueuer.applyImpact(computeImpactForLibrary(library)); | 619 codegenEnqueuer.applyImpact(computeImpactForLibrary(library)); |
| 617 }); | 620 }); |
| 618 } | 621 } |
| 619 processQueue(closedWorld.elementEnvironment, codegenEnqueuer, | 622 processQueue(closedWorld.elementEnvironment, codegenEnqueuer, |
| 620 mainFunction, libraryLoader.libraries, | 623 mainFunction, libraryLoader.libraries, |
| 621 onProgress: showCodegenProgress); | 624 onProgress: showCodegenProgress); |
| 622 codegenEnqueuer.logSummary(reporter.log); | 625 codegenEnqueuer.logSummary(reporter.log); |
| 623 | 626 |
| 624 int programSize = backend.assembleProgram(closedWorld); | 627 int programSize = backend.assembleProgram(closedWorld); |
| 625 | 628 |
| 626 if (options.dumpInfo) { | 629 if (options.dumpInfo) { |
| 627 dumpInfoTask.reportSize(programSize); | 630 dumpInfoTask.reportSize(programSize); |
| 628 dumpInfoTask.dumpInfo(closedWorld); | 631 dumpInfoTask.dumpInfo(closedWorld); |
| 629 } | 632 } |
| 630 | 633 |
| 631 backend.onCodegenEnd(); | 634 backend.onCodegenEnd(); |
| 632 | 635 |
| 633 checkQueues(resolutionEnqueuer, codegenEnqueuer); | 636 checkQueues(resolutionEnqueuer, codegenEnqueuer); |
| 634 }); | 637 }); |
| 635 | 638 |
| 636 Enqueuer startCodegen(ClosedWorld closedWorld) { | |
| 637 Enqueuer codegenEnqueuer = enqueuer.createCodegenEnqueuer(closedWorld); | |
| 638 _codegenWorldBuilder = codegenEnqueuer.worldBuilder; | |
| 639 codegenEnqueuer | |
| 640 .applyImpact(backend.onCodegenStart(closedWorld, _codegenWorldBuilder)); | |
| 641 return codegenEnqueuer; | |
| 642 } | |
| 643 | |
| 644 /// Perform the steps needed to fully end the resolution phase. | 639 /// Perform the steps needed to fully end the resolution phase. |
| 645 ClosedWorldRefiner closeResolution() { | 640 ClosedWorldRefiner closeResolution() { |
| 646 phase = PHASE_DONE_RESOLVING; | 641 phase = PHASE_DONE_RESOLVING; |
| 647 | 642 |
| 648 ClosedWorld closedWorld = resolutionWorldBuilder.closeWorld(); | 643 ClosedWorld closedWorld = resolutionWorldBuilder.closeWorld(); |
| 649 ClosedWorldRefiner closedWorldRefiner = | 644 ClosedWorldRefiner closedWorldRefiner = |
| 650 backendStrategy.createClosedWorldRefiner(closedWorld); | 645 backendStrategy.createClosedWorldRefiner(closedWorld); |
| 651 // Compute whole-program-knowledge that the backend needs. (This might | 646 // Compute whole-program-knowledge that the backend needs. (This might |
| 652 // require the information computed in [world.closeWorld].) | 647 // require the information computed in [world.closeWorld].) |
| 653 backend.onResolutionClosedWorld(closedWorld, closedWorldRefiner); | 648 backend.onResolutionClosedWorld(closedWorld, closedWorldRefiner); |
| (...skipping 937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1591 _ElementScanner(this.scanner); | 1586 _ElementScanner(this.scanner); |
| 1592 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); | 1587 void scanLibrary(LibraryElement library) => scanner.scanLibrary(library); |
| 1593 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); | 1588 void scanUnit(CompilationUnitElement unit) => scanner.scan(unit); |
| 1594 } | 1589 } |
| 1595 | 1590 |
| 1596 class _EmptyEnvironment implements Environment { | 1591 class _EmptyEnvironment implements Environment { |
| 1597 const _EmptyEnvironment(); | 1592 const _EmptyEnvironment(); |
| 1598 | 1593 |
| 1599 String valueOf(String key) => null; | 1594 String valueOf(String key) => null; |
| 1600 } | 1595 } |
| OLD | NEW |