| 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'; |
| 11 | 11 |
| 12 import 'common/tasks.dart' show CompilerTask; | 12 import 'common/tasks.dart' show CompilerTask; |
| 13 import 'common.dart'; | 13 import 'common.dart'; |
| 14 import 'compiler.dart' show Compiler; | 14 import 'compiler.dart' show Compiler; |
| 15 import 'constants/values.dart' show ConstantValue, InterceptorConstantValue; | 15 import 'constants/values.dart' show ConstantValue, InterceptorConstantValue; |
| 16 import 'deferred_load.dart' show OutputUnit; | 16 import 'deferred_load.dart' show OutputUnit; |
| 17 import 'elements/elements.dart'; | 17 import 'elements/elements.dart'; |
| 18 import 'elements/visitor.dart'; | 18 import 'elements/visitor.dart'; |
| 19 import 'info/send_info.dart' show collectSendMeasurements; | |
| 20 import 'js/js.dart' as jsAst; | 19 import 'js/js.dart' as jsAst; |
| 21 import 'js_backend/js_backend.dart' show JavaScriptBackend; | 20 import 'js_backend/js_backend.dart' show JavaScriptBackend; |
| 22 import 'js_emitter/full_emitter/emitter.dart' as full show Emitter; | 21 import 'js_emitter/full_emitter/emitter.dart' as full show Emitter; |
| 23 import 'types/types.dart' show TypeMask; | 22 import 'types/types.dart' show TypeMask; |
| 24 import 'universe/universe.dart' show ReceiverConstraint; | 23 import 'universe/universe.dart' show ReceiverConstraint; |
| 25 import 'universe/world_impact.dart' | 24 import 'universe/world_impact.dart' |
| 26 show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl; | 25 show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl; |
| 27 | 26 |
| 28 class ElementInfoCollector extends BaseElementVisitor<Info, dynamic> { | 27 class ElementInfoCollector extends BaseElementVisitor<Info, dynamic> { |
| 29 final Compiler compiler; | 28 final Compiler compiler; |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 child.name = "${parent.name}.${child.name}"; | 305 child.name = "${parent.name}.${child.name}"; |
| 307 } | 306 } |
| 308 nestedClosures.add(child); | 307 nestedClosures.add(child); |
| 309 child.parent = parent; | 308 child.parent = parent; |
| 310 size += child.size; | 309 size += child.size; |
| 311 } | 310 } |
| 312 } | 311 } |
| 313 } | 312 } |
| 314 info.closures = nestedClosures; | 313 info.closures = nestedClosures; |
| 315 result.functions.add(info); | 314 result.functions.add(info); |
| 316 if (const bool.fromEnvironment('send_stats')) { | |
| 317 info.measurements = collectSendMeasurements(element, compiler); | |
| 318 } | |
| 319 return info; | 315 return info; |
| 320 } | 316 } |
| 321 | 317 |
| 322 OutputUnitInfo _infoFromOutputUnit(OutputUnit outputUnit) { | 318 OutputUnitInfo _infoFromOutputUnit(OutputUnit outputUnit) { |
| 323 return _outputToInfo.putIfAbsent(outputUnit, () { | 319 return _outputToInfo.putIfAbsent(outputUnit, () { |
| 324 // Dump-info currently only works with the full emitter. If another | 320 // Dump-info currently only works with the full emitter. If another |
| 325 // emitter is used it will fail here. | 321 // emitter is used it will fail here. |
| 326 JavaScriptBackend backend = compiler.backend; | 322 JavaScriptBackend backend = compiler.backend; |
| 327 full.Emitter emitter = backend.emitter.emitter; | 323 full.Emitter emitter = backend.emitter.emitter; |
| 328 OutputUnitInfo info = new OutputUnitInfo( | 324 OutputUnitInfo info = new OutputUnitInfo( |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 590 | 586 |
| 591 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 587 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
| 592 new StringConversionSink.fromStringSink(buffer)); | 588 new StringConversionSink.fromStringSink(buffer)); |
| 593 sink.add(new AllInfoJsonCodec().encode(result)); | 589 sink.add(new AllInfoJsonCodec().encode(result)); |
| 594 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 590 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
| 595 'text': "View the dumped .info.json file at " | 591 'text': "View the dumped .info.json file at " |
| 596 "https://dart-lang.github.io/dump-info-visualizer" | 592 "https://dart-lang.github.io/dump-info-visualizer" |
| 597 }); | 593 }); |
| 598 } | 594 } |
| 599 } | 595 } |
| OLD | NEW |