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

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

Issue 24282005: Move compile-time constant registrations to the backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status Created 7 years, 2 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 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 // TODO(ahe,karlklose): rename this? 116 // TODO(ahe,karlklose): rename this?
117 void dumpInferredTypes() {} 117 void dumpInferredTypes() {}
118 118
119 ItemCompilationContext createItemCompilationContext() { 119 ItemCompilationContext createItemCompilationContext() {
120 return new ItemCompilationContext(); 120 return new ItemCompilationContext();
121 } 121 }
122 122
123 bool classNeedsRti(ClassElement cls); 123 bool classNeedsRti(ClassElement cls);
124 bool methodNeedsRti(FunctionElement function); 124 bool methodNeedsRti(FunctionElement function);
125 125
126
127 /// Called by the backend when [constant] has been used.
ngeoffray 2013/10/01 08:33:35 Please update comment: how can that be called by t
Johnni Winther 2013/10/01 11:21:48 Done.
128 void registerCompileTimeConstant(Constant constant, TreeElements elements) {}
129
130 /// Called during post-processing when [constant] has been evaluated.
131 void registerMetadataConstant(Constant constant, TreeElements elements) {}
132
126 /// Called during resolution to notify to the backend that a class is 133 /// Called during resolution to notify to the backend that a class is
127 /// being instantiated. 134 /// being instantiated.
128 void registerInstantiatedClass(ClassElement cls, 135 void registerInstantiatedClass(ClassElement cls,
129 Enqueuer enqueuer, 136 Enqueuer enqueuer,
130 TreeElements elements) {} 137 TreeElements elements) {}
131 138
132 /// Called during resolution to notify to the backend that the 139 /// Called during resolution to notify to the backend that the
133 /// program uses string interpolation. 140 /// program uses string interpolation.
134 void registerStringInterpolation(TreeElements elements) {} 141 void registerStringInterpolation(TreeElements elements) {}
135 142
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
250 ClassElement classElement = element.getEnclosingClass(); 257 ClassElement classElement = element.getEnclosingClass();
251 return classElement == compiler.objectClass; 258 return classElement == compiler.objectClass;
252 } 259 }
253 260
254 void registerStaticUse(Element element, Enqueuer enqueuer) {} 261 void registerStaticUse(Element element, Enqueuer enqueuer) {}
255 262
256 Future onLibraryLoaded(LibraryElement library, Uri uri) { 263 Future onLibraryLoaded(LibraryElement library, Uri uri) {
257 return new Future.value(); 264 return new Future.value();
258 } 265 }
259 266
260 void registerMetadataInstantiatedType(DartType type, TreeElements elements) {}
261 void registerMetadataStaticUse(Element element) {}
262 void registerMetadataGetOfStaticFunction(FunctionElement element) {}
263
264 /// Called by [MirrorUsageAnalyzerTask] after it has merged all @MirrorsUsed 267 /// Called by [MirrorUsageAnalyzerTask] after it has merged all @MirrorsUsed
265 /// annotations. The arguments corresponds to the unions of the corresponding 268 /// annotations. The arguments corresponds to the unions of the corresponding
266 /// fields of the annotations. 269 /// fields of the annotations.
267 void registerMirrorUsage(Set<String> symbols, 270 void registerMirrorUsage(Set<String> symbols,
268 Set<Element> targets, 271 Set<Element> targets,
269 Set<Element> metaTargets) {} 272 Set<Element> metaTargets) {}
270 273
271 /// Returns true if this element should be retained for reflection even if it 274 /// Returns true if this element should be retained for reflection even if it
272 /// would normally be tree-shaken away. 275 /// would normally be tree-shaken away.
273 bool isNeededForReflection(Element element) => false; 276 bool isNeededForReflection(Element element) => false;
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 ParserTask parser; 525 ParserTask parser;
523 PatchParserTask patchParser; 526 PatchParserTask patchParser;
524 LibraryLoader libraryLoader; 527 LibraryLoader libraryLoader;
525 TreeValidatorTask validator; 528 TreeValidatorTask validator;
526 ResolverTask resolver; 529 ResolverTask resolver;
527 closureMapping.ClosureTask closureToClassMapper; 530 closureMapping.ClosureTask closureToClassMapper;
528 TypeCheckerTask checker; 531 TypeCheckerTask checker;
529 ti.TypesTask typesTask; 532 ti.TypesTask typesTask;
530 Backend backend; 533 Backend backend;
531 ConstantHandler constantHandler; 534 ConstantHandler constantHandler;
532 ConstantHandler metadataHandler;
533 EnqueueTask enqueuer; 535 EnqueueTask enqueuer;
534 DeferredLoadTask deferredLoadTask; 536 DeferredLoadTask deferredLoadTask;
535 MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask; 537 MirrorUsageAnalyzerTask mirrorUsageAnalyzerTask;
536 String buildId; 538 String buildId;
537 539
538 static const SourceString MAIN = const SourceString('main'); 540 static const SourceString MAIN = const SourceString('main');
539 static const SourceString CALL_OPERATOR_NAME = const SourceString('call'); 541 static const SourceString CALL_OPERATOR_NAME = const SourceString('call');
540 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod'); 542 static const SourceString NO_SUCH_METHOD = const SourceString('noSuchMethod');
541 static const int NO_SUCH_METHOD_ARG_COUNT = 1; 543 static const int NO_SUCH_METHOD_ARG_COUNT = 1;
542 static const SourceString CREATE_INVOCATION_MIRROR = 544 static const SourceString CREATE_INVOCATION_MIRROR =
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
637 resolver = new ResolverTask(this), 639 resolver = new ResolverTask(this),
638 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer), 640 closureToClassMapper = new closureMapping.ClosureTask(this, closureNamer),
639 checker = new TypeCheckerTask(this), 641 checker = new TypeCheckerTask(this),
640 typesTask = new ti.TypesTask(this), 642 typesTask = new ti.TypesTask(this),
641 constantHandler = new ConstantHandler(this, backend.constantSystem), 643 constantHandler = new ConstantHandler(this, backend.constantSystem),
642 deferredLoadTask = new DeferredLoadTask(this), 644 deferredLoadTask = new DeferredLoadTask(this),
643 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this), 645 mirrorUsageAnalyzerTask = new MirrorUsageAnalyzerTask(this),
644 enqueuer = new EnqueueTask(this)]; 646 enqueuer = new EnqueueTask(this)];
645 647
646 tasks.addAll(backend.tasks); 648 tasks.addAll(backend.tasks);
647 metadataHandler = new ConstantHandler(
648 this, backend.constantSystem, isMetadata: true);
649 } 649 }
650 650
651 Universe get resolverWorld => enqueuer.resolution.universe; 651 Universe get resolverWorld => enqueuer.resolution.universe;
652 Universe get codegenWorld => enqueuer.codegen.universe; 652 Universe get codegenWorld => enqueuer.codegen.universe;
653 653
654 bool get hasBuildId => buildId != UNDETERMINED_BUILD_ID; 654 bool get hasBuildId => buildId != UNDETERMINED_BUILD_ID;
655 655
656 bool get analyzeAll => analyzeAllFlag || compileAll; 656 bool get analyzeAll => analyzeAllFlag || compileAll;
657 657
658 bool get compileAll => false; 658 bool get compileAll => false;
(...skipping 936 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 1595
1596 void close() {} 1596 void close() {}
1597 1597
1598 toString() => name; 1598 toString() => name;
1599 1599
1600 /// Convenience method for getting an [api.CompilerOutputProvider]. 1600 /// Convenience method for getting an [api.CompilerOutputProvider].
1601 static NullSink outputProvider(String name, String extension) { 1601 static NullSink outputProvider(String name, String extension) {
1602 return new NullSink('$name.$extension'); 1602 return new NullSink('$name.$extension');
1603 } 1603 }
1604 } 1604 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698