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

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

Issue 2690063002: Refactor CompilerOutput (Closed)
Patch Set: Updated cf. comments Created 3 years, 10 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 | « pkg/compiler/lib/src/dart2js.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_dump.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 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 '../compiler_new.dart';
12 import 'closure.dart'; 13 import 'closure.dart';
13 import 'common/tasks.dart' show CompilerTask; 14 import 'common/tasks.dart' show CompilerTask;
14 import 'common.dart'; 15 import 'common.dart';
15 import 'compiler.dart' show Compiler; 16 import 'compiler.dart' show Compiler;
16 import 'constants/values.dart' show ConstantValue, InterceptorConstantValue; 17 import 'constants/values.dart' show ConstantValue, InterceptorConstantValue;
17 import 'deferred_load.dart' show OutputUnit; 18 import 'deferred_load.dart' show OutputUnit;
18 import 'elements/elements.dart'; 19 import 'elements/elements.dart';
19 import 'elements/entities.dart'; 20 import 'elements/entities.dart';
20 import 'elements/visitor.dart'; 21 import 'elements/visitor.dart';
21 import 'js/js.dart' as jsAst; 22 import 'js/js.dart' as jsAst;
(...skipping 510 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 sb.writeln(jsAst.prettyPrint(ast, compiler)); 533 sb.writeln(jsAst.prettyPrint(ast, compiler));
533 } 534 }
534 return sb.toString(); 535 return sb.toString();
535 } 536 }
536 537
537 void dumpInfo(ClosedWorld closedWorld) { 538 void dumpInfo(ClosedWorld closedWorld) {
538 measure(() { 539 measure(() {
539 infoCollector = new ElementInfoCollector(compiler, closedWorld)..run(); 540 infoCollector = new ElementInfoCollector(compiler, closedWorld)..run();
540 StringBuffer jsonBuffer = new StringBuffer(); 541 StringBuffer jsonBuffer = new StringBuffer();
541 dumpInfoJson(jsonBuffer, closedWorld); 542 dumpInfoJson(jsonBuffer, closedWorld);
542 compiler.outputProvider('', 'info.json') 543 compiler.outputProvider(compiler.options.outputUri.pathSegments.last,
544 'info.json', OutputType.info)
543 ..add(jsonBuffer.toString()) 545 ..add(jsonBuffer.toString())
544 ..close(); 546 ..close();
545 }); 547 });
546 } 548 }
547 549
548 void dumpInfoJson(StringSink buffer, ClosedWorld closedWorld) { 550 void dumpInfoJson(StringSink buffer, ClosedWorld closedWorld) {
549 JsonEncoder encoder = const JsonEncoder.withIndent(' '); 551 JsonEncoder encoder = const JsonEncoder.withIndent(' ');
550 Stopwatch stopwatch = new Stopwatch(); 552 Stopwatch stopwatch = new Stopwatch();
551 stopwatch.start(); 553 stopwatch.start();
552 554
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
606 608
607 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 609 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
608 new StringConversionSink.fromStringSink(buffer)); 610 new StringConversionSink.fromStringSink(buffer));
609 sink.add(new AllInfoJsonCodec().encode(result)); 611 sink.add(new AllInfoJsonCodec().encode(result));
610 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 612 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
611 'text': "View the dumped .info.json file at " 613 'text': "View the dumped .info.json file at "
612 "https://dart-lang.github.io/dump-info-visualizer" 614 "https://dart-lang.github.io/dump-info-visualizer"
613 }); 615 });
614 } 616 }
615 } 617 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/dart2js.dart ('k') | pkg/compiler/lib/src/inferrer/type_graph_dump.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698