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

Side by Side Diff: pkg/compiler/lib/src/js_backend/backend.dart

Issue 832363002: Remove Compiler.assembledCode. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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 js_backend; 5 part of js_backend;
6 6
7 const VERBOSE_OPTIMIZER_HINTS = false; 7 const VERBOSE_OPTIMIZER_HINTS = false;
8 8
9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR"); 9 const bool USE_CPS_IR = const bool.fromEnvironment("USE_CPS_IR");
10 10
(...skipping 1241 matching lines...) Expand 10 before | Expand all | Expand 10 after
1252 /** 1252 /**
1253 * Unit test hook that returns code of an element as a String. 1253 * Unit test hook that returns code of an element as a String.
1254 * 1254 *
1255 * Invariant: [element] must be a declaration element. 1255 * Invariant: [element] must be a declaration element.
1256 */ 1256 */
1257 String assembleCode(Element element) { 1257 String assembleCode(Element element) {
1258 assert(invariant(element, element.isDeclaration)); 1258 assert(invariant(element, element.isDeclaration));
1259 return jsAst.prettyPrint(generatedCode[element], compiler).getText(); 1259 return jsAst.prettyPrint(generatedCode[element], compiler).getText();
1260 } 1260 }
1261 1261
1262 void assembleProgram() { 1262 int assembleProgram() {
1263 emitter.assembleProgram(); 1263 int programSize = emitter.assembleProgram();
1264 int totalMethodCount = generatedCode.length; 1264 int totalMethodCount = generatedCode.length;
1265 if (totalMethodCount != preMirrorsMethodCount) { 1265 if (totalMethodCount != preMirrorsMethodCount) {
1266 int mirrorCount = totalMethodCount - preMirrorsMethodCount; 1266 int mirrorCount = totalMethodCount - preMirrorsMethodCount;
1267 double percentage = (mirrorCount / totalMethodCount) * 100; 1267 double percentage = (mirrorCount / totalMethodCount) * 100;
1268 compiler.reportHint( 1268 compiler.reportHint(
1269 compiler.mainApp, MessageKind.MIRROR_BLOAT, 1269 compiler.mainApp, MessageKind.MIRROR_BLOAT,
1270 {'count': mirrorCount, 1270 {'count': mirrorCount,
1271 'total': totalMethodCount, 1271 'total': totalMethodCount,
1272 'percentage': percentage.round()}); 1272 'percentage': percentage.round()});
1273 for (LibraryElement library in compiler.libraryLoader.libraries) { 1273 for (LibraryElement library in compiler.libraryLoader.libraries) {
1274 if (library.isInternalLibrary) continue; 1274 if (library.isInternalLibrary) continue;
1275 for (LibraryTag tag in library.tags) { 1275 for (LibraryTag tag in library.tags) {
1276 Import importTag = tag.asImport(); 1276 Import importTag = tag.asImport();
1277 if (importTag == null) continue; 1277 if (importTag == null) continue;
1278 LibraryElement importedLibrary = library.getLibraryFromTag(tag); 1278 LibraryElement importedLibrary = library.getLibraryFromTag(tag);
1279 if (importedLibrary != compiler.mirrorsLibrary) continue; 1279 if (importedLibrary != compiler.mirrorsLibrary) continue;
1280 MessageKind kind = 1280 MessageKind kind =
1281 compiler.mirrorUsageAnalyzerTask.hasMirrorUsage(library) 1281 compiler.mirrorUsageAnalyzerTask.hasMirrorUsage(library)
1282 ? MessageKind.MIRROR_IMPORT 1282 ? MessageKind.MIRROR_IMPORT
1283 : MessageKind.MIRROR_IMPORT_NO_USAGE; 1283 : MessageKind.MIRROR_IMPORT_NO_USAGE;
1284 compiler.withCurrentElement(library, () { 1284 compiler.withCurrentElement(library, () {
1285 compiler.reportInfo(importTag, kind); 1285 compiler.reportInfo(importTag, kind);
1286 }); 1286 });
1287 } 1287 }
1288 } 1288 }
1289 } 1289 }
1290 return programSize;
1290 } 1291 }
1291 1292
1292 Element getDartClass(Element element) { 1293 Element getDartClass(Element element) {
1293 for (ClassElement dartClass in implementationClasses.keys) { 1294 for (ClassElement dartClass in implementationClasses.keys) {
1294 if (element == implementationClasses[dartClass]) { 1295 if (element == implementationClasses[dartClass]) {
1295 return dartClass; 1296 return dartClass;
1296 } 1297 }
1297 } 1298 }
1298 return element; 1299 return element;
1299 } 1300 }
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
2506 } 2507 }
2507 } 2508 }
2508 2509
2509 /// Records that [constant] is used by the element behind [registry]. 2510 /// Records that [constant] is used by the element behind [registry].
2510 class Dependency { 2511 class Dependency {
2511 final ConstantValue constant; 2512 final ConstantValue constant;
2512 final Element annotatedElement; 2513 final Element annotatedElement;
2513 2514
2514 const Dependency(this.constant, this.annotatedElement); 2515 const Dependency(this.constant, this.annotatedElement);
2515 } 2516 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698