Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(127)

Side by Side Diff: sdk/lib/_internal/compiler/implementation/compiler.dart

Issue 221873002: Compute frontend/backend specific constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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);
floitsch 2014/04/02 16:50:02 Add comments what and when they are used. Are they
Johnni Winther 2014/04/07 11:42:27 Done.
80 [ConstantSystem constantSystem = DART_CONSTANT_SYSTEM]) 79
81 : this.constantSystem = constantSystem; 80 ConstantSystem get constantSystem;
81
82 BackendConstantHandler get constantHandler;
83
84 ConstantCompiler get constantCompiler;
82 85
83 // Given a [FunctionElement], return a buffer with the code generated for it 86 // Given a [FunctionElement], return a buffer with the code generated for it
84 // or null if no code was generated. 87 // or null if no code was generated.
85 CodeBuffer codeOf(Element element) => null; 88 CodeBuffer codeOf(Element element) => null;
86 89
87 void initializeHelperClasses() {} 90 void initializeHelperClasses() {}
88 91
89 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements); 92 void enqueueHelpers(ResolutionEnqueuer world, TreeElements elements);
90 void codegen(CodegenWorkItem work); 93 void codegen(CodegenWorkItem work);
91 94
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
662 665
663 // No-op in production mode. 666 // No-op in production mode.
664 validator = new TreeValidatorTask(this); 667 validator = new TreeValidatorTask(this);
665 668
666 tasks = [ 669 tasks = [
667 libraryLoader = new LibraryLoaderTask(this), 670 libraryLoader = new LibraryLoaderTask(this),
668 scanner = new ScannerTask(this), 671 scanner = new ScannerTask(this),
669 dietParser = new DietParserTask(this), 672 dietParser = new DietParserTask(this),
670 parser = new ParserTask(this), 673 parser = new ParserTask(this),
671 patchParser = new PatchParserTask(this), 674 patchParser = new PatchParserTask(this),
672 resolver = new ResolverTask(this), 675 resolver = new ResolverTask(this, backend.constantCompiler),
673 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer), 676 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer),
674 checker = new TypeCheckerTask(this), 677 checker = new TypeCheckerTask(this),
675 irBuilder = new IrBuilderTask(this), 678 irBuilder = new IrBuilderTask(this),
676 typesTask = new ti.TypesTask(this), 679 typesTask = new ti.TypesTask(this),
677 constantHandler = new ConstantHandler(this, backend.constantSystem), 680 constantHandler = backend.constantCompiler,
floitsch 2014/04/02 16:50:02 It feels wrong (when reading) to assign a compiler
Johnni Winther 2014/04/07 11:42:27 Done.
678 deferredLoadTask = new DeferredLoadTask(this), 681 deferredLoadTask = new DeferredLoadTask(this),
679 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), 682 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this),
680 enqueuer = new EnqueueTask(this), 683 enqueuer = new EnqueueTask(this),
681 dumpInfoTask = new DumpInfoTask(this)]; 684 dumpInfoTask = new DumpInfoTask(this)];
682 685
683 tasks.addAll(backend.tasks); 686 tasks.addAll(backend.tasks);
684 } 687 }
685 688
686 Universe get resolverWorld => enqueuer.resolution.universe; 689 Universe get resolverWorld => enqueuer.resolution.universe;
687 Universe get codegenWorld => enqueuer.codegen.universe; 690 Universe get codegenWorld => enqueuer.codegen.universe;
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 '$missingHelperClasses'); 929 '$missingHelperClasses');
927 } 930 }
928 931
929 if (types == null) { 932 if (types == null) {
930 types = new Types(this, dynamicClass); 933 types = new Types(this, dynamicClass);
931 } 934 }
932 backend.initializeHelperClasses(); 935 backend.initializeHelperClasses();
933 936
934 dynamicClass.ensureResolved(this); 937 dynamicClass.ensureResolved(this);
935 938
936 proxyConstant = constantHandler.compileVariable( 939 proxyConstant =
937 coreLibrary.find('proxy'), isConst: true); 940 resolver.constantCompiler.compileConstant(coreLibrary.find('proxy'));
floitsch 2014/04/02 16:50:02 Why go through the resolver?
Johnni Winther 2014/04/07 11:42:27 We need the frontend interpretation. Putting the c
938 } 941 }
939 942
940 Element _unnamedListConstructor; 943 Element _unnamedListConstructor;
941 Element get unnamedListConstructor { 944 Element get unnamedListConstructor {
942 if (_unnamedListConstructor != null) return _unnamedListConstructor; 945 if (_unnamedListConstructor != null) return _unnamedListConstructor;
943 Selector callConstructor = new Selector.callConstructor( 946 Selector callConstructor = new Selector.callConstructor(
944 "", listClass.getLibrary()); 947 "", listClass.getLibrary());
945 return _unnamedListConstructor = 948 return _unnamedListConstructor =
946 listClass.lookupConstructor(callConstructor); 949 listClass.lookupConstructor(callConstructor);
947 } 950 }
(...skipping 843 matching lines...) Expand 10 before | Expand all | Expand 10 after
1791 static NullSink outputProvider(String name, String extension) { 1794 static NullSink outputProvider(String name, String extension) {
1792 return new NullSink('$name.$extension'); 1795 return new NullSink('$name.$extension');
1793 } 1796 }
1794 } 1797 }
1795 1798
1796 /// Information about suppressed warnings and hints for a given library. 1799 /// Information about suppressed warnings and hints for a given library.
1797 class SuppressionInfo { 1800 class SuppressionInfo {
1798 int warnings = 0; 1801 int warnings = 0;
1799 int hints = 0; 1802 int hints = 0;
1800 } 1803 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698