| 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; |
| 77 | 78 |
| 78 Backend(this.compiler); | 79 Backend(this.compiler, |
| 79 | 80 [ConstantSystem constantSystem = DART_CONSTANT_SYSTEM]) |
| 80 /// The [ConstantSystem] used to interpret compile-time constants for this | 81 : this.constantSystem = constantSystem; |
| 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; | |
| 91 | 82 |
| 92 // Given a [FunctionElement], return a buffer with the code generated for it | 83 // Given a [FunctionElement], return a buffer with the code generated for it |
| 93 // or null if no code was generated. | 84 // or null if no code was generated. |
| 94 CodeBuffer codeOf(Element element) => null; | 85 CodeBuffer codeOf(Element element) => null; |
| 95 | 86 |
| 96 void initializeHelperClasses() {} | 87 void initializeHelperClasses() {} |
| 97 | 88 |
| 98 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements); | 89 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements); |
| 99 void codegen(CodegenWorkItem work); | 90 void codegen(CodegenWorkItem work); |
| 100 | 91 |
| (...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 568 ParserTask parser; | 559 ParserTask parser; |
| 569 PatchParserTask patchParser; | 560 PatchParserTask patchParser; |
| 570 LibraryLoader libraryLoader; | 561 LibraryLoader libraryLoader; |
| 571 TreeValidatorTask validator; | 562 TreeValidatorTask validator; |
| 572 ResolverTask resolver; | 563 ResolverTask resolver; |
| 573 closureMapping.ClosureTask closureToClassMapper; | 564 closureMapping.ClosureTask closureToClassMapper; |
| 574 TypeCheckerTask checker; | 565 TypeCheckerTask checker; |
| 575 IrBuilderTask irBuilder; | 566 IrBuilderTask irBuilder; |
| 576 ti.TypesTask typesTask; | 567 ti.TypesTask typesTask; |
| 577 Backend backend; | 568 Backend backend; |
| 578 | 569 ConstantHandler constantHandler; |
| 579 /// The constant environment for the frontend interpretation of compile-time | |
| 580 /// constants. | |
| 581 ConstantEnvironment constants; | |
| 582 | |
| 583 EnqueueTask enqueuer; | 570 EnqueueTask enqueuer; |
| 584 DeferredLoadTask deferredLoadTask; | 571 DeferredLoadTask deferredLoadTask; |
| 585 MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask; | 572 MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask; |
| 586 DumpInfoTask dumpInfoTask; | 573 DumpInfoTask dumpInfoTask; |
| 587 String buildId; | 574 String buildId; |
| 588 | 575 |
| 589 static const String MAIN = 'main'; | 576 static const String MAIN = 'main'; |
| 590 static const String CALL_OPERATOR_NAME = 'call'; | 577 static const String CALL_OPERATOR_NAME = 'call'; |
| 591 static const String NO_SUCH_METHOD = 'noSuchMethod'; | 578 static const String NO_SUCH_METHOD = 'noSuchMethod'; |
| 592 static const int NO_SUCH_METHOD_ARG_COUNT = 1; | 579 static const int NO_SUCH_METHOD_ARG_COUNT = 1; |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 | 672 |
| 686 // No-op in production mode. | 673 // No-op in production mode. |
| 687 validator = new TreeValidatorTask(this); | 674 validator = new TreeValidatorTask(this); |
| 688 | 675 |
| 689 tasks = [ | 676 tasks = [ |
| 690 libraryLoader = new LibraryLoaderTask(this), | 677 libraryLoader = new LibraryLoaderTask(this), |
| 691 scanner = new ScannerTask(this), | 678 scanner = new ScannerTask(this), |
| 692 dietParser = new DietParserTask(this), | 679 dietParser = new DietParserTask(this), |
| 693 parser = new ParserTask(this), | 680 parser = new ParserTask(this), |
| 694 patchParser = new PatchParserTask(this), | 681 patchParser = new PatchParserTask(this), |
| 695 resolver = new ResolverTask(this, backend.constantCompilerTask), | 682 resolver = new ResolverTask(this), |
| 696 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer), | 683 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer), |
| 697 checker = new TypeCheckerTask(this), | 684 checker = new TypeCheckerTask(this), |
| 698 irBuilder = new IrBuilderTask(this), | 685 irBuilder = new IrBuilderTask(this), |
| 699 typesTask = new ti.TypesTask(this), | 686 typesTask = new ti.TypesTask(this), |
| 700 constants = backend.constantCompilerTask, | 687 constantHandler = new ConstantHandler(this, backend.constantSystem), |
| 701 deferredLoadTask = new DeferredLoadTask(this), | 688 deferredLoadTask = new DeferredLoadTask(this), |
| 702 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), | 689 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), |
| 703 enqueuer = new EnqueueTask(this), | 690 enqueuer = new EnqueueTask(this), |
| 704 dumpInfoTask = new DumpInfoTask(this)]; | 691 dumpInfoTask = new DumpInfoTask(this)]; |
| 705 | 692 |
| 706 tasks.addAll(backend.tasks); | 693 tasks.addAll(backend.tasks); |
| 707 } | 694 } |
| 708 | 695 |
| 709 Universe get resolverWorld => enqueuer.resolution.universe; | 696 Universe get resolverWorld => enqueuer.resolution.universe; |
| 710 Universe get codegenWorld => enqueuer.codegen.universe; | 697 Universe get codegenWorld => enqueuer.codegen.universe; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 949 '$missingHelperClasses'); | 936 '$missingHelperClasses'); |
| 950 } | 937 } |
| 951 | 938 |
| 952 if (types == null) { | 939 if (types == null) { |
| 953 types = new Types(this, dynamicClass); | 940 types = new Types(this, dynamicClass); |
| 954 } | 941 } |
| 955 backend.initializeHelperClasses(); | 942 backend.initializeHelperClasses(); |
| 956 | 943 |
| 957 dynamicClass.ensureResolved(this); | 944 dynamicClass.ensureResolved(this); |
| 958 | 945 |
| 959 proxyConstant = | 946 proxyConstant = constantHandler.compileVariable( |
| 960 resolver.constantCompiler.compileConstant(coreLibrary.find('proxy')); | 947 coreLibrary.find('proxy'), isConst: true); |
| 961 } | 948 } |
| 962 | 949 |
| 963 Element _unnamedListConstructor; | 950 Element _unnamedListConstructor; |
| 964 Element get unnamedListConstructor { | 951 Element get unnamedListConstructor { |
| 965 if (_unnamedListConstructor != null) return _unnamedListConstructor; | 952 if (_unnamedListConstructor != null) return _unnamedListConstructor; |
| 966 Selector callConstructor = new Selector.callConstructor( | 953 Selector callConstructor = new Selector.callConstructor( |
| 967 "", listClass.getLibrary()); | 954 "", listClass.getLibrary()); |
| 968 return _unnamedListConstructor = | 955 return _unnamedListConstructor = |
| 969 listClass.lookupConstructor(callConstructor); | 956 listClass.lookupConstructor(callConstructor); |
| 970 } | 957 } |
| (...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1814 static NullSink outputProvider(String name, String extension) { | 1801 static NullSink outputProvider(String name, String extension) { |
| 1815 return new NullSink('$name.$extension'); | 1802 return new NullSink('$name.$extension'); |
| 1816 } | 1803 } |
| 1817 } | 1804 } |
| 1818 | 1805 |
| 1819 /// Information about suppressed warnings and hints for a given library. | 1806 /// Information about suppressed warnings and hints for a given library. |
| 1820 class SuppressionInfo { | 1807 class SuppressionInfo { |
| 1821 int warnings = 0; | 1808 int warnings = 0; |
| 1822 int hints = 0; | 1809 int hints = 0; |
| 1823 } | 1810 } |
| OLD | NEW |