| 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 ChunkedConversionSink, JsonEncoder, StringConversionSink; | 8 show ChunkedConversionSink, JsonEncoder, StringConversionSink; |
| 9 | 9 |
| 10 import 'package:dart2js_info/info.dart'; | 10 import 'package:dart2js_info/info.dart'; |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 414 | 414 |
| 415 void reportInlined(Element element, Element inlinedFrom) { | 415 void reportInlined(Element element, Element inlinedFrom) { |
| 416 inlineCount.putIfAbsent(element, () => 0); | 416 inlineCount.putIfAbsent(element, () => 0); |
| 417 inlineCount[element] += 1; | 417 inlineCount[element] += 1; |
| 418 inlineMap.putIfAbsent(inlinedFrom, () => new List<Element>()); | 418 inlineMap.putIfAbsent(inlinedFrom, () => new List<Element>()); |
| 419 inlineMap[inlinedFrom].add(element); | 419 inlineMap[inlinedFrom].add(element); |
| 420 } | 420 } |
| 421 | 421 |
| 422 final Map<Element, Set<Element>> _dependencies = {}; | 422 final Map<Element, Set<Element>> _dependencies = {}; |
| 423 void registerDependency(Element source, Element target) { | 423 void registerDependency(Element source, Element target) { |
| 424 _dependencies.putIfAbsent(source, () => new Set()).add(target); | 424 if (compiler.options.dumpInfo) { |
| 425 _dependencies.putIfAbsent(source, () => new Set()).add(target); |
| 426 } |
| 425 } | 427 } |
| 426 | 428 |
| 427 void registerImpact(Element element, WorldImpact impact) { | 429 void registerImpact(Element element, WorldImpact impact) { |
| 428 if (compiler.options.dumpInfo) { | 430 if (compiler.options.dumpInfo) { |
| 429 impacts[element] = impact; | 431 impacts[element] = impact; |
| 430 } | 432 } |
| 431 } | 433 } |
| 432 | 434 |
| 433 void unregisterImpact(Element element) { | 435 void unregisterImpact(Element element) { |
| 434 impacts.remove(element); | 436 impacts.remove(element); |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 599 |
| 598 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 600 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
| 599 new StringConversionSink.fromStringSink(buffer)); | 601 new StringConversionSink.fromStringSink(buffer)); |
| 600 sink.add(new AllInfoJsonCodec().encode(result)); | 602 sink.add(new AllInfoJsonCodec().encode(result)); |
| 601 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 603 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
| 602 'text': "View the dumped .info.json file at " | 604 'text': "View the dumped .info.json file at " |
| 603 "https://dart-lang.github.io/dump-info-visualizer" | 605 "https://dart-lang.github.io/dump-info-visualizer" |
| 604 }); | 606 }); |
| 605 } | 607 } |
| 606 } | 608 } |
| OLD | NEW |