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 c59ea596ab48213d27935bc65f222db80e3eed4b..f21d3fc3e821c7082cb2580521443f171a91a8e0 100644 |
--- a/pkg/compiler/lib/src/dump_info.dart |
+++ b/pkg/compiler/lib/src/dump_info.dart |
@@ -86,20 +86,13 @@ class ElementToJsonVisitor extends ElementVisitor<Map<String, dynamic>> { |
final Map<Element, Map<String, dynamic>> jsonCache = {}; |
- int programSize; |
+ final int programSize; |
String dart2jsVersion; |
- ElementToJsonVisitor(this.compiler); |
+ ElementToJsonVisitor(this.compiler, this.programSize); |
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; |
@@ -555,14 +548,14 @@ class DumpInfoTask extends CompilerTask { |
return sb; |
} |
- void collectInfo() { |
- infoCollector = new ElementToJsonVisitor(compiler)..run(); |
+ void collectInfo(int programSize) { |
+ infoCollector = new ElementToJsonVisitor(compiler, programSize)..run(); |
} |
- void dumpInfo() { |
+ void dumpInfo(int programSize) { |
measure(() { |
if (infoCollector == null) { |
- collectInfo(); |
+ collectInfo(programSize); |
} |
StringBuffer jsonBuffer = new StringBuffer(); |