| OLD | NEW |
| 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 'name': outputUnit.name, | 632 'name': outputUnit.name, |
| 633 'size': backend.emitter.oldEmitter.outputBuffers[outputUnit].length, | 633 'size': backend.emitter.oldEmitter.outputBuffers[outputUnit].length, |
| 634 }); | 634 }); |
| 635 } | 635 } |
| 636 | 636 |
| 637 Map<String, dynamic> outJson = { | 637 Map<String, dynamic> outJson = { |
| 638 'elements': infoCollector.toJson(), | 638 'elements': infoCollector.toJson(), |
| 639 'holding': holding, | 639 'holding': holding, |
| 640 'outputUnits': outputUnits, | 640 'outputUnits': outputUnits, |
| 641 'dump_version': 3, | 641 'dump_version': 3, |
| 642 'deferredFiles': compiler.deferredLoadTask.computeDeferredMap(), |
| 643 // This increases when new information is added to the map, but the viewer |
| 644 // still is compatible. |
| 645 'dump_minor_version': '1' |
| 642 }; | 646 }; |
| 643 | 647 |
| 644 Duration toJsonDuration = new DateTime.now().difference(startToJsonTime); | 648 Duration toJsonDuration = new DateTime.now().difference(startToJsonTime); |
| 645 | 649 |
| 646 Map<String, dynamic> generalProgramInfo = <String, dynamic> { | 650 Map<String, dynamic> generalProgramInfo = <String, dynamic> { |
| 647 'size': _programSize, | 651 'size': _programSize, |
| 648 'dart2jsVersion': infoCollector.dart2jsVersion, | 652 'dart2jsVersion': infoCollector.dart2jsVersion, |
| 649 'compilationMoment': new DateTime.now().toString(), | 653 'compilationMoment': new DateTime.now().toString(), |
| 650 'compilationDuration': compiler.totalCompileTime.elapsed.toString(), | 654 'compilationDuration': compiler.totalCompileTime.elapsed.toString(), |
| 651 'toJsonDuration': 0, | 655 'toJsonDuration': 0, |
| 652 'dumpInfoDuration': this.timing.toString(), | 656 'dumpInfoDuration': this.timing.toString(), |
| 653 'noSuchMethodEnabled': compiler.enabledNoSuchMethod | 657 'noSuchMethodEnabled': compiler.enabledNoSuchMethod |
| 654 }; | 658 }; |
| 655 | 659 |
| 656 outJson['program'] = generalProgramInfo; | 660 outJson['program'] = generalProgramInfo; |
| 657 | 661 |
| 658 ChunkedConversionSink<Object> sink = | 662 ChunkedConversionSink<Object> sink = |
| 659 encoder.startChunkedConversion( | 663 encoder.startChunkedConversion( |
| 660 new StringConversionSink.fromStringSink(buffer)); | 664 new StringConversionSink.fromStringSink(buffer)); |
| 661 sink.add(outJson); | 665 sink.add(outJson); |
| 662 compiler.reportInfo(NO_LOCATION_SPANNABLE, | 666 compiler.reportInfo(NO_LOCATION_SPANNABLE, |
| 663 const MessageKind( | 667 const MessageKind( |
| 664 "View the dumped .info.json file at " | 668 "View the dumped .info.json file at " |
| 665 "https://dart-lang.github.io/dump-info-visualizer")); | 669 "https://dart-lang.github.io/dump-info-visualizer")); |
| 666 } | 670 } |
| 667 } | 671 } |
| OLD | NEW |