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

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

Issue 16817002: Be smarter about when disabling tree-shaking. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 6 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 ClassElement get boolImplementation => compiler.boolClass; 175 ClassElement get boolImplementation => compiler.boolClass;
176 ClassElement get nullImplementation => compiler.nullClass; 176 ClassElement get nullImplementation => compiler.nullClass;
177 177
178 ClassElement defaultSuperclass(ClassElement element) => compiler.objectClass; 178 ClassElement defaultSuperclass(ClassElement element) => compiler.objectClass;
179 179
180 bool isDefaultNoSuchMethodImplementation(Element element) { 180 bool isDefaultNoSuchMethodImplementation(Element element) {
181 assert(element.name == Compiler.NO_SUCH_METHOD); 181 assert(element.name == Compiler.NO_SUCH_METHOD);
182 ClassElement classElement = element.getEnclosingClass(); 182 ClassElement classElement = element.getEnclosingClass();
183 return classElement == compiler.objectClass; 183 return classElement == compiler.objectClass;
184 } 184 }
185
186 void enableMirrors() {}
187
188 void registerStaticUse(Element element, Enqueuer enqueuer) {}
185 } 189 }
186 190
187 /** 191 /**
188 * Key class used in [TokenMap] in which the hash code for a token is based 192 * Key class used in [TokenMap] in which the hash code for a token is based
189 * on the [charOffset]. 193 * on the [charOffset].
190 */ 194 */
191 class TokenKey { 195 class TokenKey {
192 final Token token; 196 final Token token;
193 TokenKey(this.token); 197 TokenKey(this.token);
194 int get hashCode => token.charOffset; 198 int get hashCode => token.charOffset;
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
517 521
518 Universe get resolverWorld => enqueuer.resolution.universe; 522 Universe get resolverWorld => enqueuer.resolution.universe;
519 Universe get codegenWorld => enqueuer.codegen.universe; 523 Universe get codegenWorld => enqueuer.codegen.universe;
520 524
521 bool get hasBuildId => buildId != UNDETERMINED_BUILD_ID; 525 bool get hasBuildId => buildId != UNDETERMINED_BUILD_ID;
522 526
523 bool get mirrorsEnabled => mirrorSystemClass != null; 527 bool get mirrorsEnabled => mirrorSystemClass != null;
524 528
525 bool get analyzeAll => analyzeAllFlag || compileAll; 529 bool get analyzeAll => analyzeAllFlag || compileAll;
526 530
527 bool get compileAll => mirrorsEnabled; 531 bool get compileAll => false;
ngeoffray 2013/06/12 19:38:42 Why do you want to keep this?
ahe 2013/06/14 12:00:22 I think it is useful for testing. We should add a
528 532
529 bool get disableTypeInference => disableTypeInferenceFlag || mirrorsEnabled; 533 bool get disableTypeInference => disableTypeInferenceFlag || mirrorsEnabled;
530 534
531 int getNextFreeClassId() => nextFreeClassId++; 535 int getNextFreeClassId() => nextFreeClassId++;
532 536
533 void ensure(bool condition) { 537 void ensure(bool condition) {
534 if (!condition) cancel('failed assertion in leg'); 538 if (!condition) cancel('failed assertion in leg');
535 } 539 }
536 540
537 void unimplemented(String methodName, 541 void unimplemented(String methodName,
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
656 if (dynamicClass != null) { 660 if (dynamicClass != null) {
657 // When loading the built-in libraries, dynamicClass is null. We 661 // When loading the built-in libraries, dynamicClass is null. We
658 // take advantage of this as core imports js_helper and sees [dynamic] 662 // take advantage of this as core imports js_helper and sees [dynamic]
659 // this way. 663 // this way.
660 withCurrentElement(dynamicClass, () { 664 withCurrentElement(dynamicClass, () {
661 library.addToScope(dynamicClass, this); 665 library.addToScope(dynamicClass, this);
662 }); 666 });
663 } 667 }
664 if (uri == Uri.parse('dart:mirrors')) { 668 if (uri == Uri.parse('dart:mirrors')) {
665 mirrorSystemClass = library.find(const SourceString('MirrorSystem')); 669 mirrorSystemClass = library.find(const SourceString('MirrorSystem'));
670 backend.enableMirrors();
666 metadataHandler = constantHandler; 671 metadataHandler = constantHandler;
667 } else if (uri == Uri.parse('dart:_collection-dev')) { 672 } else if (uri == Uri.parse('dart:_collection-dev')) {
668 symbolImplementationClass = library.find(const SourceString('Symbol')); 673 symbolImplementationClass = library.find(const SourceString('Symbol'));
669 } 674 }
670 } 675 }
671 676
672 void onClassResolved(ClassElement cls) { 677 void onClassResolved(ClassElement cls) {
673 if (mirrorSystemClass == cls) { 678 if (mirrorSystemClass == cls) {
674 mirrorSystemGetNameFunction = 679 mirrorSystemGetNameFunction =
675 cls.lookupLocalMember(const SourceString('getName')); 680 cls.lookupLocalMember(const SourceString('getName'));
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after
1387 1392
1388 void close() {} 1393 void close() {}
1389 1394
1390 toString() => name; 1395 toString() => name;
1391 1396
1392 /// Convenience method for getting an [api.CompilerOutputProvider]. 1397 /// Convenience method for getting an [api.CompilerOutputProvider].
1393 static NullSink outputProvider(String name, String extension) { 1398 static NullSink outputProvider(String name, String extension) {
1394 return new NullSink('$name.$extension'); 1399 return new NullSink('$name.$extension');
1395 } 1400 }
1396 } 1401 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698