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

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

Issue 1226733010: dart2js: Remove oldEmitter field in emitter-task. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 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/js_emitter/code_emitter_task.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' show 7 import 'dart:convert' show
8 HtmlEscape, 8 HtmlEscape,
9 JsonEncoder, 9 JsonEncoder,
10 StringConversionSink, 10 StringConversionSink,
11 ChunkedConversionSink; 11 ChunkedConversionSink;
12 12
13 import 'elements/elements.dart'; 13 import 'elements/elements.dart';
14 import 'elements/visitor.dart'; 14 import 'elements/visitor.dart';
15 import 'dart2jslib.dart' show 15 import 'dart2jslib.dart' show
16 Backend, 16 Backend,
17 CodeBuffer, 17 CodeBuffer,
18 Compiler, 18 Compiler,
19 CompilerTask, 19 CompilerTask,
20 MessageKind; 20 MessageKind;
21 import 'types/types.dart' show TypeMask; 21 import 'types/types.dart' show TypeMask;
22 import 'deferred_load.dart' show OutputUnit; 22 import 'deferred_load.dart' show OutputUnit;
23 import 'js_backend/js_backend.dart' show JavaScriptBackend; 23 import 'js_backend/js_backend.dart' show JavaScriptBackend;
24 import 'js_emitter/js_emitter.dart' show OldEmitter;
24 import 'js/js.dart' as jsAst; 25 import 'js/js.dart' as jsAst;
25 import 'universe/universe.dart' show Selector, UniverseSelector; 26 import 'universe/universe.dart' show Selector, UniverseSelector;
26 import 'util/util.dart' show NO_LOCATION_SPANNABLE; 27 import 'util/util.dart' show NO_LOCATION_SPANNABLE;
27 28
28 /// Maps objects to an id. Supports lookups in 29 /// Maps objects to an id. Supports lookups in
29 /// both directions. 30 /// both directions.
30 class IdMapper<T>{ 31 class IdMapper<T>{
31 Map<int, T> _idToElement = {}; 32 Map<int, T> _idToElement = {};
32 Map<T, int> _elementToId = {}; 33 Map<T, int> _elementToId = {};
33 int _idCounter = 0; 34 int _idCounter = 0;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
589 }); 590 });
590 } 591 }
591 } 592 }
592 } 593 }
593 } 594 }
594 595
595 List<Map<String, dynamic>> outputUnits = 596 List<Map<String, dynamic>> outputUnits =
596 new List<Map<String, dynamic>>(); 597 new List<Map<String, dynamic>>();
597 598
598 JavaScriptBackend backend = compiler.backend; 599 JavaScriptBackend backend = compiler.backend;
600 // Dump-info currently only works with the full emitter. If another
601 // emitter is used it will fail here.
602 OldEmitter fullEmitter = backend.emitter.emitter;
599 603
600 for (OutputUnit outputUnit in 604 for (OutputUnit outputUnit in
601 infoCollector.mapper._outputUnit._elementToId.keys) { 605 infoCollector.mapper._outputUnit._elementToId.keys) {
602 String id = infoCollector.mapper._outputUnit.add(outputUnit); 606 String id = infoCollector.mapper._outputUnit.add(outputUnit);
603 outputUnits.add(<String, dynamic> { 607 outputUnits.add(<String, dynamic> {
604 'id': id, 608 'id': id,
605 'name': outputUnit.name, 609 'name': outputUnit.name,
606 'size': backend.emitter.oldEmitter.outputBuffers[outputUnit].length, 610 'size': fullEmitter.outputBuffers[outputUnit].length,
607 }); 611 });
608 } 612 }
609 613
610 Map<String, dynamic> outJson = { 614 Map<String, dynamic> outJson = {
611 'elements': infoCollector.toJson(), 615 'elements': infoCollector.toJson(),
612 'holding': holding, 616 'holding': holding,
613 'outputUnits': outputUnits, 617 'outputUnits': outputUnits,
614 'dump_version': 3, 618 'dump_version': 3,
615 'deferredFiles': compiler.deferredLoadTask.computeDeferredMap(), 619 'deferredFiles': compiler.deferredLoadTask.computeDeferredMap(),
616 // This increases when new information is added to the map, but the viewer 620 // This increases when new information is added to the map, but the viewer
(...skipping 17 matching lines...) Expand all
634 ChunkedConversionSink<Object> sink = 638 ChunkedConversionSink<Object> sink =
635 encoder.startChunkedConversion( 639 encoder.startChunkedConversion(
636 new StringConversionSink.fromStringSink(buffer)); 640 new StringConversionSink.fromStringSink(buffer));
637 sink.add(outJson); 641 sink.add(outJson);
638 compiler.reportInfo(NO_LOCATION_SPANNABLE, 642 compiler.reportInfo(NO_LOCATION_SPANNABLE,
639 const MessageKind( 643 const MessageKind(
640 "View the dumped .info.json file at " 644 "View the dumped .info.json file at "
641 "https://dart-lang.github.io/dump-info-visualizer")); 645 "https://dart-lang.github.io/dump-info-visualizer"));
642 } 646 }
643 } 647 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_emitter/code_emitter_task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698