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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 class JavaScriptItemCompilationContext extends ItemCompilationContext { 9 class JavaScriptItemCompilationContext extends ItemCompilationContext {
10 final Set<HInstruction> boundsChecked = new Set<HInstruction>(); 10 final Set<HInstruction> boundsChecked = new Set<HInstruction>();
(...skipping 1175 matching lines...) Expand 10 before | Expand all | Expand 10 after
1186 */ 1186 */
1187 String assembleCode(Element element) { 1187 String assembleCode(Element element) {
1188 assert(invariant(element, element.isDeclaration)); 1188 assert(invariant(element, element.isDeclaration));
1189 return jsAst.prettyPrint(generatedCode[element], compiler).getText(); 1189 return jsAst.prettyPrint(generatedCode[element], compiler).getText();
1190 } 1190 }
1191 1191
1192 void assembleProgram() { 1192 void assembleProgram() {
1193 emitter.assembleProgram(); 1193 emitter.assembleProgram();
1194 int totalMethodCount = generatedCode.length; 1194 int totalMethodCount = generatedCode.length;
1195 if (totalMethodCount != preMirrorsMethodCount) { 1195 if (totalMethodCount != preMirrorsMethodCount) {
1196 int mirrorCount = totalMethodCount - preMirrorsMethodCount; 1196 bool reportedHint = false;
1197 double percentage = (mirrorCount / totalMethodCount) * 100;
1198 compiler.reportHint(
1199 compiler.mainApp, MessageKind.MIRROR_BLOAT,
1200 {'count': mirrorCount,
1201 'total': totalMethodCount,
1202 'percentage': percentage.round()});
1203 for (LibraryElement library in compiler.libraries.values) { 1197 for (LibraryElement library in compiler.libraries.values) {
1204 if (library.isInternalLibrary) continue; 1198 if (library.isInternalLibrary) continue;
1205 for (LibraryTag tag in library.tags) { 1199 for (LibraryTag tag in library.tags) {
1206 Import importTag = tag.asImport(); 1200 Import importTag = tag.asImport();
1207 if (importTag == null) continue; 1201 if (importTag == null) continue;
1208 LibraryElement importedLibrary = library.getLibraryFromTag(tag); 1202 LibraryElement importedLibrary = library.getLibraryFromTag(tag);
1209 if (importedLibrary != compiler.mirrorsLibrary) continue; 1203 if (importedLibrary != compiler.mirrorsLibrary) continue;
1204 if (!reportedHint) {
1205 reportedHint = true;
1206 int mirrorCount = totalMethodCount - preMirrorsMethodCount;
1207 double percentage = (mirrorCount / totalMethodCount) * 100;
1208 compiler.reportHint(
1209 compiler.mainApp, MessageKind.MIRROR_BLOAT,
1210 {'count': mirrorCount,
1211 'total': totalMethodCount,
1212 'percentage': percentage.round()});
1213 }
1210 MessageKind kind = 1214 MessageKind kind =
1211 compiler.mirrorUsageAnalyzerTask.hasMirrorUsage(library) 1215 compiler.mirrorUsageAnalyzerTask.hasMirrorUsage(library)
1212 ? MessageKind.MIRROR_IMPORT 1216 ? MessageKind.MIRROR_IMPORT
1213 : MessageKind.MIRROR_IMPORT_NO_USAGE; 1217 : MessageKind.MIRROR_IMPORT_NO_USAGE;
1214 compiler.withCurrentElement(library, () { 1218 compiler.withCurrentElement(library, () {
1215 compiler.reportInfo(importTag, kind); 1219 compiler.reportInfo(importTag, kind);
1216 }); 1220 });
1217 } 1221 }
1218 } 1222 }
1219 } 1223 }
(...skipping 697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1917 copy(constant.values); 1921 copy(constant.values);
1918 copy(constant.protoValue); 1922 copy(constant.protoValue);
1919 copy(constant); 1923 copy(constant);
1920 } 1924 }
1921 1925
1922 void visitConstructed(ConstructedConstant constant) { 1926 void visitConstructed(ConstructedConstant constant) {
1923 copy(constant.fields); 1927 copy(constant.fields);
1924 copy(constant); 1928 copy(constant);
1925 } 1929 }
1926 } 1930 }
OLDNEW
« 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