| 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 397 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 408 <ConstantValue, jsAst.Node>{}; | 408 <ConstantValue, jsAst.Node>{}; |
| 409 // A mapping from Javascript AST Nodes to the size of their | 409 // A mapping from Javascript AST Nodes to the size of their |
| 410 // pretty-printed contents. | 410 // pretty-printed contents. |
| 411 final Map<jsAst.Node, int> _nodeToSize = <jsAst.Node, int>{}; | 411 final Map<jsAst.Node, int> _nodeToSize = <jsAst.Node, int>{}; |
| 412 | 412 |
| 413 final Map<Element, int> inlineCount = <Element, int>{}; | 413 final Map<Element, int> inlineCount = <Element, int>{}; |
| 414 // A mapping from an element to a list of elements that are | 414 // A mapping from an element to a list of elements that are |
| 415 // inlined inside of it. | 415 // inlined inside of it. |
| 416 final Map<Element, List<Element>> inlineMap = <Element, List<Element>>{}; | 416 final Map<Element, List<Element>> inlineMap = <Element, List<Element>>{}; |
| 417 | 417 |
| 418 final Map<Element, WorldImpact> impacts = <Element, WorldImpact>{}; | 418 final Map<MemberEntity, WorldImpact> impacts = <MemberEntity, WorldImpact>{}; |
| 419 | 419 |
| 420 /// Register the size of the generated output. | 420 /// Register the size of the generated output. |
| 421 void reportSize(int programSize) { | 421 void reportSize(int programSize) { |
| 422 _programSize = programSize; | 422 _programSize = programSize; |
| 423 } | 423 } |
| 424 | 424 |
| 425 void reportInlined(Element element, Element inlinedFrom) { | 425 void reportInlined(Element element, Element inlinedFrom) { |
| 426 element = element.declaration; | 426 element = element.declaration; |
| 427 inlinedFrom = inlinedFrom.declaration; | 427 inlinedFrom = inlinedFrom.declaration; |
| 428 | 428 |
| 429 inlineCount.putIfAbsent(element, () => 0); | 429 inlineCount.putIfAbsent(element, () => 0); |
| 430 inlineCount[element] += 1; | 430 inlineCount[element] += 1; |
| 431 inlineMap.putIfAbsent(inlinedFrom, () => new List<Element>()); | 431 inlineMap.putIfAbsent(inlinedFrom, () => new List<Element>()); |
| 432 inlineMap[inlinedFrom].add(element); | 432 inlineMap[inlinedFrom].add(element); |
| 433 } | 433 } |
| 434 | 434 |
| 435 void registerImpact(Element element, WorldImpact impact) { | 435 void registerImpact(MemberEntity element, WorldImpact impact) { |
| 436 if (compiler.options.dumpInfo) { | 436 if (compiler.options.dumpInfo) { |
| 437 impacts[element] = impact; | 437 impacts[element] = impact; |
| 438 } | 438 } |
| 439 } | 439 } |
| 440 | 440 |
| 441 void unregisterImpact(var impactSource) { | 441 void unregisterImpact(var impactSource) { |
| 442 impacts.remove(impactSource); | 442 impacts.remove(impactSource); |
| 443 } | 443 } |
| 444 | 444 |
| 445 /** | 445 /** |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 612 | 612 |
| 613 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 613 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
| 614 new StringConversionSink.fromStringSink(buffer)); | 614 new StringConversionSink.fromStringSink(buffer)); |
| 615 sink.add(new AllInfoJsonCodec().encode(result)); | 615 sink.add(new AllInfoJsonCodec().encode(result)); |
| 616 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 616 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
| 617 'text': "View the dumped .info.json file at " | 617 'text': "View the dumped .info.json file at " |
| 618 "https://dart-lang.github.io/dump-info-visualizer" | 618 "https://dart-lang.github.io/dump-info-visualizer" |
| 619 }); | 619 }); |
| 620 } | 620 } |
| 621 } | 621 } |
| OLD | NEW |