Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(13)

Side by Side Diff: pkg/compiler/lib/src/dump_info.dart

Issue 1859343004: dartfmt pkg/compiler (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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' show 7 import 'dart:convert'
8 ChunkedConversionSink, 8 show ChunkedConversionSink, HtmlEscape, JsonEncoder, StringConversionSink;
9 HtmlEscape,
10 JsonEncoder,
11 StringConversionSink;
12 9
13 import 'package:dart2js_info/info.dart'; 10 import 'package:dart2js_info/info.dart';
14 11
15 import 'common.dart'; 12 import 'common.dart';
16 import 'common/tasks.dart' show 13 import 'common/tasks.dart' show CompilerTask;
17 CompilerTask; 14 import 'constants/values.dart' show ConstantValue, InterceptorConstantValue;
18 import 'constants/values.dart' show 15 import 'compiler.dart' show Compiler;
19 ConstantValue, 16 import 'deferred_load.dart' show OutputUnit;
20 InterceptorConstantValue;
21 import 'compiler.dart' show
22 Compiler;
23 import 'deferred_load.dart' show
24 OutputUnit;
25 import 'elements/elements.dart'; 17 import 'elements/elements.dart';
26 import 'elements/visitor.dart'; 18 import 'elements/visitor.dart';
27 import 'info/send_info.dart' show 19 import 'info/send_info.dart' show collectSendMeasurements;
28 collectSendMeasurements; 20 import 'js_backend/js_backend.dart' show JavaScriptBackend;
29 import 'js_backend/js_backend.dart' show 21 import 'js_emitter/full_emitter/emitter.dart' as full show Emitter;
30 JavaScriptBackend;
31 import 'js_emitter/full_emitter/emitter.dart' as full show
32 Emitter;
33 import 'js/js.dart' as jsAst; 22 import 'js/js.dart' as jsAst;
34 import 'types/types.dart' show 23 import 'types/types.dart' show TypeMask;
35 TypeMask; 24 import 'universe/universe.dart' show ReceiverConstraint;
36 import 'universe/universe.dart' show 25 import 'universe/world_impact.dart'
37 ReceiverConstraint; 26 show ImpactUseCase, WorldImpact, WorldImpactVisitorImpl;
38 import 'universe/world_impact.dart' show
39 ImpactUseCase,
40 WorldImpact,
41 WorldImpactVisitorImpl;
42 27
43 class ElementInfoCollector extends BaseElementVisitor<Info, dynamic> { 28 class ElementInfoCollector extends BaseElementVisitor<Info, dynamic> {
44 final Compiler compiler; 29 final Compiler compiler;
45 30
46 final AllInfo result = new AllInfo(); 31 final AllInfo result = new AllInfo();
47 final Map<Element, Info> _elementToInfo = <Element, Info>{}; 32 final Map<Element, Info> _elementToInfo = <Element, Info>{};
48 final Map<ConstantValue, Info> _constantToInfo = <ConstantValue, Info>{}; 33 final Map<ConstantValue, Info> _constantToInfo = <ConstantValue, Info>{};
49 final Map<OutputUnit, OutputUnitInfo> _outputToInfo = {}; 34 final Map<OutputUnit, OutputUnitInfo> _outputToInfo = {};
50 35
51 ElementInfoCollector(this.compiler); 36 ElementInfoCollector(this.compiler);
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 * used and the selector that selected the element. 431 * used and the selector that selected the element.
447 */ 432 */
448 Iterable<Selection> getRetaining(Element element) { 433 Iterable<Selection> getRetaining(Element element) {
449 WorldImpact impact = impacts[element]; 434 WorldImpact impact = impacts[element];
450 if (impact == null) return const <Selection>[]; 435 if (impact == null) return const <Selection>[];
451 436
452 var selections = <Selection>[]; 437 var selections = <Selection>[];
453 compiler.impactStrategy.visitImpact( 438 compiler.impactStrategy.visitImpact(
454 element, 439 element,
455 impact, 440 impact,
456 new WorldImpactVisitorImpl( 441 new WorldImpactVisitorImpl(visitDynamicUse: (dynamicUse) {
457 visitDynamicUse: (dynamicUse) { 442 selections.addAll(compiler.world.allFunctions
458 selections.addAll(compiler.world.allFunctions 443 .filter(dynamicUse.selector, dynamicUse.mask)
459 .filter(dynamicUse.selector, dynamicUse.mask) 444 .map((e) => new Selection(e, dynamicUse.mask)));
460 .map((e) => new Selection(e, dynamicUse.mask))); 445 }, visitStaticUse: (staticUse) {
461 }, 446 selections.add(new Selection(staticUse.element, null));
462 visitStaticUse: (staticUse) { 447 }),
463 selections.add(new Selection(staticUse.element, null));
464 }
465 ),
466 IMPACT_USE); 448 IMPACT_USE);
467 return selections; 449 return selections;
468 } 450 }
469 451
470 // Returns true if we care about tracking the size of 452 // Returns true if we care about tracking the size of
471 // this node. 453 // this node.
472 bool isTracking(jsAst.Node code) { 454 bool isTracking(jsAst.Node code) {
473 if (compiler.options.dumpInfo) { 455 if (compiler.options.dumpInfo) {
474 return _tracking.contains(code); 456 return _tracking.contains(code);
475 } else { 457 } else {
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 587
606 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 588 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
607 new StringConversionSink.fromStringSink(buffer)); 589 new StringConversionSink.fromStringSink(buffer));
608 sink.add(new AllInfoJsonCodec().encode(result)); 590 sink.add(new AllInfoJsonCodec().encode(result));
609 reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 591 reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
610 'text': "View the dumped .info.json file at " 592 'text': "View the dumped .info.json file at "
611 "https://dart-lang.github.io/dump-info-visualizer" 593 "https://dart-lang.github.io/dump-info-visualizer"
612 }); 594 });
613 } 595 }
614 } 596 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/diagnostics/spannable.dart ('k') | pkg/compiler/lib/src/elements/common.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698