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

Unified Diff: pkg/compiler/lib/src/dump_info.dart

Issue 824103005: Revert "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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/compiler/lib/src/dart_backend/outputter.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/dump_info.dart
diff --git a/pkg/compiler/lib/src/dump_info.dart b/pkg/compiler/lib/src/dump_info.dart
index b2442b911157e36f8f31120342e2c09a77ccf7f3..c59ea596ab48213d27935bc65f222db80e3eed4b 100644
--- a/pkg/compiler/lib/src/dump_info.dart
+++ b/pkg/compiler/lib/src/dump_info.dart
@@ -86,12 +86,20 @@ class ElementToJsonVisitor extends ElementVisitor<Map<String, dynamic>> {
final Map<Element, Map<String, dynamic>> jsonCache = {};
+ int programSize;
String dart2jsVersion;
ElementToJsonVisitor(this.compiler);
void run() {
Backend backend = compiler.backend;
+ if (backend is JavaScriptBackend) {
+ // Add up the sizes of all output-buffers.
+ programSize = backend.emitter.oldEmitter.outputBuffers.values.fold(0,
+ (a, b) => a + b.length);
+ } else {
+ programSize = compiler.assembledCode.length;
+ }
dart2jsVersion = compiler.hasBuildId ? compiler.buildId : null;
@@ -397,9 +405,6 @@ class DumpInfoTask extends CompilerTask {
ElementToJsonVisitor infoCollector;
- /// The size of the generated output.
- int _programSize;
-
// A set of javascript AST nodes that we care about the size of.
// This set is automatically populated when registerElementAst()
// is called.
@@ -419,11 +424,6 @@ class DumpInfoTask extends CompilerTask {
// inlined inside of it.
final Map<Element, List<Element>> inlineMap = <Element, List<Element>>{};
- /// Register the size of the generated output.
- void reportSize(int programSize) {
- _programSize = programSize;
- }
-
void registerInlined(Element element, Element inlinedFrom) {
inlineCount.putIfAbsent(element, () => 0);
inlineCount[element] += 1;
@@ -644,7 +644,7 @@ class DumpInfoTask extends CompilerTask {
Duration toJsonDuration = new DateTime.now().difference(startToJsonTime);
Map<String, dynamic> generalProgramInfo = <String, dynamic> {
- 'size': _programSize,
+ 'size': infoCollector.programSize,
'dart2jsVersion': infoCollector.dart2jsVersion,
'compilationMoment': new DateTime.now().toString(),
'compilationDuration': compiler.totalCompileTime.elapsed.toString(),
« no previous file with comments | « pkg/compiler/lib/src/dart_backend/outputter.dart ('k') | pkg/compiler/lib/src/js_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698