| 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' | 7 import 'dart:convert' |
| 8 show HtmlEscape, JsonEncoder, StringConversionSink, ChunkedConversionSink; | 8 show HtmlEscape, JsonEncoder, StringConversionSink, ChunkedConversionSink; |
| 9 | 9 |
| 10 import 'elements/elements.dart'; | 10 import 'elements/elements.dart'; |
| (...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 ..close(); | 452 ..close(); |
| 453 }); | 453 }); |
| 454 } | 454 } |
| 455 | 455 |
| 456 void dumpInfoJson(StringSink buffer) { | 456 void dumpInfoJson(StringSink buffer) { |
| 457 JsonEncoder encoder = const JsonEncoder.withIndent(' '); | 457 JsonEncoder encoder = const JsonEncoder.withIndent(' '); |
| 458 Stopwatch stopwatch = new Stopwatch(); | 458 Stopwatch stopwatch = new Stopwatch(); |
| 459 stopwatch.start(); | 459 stopwatch.start(); |
| 460 | 460 |
| 461 // Recursively build links to function uses | 461 // Recursively build links to function uses |
| 462 Iterable<FunctionElement> functionElements = | 462 Iterable<Element> functionElements = |
| 463 infoCollector._elementToInfo.keys.where((k) => k is FunctionElement); | 463 infoCollector._elementToInfo.keys.where((k) => k is FunctionElement); |
| 464 for (FunctionElement element in functionElements) { | 464 for (FunctionElement element in functionElements) { |
| 465 FunctionInfo info = infoCollector._elementToInfo[element]; | 465 FunctionInfo info = infoCollector._elementToInfo[element]; |
| 466 Iterable<Selection> uses = getRetaining(element); | 466 Iterable<Selection> uses = getRetaining(element); |
| 467 // Don't bother recording an empty list of dependencies. | 467 // Don't bother recording an empty list of dependencies. |
| 468 for (Selection selection in uses) { | 468 for (Selection selection in uses) { |
| 469 // Don't register dart2js builtin functions that are not recorded. | 469 // Don't register dart2js builtin functions that are not recorded. |
| 470 Info useInfo = infoCollector._elementToInfo[selection.selectedElement]; | 470 Info useInfo = infoCollector._elementToInfo[selection.selectedElement]; |
| 471 if (useInfo == null) continue; | 471 if (useInfo == null) continue; |
| 472 info.uses.add(new DependencyInfo(useInfo, '${selection.mask}')); | 472 info.uses.add(new DependencyInfo(useInfo, '${selection.mask}')); |
| (...skipping 26 matching lines...) Expand all Loading... |
| 499 | 499 |
| 500 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 500 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
| 501 new StringConversionSink.fromStringSink(buffer)); | 501 new StringConversionSink.fromStringSink(buffer)); |
| 502 sink.add(result.toJson()); | 502 sink.add(result.toJson()); |
| 503 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 503 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
| 504 'text': "View the dumped .info.json file at " | 504 'text': "View the dumped .info.json file at " |
| 505 "https://dart-lang.github.io/dump-info-visualizer" | 505 "https://dart-lang.github.io/dump-info-visualizer" |
| 506 }); | 506 }); |
| 507 } | 507 } |
| 508 } | 508 } |
| OLD | NEW |