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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/dump_info.dart

Issue 486313003: Clean up dump-info and js_backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 4 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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 library dump_info; 5 library dump_info;
6 6
7 import 'dart:convert' show 7 import 'dart:convert' show
8 HtmlEscape, 8 HtmlEscape,
9 JsonEncoder, 9 JsonEncoder,
10 StringConversionSink, 10 StringConversionSink,
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 } 69 }
70 }); 70 });
71 json[mapper.name] = innerMapper; 71 json[mapper.name] = innerMapper;
72 } 72 }
73 return json; 73 return json;
74 } 74 }
75 } 75 }
76 76
77 class ElementToJsonVisitor extends ElementVisitor<Map<String, dynamic>> { 77 class ElementToJsonVisitor extends ElementVisitor<Map<String, dynamic>> {
78 GroupedIdMapper mapper = new GroupedIdMapper(); 78 GroupedIdMapper mapper = new GroupedIdMapper();
79 Compiler compiler; 79 Compiler compiler;
sra1 2014/08/19 22:05:25 Can be 'final'. Make other fields could be final
Ty Overby (Google) 2014/08/20 17:23:50 Done.
80 80
81 Map<Element, Map<String, dynamic>> jsonCache = {}; 81 Map<Element, Map<String, dynamic>> jsonCache = {};
82 Map<Element, jsAst.Expression> codeCache; 82 Map<Element, jsAst.Expression> codeCache;
83 83
84 int programSize; 84 int programSize;
85 DateTime compilationMoment; 85 DateTime compilationMoment;
86 String dart2jsVersion; 86 String dart2jsVersion;
87 Duration compilationDuration; 87 Duration compilationDuration;
88 Duration dumpInfoDuration; 88 Duration dumpInfoDuration;
89 89
90 ElementToJsonVisitor(Compiler compiler) { 90 ElementToJsonVisitor(Compiler compiler)
sra1 2014/08/19 22:05:25 Or ElementToJsonVisitor(this.compiler)
Ty Overby (Google) 2014/08/20 17:23:50 Done.
91 this.compiler = compiler; 91 :compiler = compiler {
sigurdm 2014/08/20 08:37:47 Nitpicking: space after the colon. From the style
Ty Overby (Google) 2014/08/20 17:23:50 Acknowledged.
92 92
93 Backend backend = compiler.backend; 93 Backend backend = compiler.backend;
sra1 2014/08/19 22:05:25 Peter suggested not doing so much work in the cons
Ty Overby (Google) 2014/08/20 17:23:50 Done.
94 if (backend is JavaScriptBackend) { 94 if (backend is JavaScriptBackend) {
95 // Add up the sizes of all output-buffers. 95 // Add up the sizes of all output-buffers.
96 programSize = backend.emitter.outputBuffers.values.fold(0, 96 programSize = backend.emitter.outputBuffers.values.fold(0,
97 (a, b) => a + b.length); 97 (a, b) => a + b.length);
98 } else { 98 } else {
99 programSize = compiler.assembledCode.length; 99 programSize = compiler.assembledCode.length;
100 } 100 }
101 101
102
103 compilationMoment = new DateTime.now(); 102 compilationMoment = new DateTime.now();
104 dart2jsVersion = compiler.hasBuildId ? compiler.buildId : null; 103 dart2jsVersion = compiler.hasBuildId ? compiler.buildId : null;
105 compilationDuration = compiler.totalCompileTime.elapsed; 104 compilationDuration = compiler.totalCompileTime.elapsed;
106 105
107 for (var library in compiler.libraryLoader.libraries.toList()) { 106 for (var library in compiler.libraryLoader.libraries.toList()) {
108 library.accept(this); 107 library.accept(this);
109 } 108 }
110 109
111 dumpInfoDuration = new DateTime.now().difference(compilationMoment); 110 dumpInfoDuration = new DateTime.now().difference(compilationMoment);
112 } 111 }
(...skipping 501 matching lines...) Expand 10 before | Expand all | Expand 10 after
614 }; 613 };
615 614
616 outJson['program'] = generalProgramInfo; 615 outJson['program'] = generalProgramInfo;
617 616
618 ChunkedConversionSink<Object> sink = 617 ChunkedConversionSink<Object> sink =
619 encoder.startChunkedConversion( 618 encoder.startChunkedConversion(
620 new StringConversionSink.fromStringSink(buffer)); 619 new StringConversionSink.fromStringSink(buffer));
621 sink.add(outJson); 620 sink.add(outJson);
622 } 621 }
623 } 622 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698