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

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

Issue 1279093003: dart2js: dump info about dependencies added by the enqueuer (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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
« no previous file with comments | « no previous file | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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' 7 import 'dart:convert'
8 show HtmlEscape, JsonEncoder, StringConversionSink, ChunkedConversionSink; 8 show HtmlEscape, JsonEncoder, StringConversionSink, ChunkedConversionSink;
9 9
10 import 'elements/elements.dart'; 10 import 'elements/elements.dart';
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 * function body 360 * function body
361 */ 361 */
362 void elementUsesSelector(Element element, UniverseSelector selector) { 362 void elementUsesSelector(Element element, UniverseSelector selector) {
363 if (compiler.dumpInfo) { 363 if (compiler.dumpInfo) {
364 selectorsFromElement 364 selectorsFromElement
365 .putIfAbsent(element, () => new Set<UniverseSelector>()) 365 .putIfAbsent(element, () => new Set<UniverseSelector>())
366 .add(selector); 366 .add(selector);
367 } 367 }
368 } 368 }
369 369
370 final Map<Element, List<Element>> _dependencies = {};
371 void registerDependency(Element source, Element target) {
372 _dependencies.putIfAbsent(source, () => new Set()).add(target);
373 }
374
370 /** 375 /**
371 * Returns an iterable of [Selection]s that are used by 376 * Returns an iterable of [Selection]s that are used by
372 * [element]. Each [Selection] contains an element that is 377 * [element]. Each [Selection] contains an element that is
373 * used and the selector that selected the element. 378 * used and the selector that selected the element.
374 */ 379 */
375 Iterable<Selection> getRetaining(Element element) { 380 Iterable<Selection> getRetaining(Element element) {
376 if (!selectorsFromElement.containsKey(element)) { 381 if (!selectorsFromElement.containsKey(element)) {
377 return const <Selection>[]; 382 return const <Selection>[];
378 } else { 383 } else {
379 return selectorsFromElement[element].expand((UniverseSelector selector) { 384 return selectorsFromElement[element].expand((UniverseSelector selector) {
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 CodeInfo outerInfo = infoCollector._elementToInfo[element]; 494 CodeInfo outerInfo = infoCollector._elementToInfo[element];
490 if (outerInfo == null) continue; 495 if (outerInfo == null) continue;
491 for (Element inlined in inlineMap[element]) { 496 for (Element inlined in inlineMap[element]) {
492 Info inlinedInfo = infoCollector._elementToInfo[inlined]; 497 Info inlinedInfo = infoCollector._elementToInfo[inlined];
493 if (inlinedInfo == null) continue; 498 if (inlinedInfo == null) continue;
494 outerInfo.uses.add(new DependencyInfo(inlinedInfo, 'inlined')); 499 outerInfo.uses.add(new DependencyInfo(inlinedInfo, 'inlined'));
495 } 500 }
496 } 501 }
497 502
498 AllInfo result = infoCollector.result; 503 AllInfo result = infoCollector.result;
504
505 for (Element element in _dependencies.keys) {
506 var a = infoCollector._elementToInfo[element];
507 if (a == null) continue;
508 result.dependencies[a] = _dependencies[element]
509 .map((o) => infoCollector._elementToInfo[o])
510 .where((o) => o != null)
511 .toList();
512 }
513
499 result.deferredFiles = compiler.deferredLoadTask.computeDeferredMap(); 514 result.deferredFiles = compiler.deferredLoadTask.computeDeferredMap();
500 stopwatch.stop(); 515 stopwatch.stop();
501 result.program = new ProgramInfo( 516 result.program = new ProgramInfo(
502 size: _programSize, 517 size: _programSize,
503 dart2jsVersion: compiler.hasBuildId ? compiler.buildId : null, 518 dart2jsVersion: compiler.hasBuildId ? compiler.buildId : null,
504 compilationMoment: new DateTime.now(), 519 compilationMoment: new DateTime.now(),
505 compilationDuration: compiler.totalCompileTime.elapsed, 520 compilationDuration: compiler.totalCompileTime.elapsed,
506 toJsonDuration: stopwatch.elapsedMilliseconds, 521 toJsonDuration: stopwatch.elapsedMilliseconds,
507 dumpInfoDuration: this.timing, 522 dumpInfoDuration: this.timing,
508 noSuchMethodEnabled: compiler.backend.enabledNoSuchMethod, 523 noSuchMethodEnabled: compiler.backend.enabledNoSuchMethod,
509 minified: compiler.enableMinification); 524 minified: compiler.enableMinification);
510 525
511 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 526 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
512 new StringConversionSink.fromStringSink(buffer)); 527 new StringConversionSink.fromStringSink(buffer));
513 sink.add(result.toJson()); 528 sink.add(result.toJson());
514 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 529 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
515 'text': "View the dumped .info.json file at " 530 'text': "View the dumped .info.json file at "
516 "https://dart-lang.github.io/dump-info-visualizer" 531 "https://dart-lang.github.io/dump-info-visualizer"
517 }); 532 });
518 } 533 }
519 } 534 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698