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