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

Unified Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 196533014: Only report number of retained methods if we actually find an import of mirrors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
diff --git a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
index d157b569549862ab23235d589406930f0d2b206e..5376e1ee10b7bf178b969a24877c8e4a76304eb7 100644
--- a/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/js_backend/backend.dart
@@ -1193,13 +1193,7 @@ class JavaScriptBackend extends Backend {
emitter.assembleProgram();
int totalMethodCount = generatedCode.length;
if (totalMethodCount != preMirrorsMethodCount) {
- int mirrorCount = totalMethodCount - preMirrorsMethodCount;
- double percentage = (mirrorCount / totalMethodCount) * 100;
- compiler.reportHint(
- compiler.mainApp, MessageKind.MIRROR_BLOAT,
- {'count': mirrorCount,
- 'total': totalMethodCount,
- 'percentage': percentage.round()});
+ bool reportedHint = false;
for (LibraryElement library in compiler.libraries.values) {
if (library.isInternalLibrary) continue;
for (LibraryTag tag in library.tags) {
@@ -1207,6 +1201,16 @@ class JavaScriptBackend extends Backend {
if (importTag == null) continue;
LibraryElement importedLibrary = library.getLibraryFromTag(tag);
if (importedLibrary != compiler.mirrorsLibrary) continue;
+ if (!reportedHint) {
+ reportedHint = true;
+ int mirrorCount = totalMethodCount - preMirrorsMethodCount;
+ double percentage = (mirrorCount / totalMethodCount) * 100;
+ compiler.reportHint(
+ compiler.mainApp, MessageKind.MIRROR_BLOAT,
+ {'count': mirrorCount,
+ 'total': totalMethodCount,
+ 'percentage': percentage.round()});
+ }
MessageKind kind =
compiler.mirrorUsageAnalyzerTask.hasMirrorUsage(library)
? MessageKind.MIRROR_IMPORT
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698