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 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 compiler.deferredLoadTask.outputUnitForConstant(constant); | 360 compiler.deferredLoadTask.outputUnitForConstant(constant); |
361 if (outputUnit == null) { | 361 if (outputUnit == null) { |
362 assert(constant is InterceptorConstantValue); | 362 assert(constant is InterceptorConstantValue); |
363 return null; | 363 return null; |
364 } | 364 } |
365 return _infoFromOutputUnit(outputUnit); | 365 return _infoFromOutputUnit(outputUnit); |
366 } | 366 } |
367 } | 367 } |
368 | 368 |
369 class Selection { | 369 class Selection { |
370 final Element selectedElement; | 370 final Entity selectedElement; |
371 final ReceiverConstraint mask; | 371 final ReceiverConstraint mask; |
372 Selection(this.selectedElement, this.mask); | 372 Selection(this.selectedElement, this.mask); |
373 } | 373 } |
374 | 374 |
375 /// Interface used to record information from different parts of the compiler so | 375 /// Interface used to record information from different parts of the compiler so |
376 /// we can emit them in the dump-info task. | 376 /// we can emit them in the dump-info task. |
377 // TODO(sigmund,het): move more features here. Ideally the dump-info task | 377 // TODO(sigmund,het): move more features here. Ideally the dump-info task |
378 // shouldn't reach into internals of other parts of the compiler. For example, | 378 // shouldn't reach into internals of other parts of the compiler. For example, |
379 // we currently reach into the full emitter and as a result we don't support | 379 // we currently reach into the full emitter and as a result we don't support |
380 // dump-info when using the startup-emitter (issue #24190). | 380 // dump-info when using the startup-emitter (issue #24190). |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
451 WorldImpact impact = impacts[element]; | 451 WorldImpact impact = impacts[element]; |
452 if (impact == null) return const <Selection>[]; | 452 if (impact == null) return const <Selection>[]; |
453 | 453 |
454 var selections = <Selection>[]; | 454 var selections = <Selection>[]; |
455 compiler.impactStrategy.visitImpact( | 455 compiler.impactStrategy.visitImpact( |
456 element, | 456 element, |
457 impact, | 457 impact, |
458 new WorldImpactVisitorImpl(visitDynamicUse: (dynamicUse) { | 458 new WorldImpactVisitorImpl(visitDynamicUse: (dynamicUse) { |
459 selections.addAll(closedWorld | 459 selections.addAll(closedWorld |
460 .locateMembers(dynamicUse.selector, dynamicUse.mask) | 460 .locateMembers(dynamicUse.selector, dynamicUse.mask) |
461 .map((MemberElement e) => new Selection(e, dynamicUse.mask))); | 461 .map((MemberEntity e) => new Selection(e, dynamicUse.mask))); |
462 }, visitStaticUse: (staticUse) { | 462 }, visitStaticUse: (staticUse) { |
463 selections.add(new Selection(staticUse.element, null)); | 463 selections.add(new Selection(staticUse.element, null)); |
464 }), | 464 }), |
465 IMPACT_USE); | 465 IMPACT_USE); |
466 return selections; | 466 return selections; |
467 } | 467 } |
468 | 468 |
469 // Returns true if we care about tracking the size of | 469 // Returns true if we care about tracking the size of |
470 // this node. | 470 // this node. |
471 bool isTracking(jsAst.Node code) { | 471 bool isTracking(jsAst.Node code) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
613 | 613 |
614 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 614 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
615 new StringConversionSink.fromStringSink(buffer)); | 615 new StringConversionSink.fromStringSink(buffer)); |
616 sink.add(new AllInfoJsonCodec().encode(result)); | 616 sink.add(new AllInfoJsonCodec().encode(result)); |
617 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 617 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
618 'text': "View the dumped .info.json file at " | 618 'text': "View the dumped .info.json file at " |
619 "https://dart-lang.github.io/dump-info-visualizer" | 619 "https://dart-lang.github.io/dump-info-visualizer" |
620 }); | 620 }); |
621 } | 621 } |
622 } | 622 } |
OLD | NEW |