| 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 | 67 |
| 68 class DeferredTask { | 68 class DeferredTask { |
| 69 final Element element; | 69 final Element element; |
| 70 final DeferredAction action; | 70 final DeferredAction action; |
| 71 | 71 |
| 72 DeferredTask(this.element, this.action); | 72 DeferredTask(this.element, this.action); |
| 73 } | 73 } |
| 74 | 74 |
| 75 abstract class Backend { | 75 abstract class Backend { |
| 76 final Compiler compiler; | 76 final Compiler compiler; |
| 77 final ConstantSystem constantSystem; | |
| 78 | 77 |
| 79 Backend(this.compiler, | 78 Backend(this.compiler); |
| 80 [ConstantSystem constantSystem = DART_CONSTANT_SYSTEM]) | 79 |
| 81 : this.constantSystem = constantSystem; | 80 /// The [ConstantSystem] used to interpret compile-time constants for this |
| 81 /// backend. |
| 82 ConstantSystem get constantSystem; |
| 83 |
| 84 /// The constant environment for the backend interpretation of compile-time |
| 85 /// constants. |
| 86 BackendConstantEnvironment get constants; |
| 87 |
| 88 /// The compiler task responsible for the compilation of constants for both |
| 89 /// the frontend and the backend. |
| 90 ConstantCompilerTask get constantCompilerTask; |
| 82 | 91 |
| 83 // Given a [FunctionElement], return a buffer with the code generated for it | 92 // Given a [FunctionElement], return a buffer with the code generated for it |
| 84 // or null if no code was generated. | 93 // or null if no code was generated. |
| 85 CodeBuffer codeOf(Element element) => null; | 94 CodeBuffer codeOf(Element element) => null; |
| 86 | 95 |
| 87 void initializeHelperClasses() {} | 96 void initializeHelperClasses() {} |
| 88 | 97 |
| 89 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements); | 98 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements); |
| 90 void codegen(CodegenWorkItem work); | 99 void codegen(CodegenWorkItem work); |
| 91 | 100 |
| (...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 550 ParserTask parser; | 559 ParserTask parser; |
| 551 PatchParserTask patchParser; | 560 PatchParserTask patchParser; |
| 552 LibraryLoader libraryLoader; | 561 LibraryLoader libraryLoader; |
| 553 TreeValidatorTask validator; | 562 TreeValidatorTask validator; |
| 554 ResolverTask resolver; | 563 ResolverTask resolver; |
| 555 closureMapping.ClosureTask closureToClassMapper; | 564 closureMapping.ClosureTask closureToClassMapper; |
| 556 TypeCheckerTask checker; | 565 TypeCheckerTask checker; |
| 557 IrBuilderTask irBuilder; | 566 IrBuilderTask irBuilder; |
| 558 ti.TypesTask typesTask; | 567 ti.TypesTask typesTask; |
| 559 Backend backend; | 568 Backend backend; |
| 560 ConstantHandler constantHandler; | 569 |
| 570 /// The constant environment for the frontend interpretation of compile-time |
| 571 /// constants. |
| 572 ConstantEnvironment constants; |
| 573 |
| 561 EnqueueTask enqueuer; | 574 EnqueueTask enqueuer; |
| 562 DeferredLoadTask deferredLoadTask; | 575 DeferredLoadTask deferredLoadTask; |
| 563 MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask; | 576 MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask; |
| 564 DumpInfoTask dumpInfoTask; | 577 DumpInfoTask dumpInfoTask; |
| 565 String buildId; | 578 String buildId; |
| 566 | 579 |
| 567 static const String MAIN = 'main'; | 580 static const String MAIN = 'main'; |
| 568 static const String CALL_OPERATOR_NAME = 'call'; | 581 static const String CALL_OPERATOR_NAME = 'call'; |
| 569 static const String NO_SUCH_METHOD = 'noSuchMethod'; | 582 static const String NO_SUCH_METHOD = 'noSuchMethod'; |
| 570 static const int NO_SUCH_METHOD_ARG_COUNT = 1; | 583 static const int NO_SUCH_METHOD_ARG_COUNT = 1; |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 662 | 675 |
| 663 // No-op in production mode. | 676 // No-op in production mode. |
| 664 validator = new TreeValidatorTask(this); | 677 validator = new TreeValidatorTask(this); |
| 665 | 678 |
| 666 tasks = [ | 679 tasks = [ |
| 667 libraryLoader = new LibraryLoaderTask(this), | 680 libraryLoader = new LibraryLoaderTask(this), |
| 668 scanner = new ScannerTask(this), | 681 scanner = new ScannerTask(this), |
| 669 dietParser = new DietParserTask(this), | 682 dietParser = new DietParserTask(this), |
| 670 parser = new ParserTask(this), | 683 parser = new ParserTask(this), |
| 671 patchParser = new PatchParserTask(this), | 684 patchParser = new PatchParserTask(this), |
| 672 resolver = new ResolverTask(this), | 685 resolver = new ResolverTask(this, backend.constantCompilerTask), |
| 673 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer), | 686 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer), |
| 674 checker = new TypeCheckerTask(this), | 687 checker = new TypeCheckerTask(this), |
| 675 irBuilder = new IrBuilderTask(this), | 688 irBuilder = new IrBuilderTask(this), |
| 676 typesTask = new ti.TypesTask(this), | 689 typesTask = new ti.TypesTask(this), |
| 677 constantHandler = new ConstantHandler(this, backend.constantSystem), | 690 constants = backend.constantCompilerTask, |
| 678 deferredLoadTask = new DeferredLoadTask(this), | 691 deferredLoadTask = new DeferredLoadTask(this), |
| 679 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 692 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
| 680 enqueuer = new EnqueueTask(this), | 693 enqueuer = new EnqueueTask(this), |
| 681 dumpInfoTask = new DumpInfoTask(this)]; | 694 dumpInfoTask = new DumpInfoTask(this)]; |
| 682 | 695 |
| 683 tasks.addAll(backend.tasks); | 696 tasks.addAll(backend.tasks); |
| 684 } | 697 } |
| 685 | 698 |
| 686 Universe get resolverWorld => enqueuer.resolution.universe; | 699 Universe get resolverWorld => enqueuer.resolution.universe; |
| 687 Universe get codegenWorld => enqueuer.codegen.universe; | 700 Universe get codegenWorld => enqueuer.codegen.universe; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 926 '$missingHelperClasses'); | 939 '$missingHelperClasses'); |
| 927 } | 940 } |
| 928 | 941 |
| 929 if (types == null) { | 942 if (types == null) { |
| 930 types = new Types(this, dynamicClass); | 943 types = new Types(this, dynamicClass); |
| 931 } | 944 } |
| 932 backend.initializeHelperClasses(); | 945 backend.initializeHelperClasses(); |
| 933 | 946 |
| 934 dynamicClass.ensureResolved(this); | 947 dynamicClass.ensureResolved(this); |
| 935 | 948 |
| 936 proxyConstant = constantHandler.compileVariable( | 949 proxyConstant = |
| 937 coreLibrary.find('proxy'), isConst: true); | 950 resolver.constantCompiler.compileConstant(coreLibrary.find('proxy')); |
| 938 } | 951 } |
| 939 | 952 |
| 940 Element _unnamedListConstructor; | 953 Element _unnamedListConstructor; |
| 941 Element get unnamedListConstructor { | 954 Element get unnamedListConstructor { |
| 942 if (_unnamedListConstructor != null) return _unnamedListConstructor; | 955 if (_unnamedListConstructor != null) return _unnamedListConstructor; |
| 943 Selector callConstructor = new Selector.callConstructor( | 956 Selector callConstructor = new Selector.callConstructor( |
| 944 "", listClass.getLibrary()); | 957 "", listClass.getLibrary()); |
| 945 return _unnamedListConstructor = | 958 return _unnamedListConstructor = |
| 946 listClass.lookupConstructor(callConstructor); | 959 listClass.lookupConstructor(callConstructor); |
| 947 } | 960 } |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1791 static NullSink outputProvider(String name, String extension) { | 1804 static NullSink outputProvider(String name, String extension) { |
| 1792 return new NullSink('$name.$extension'); | 1805 return new NullSink('$name.$extension'); |
| 1793 } | 1806 } |
| 1794 } | 1807 } |
| 1795 | 1808 |
| 1796 /// Information about suppressed warnings and hints for a given library. | 1809 /// Information about suppressed warnings and hints for a given library. |
| 1797 class SuppressionInfo { | 1810 class SuppressionInfo { |
| 1798 int warnings = 0; | 1811 int warnings = 0; |
| 1799 int hints = 0; | 1812 int hints = 0; |
| 1800 } | 1813 } |
| OLD | NEW |