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

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

Issue 1288593002: dart2js: add function coverage tracking in dart2js output, dumpinfo, and (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/info/info.dart » ('j') | pkg/compiler/lib/src/info/info.dart » ('J')
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 'common/tasks.dart' show 10 import 'common/tasks.dart' show
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 int size = compiler.dumpInfoTask.sizeOf(element); 121 int size = compiler.dumpInfoTask.sizeOf(element);
122 String code; 122 String code;
123 StringBuffer emittedCode = compiler.dumpInfoTask.codeOf(element); 123 StringBuffer emittedCode = compiler.dumpInfoTask.codeOf(element);
124 if (emittedCode != null) { 124 if (emittedCode != null) {
125 size += emittedCode.length; 125 size += emittedCode.length;
126 code = emittedCode.toString(); 126 code = emittedCode.toString();
127 } 127 }
128 128
129 FieldInfo info = new FieldInfo( 129 FieldInfo info = new FieldInfo(
130 name: element.name, 130 name: element.name,
131 coverageId: '${element.hashCode}',
sra1 2015/08/13 22:27:26 Add comment that this is unique.
Siggi Cherem (dart-lang) 2015/08/13 23:40:20 Done.
131 type: '${element.type}', 132 type: '${element.type}',
132 inferredType: '$inferredType', 133 inferredType: '$inferredType',
133 size: size, 134 size: size,
134 code: code, 135 code: code,
135 outputUnit: _unitInfoForElement(element)); 136 outputUnit: _unitInfoForElement(element));
136 _elementToInfo[element] = info; 137 _elementToInfo[element] = info;
137 138
138 List<FunctionInfo> nestedClosures = <FunctionInfo>[]; 139 List<FunctionInfo> nestedClosures = <FunctionInfo>[];
139 for (Element closure in element.nestedClosures) { 140 for (Element closure in element.nestedClosures) {
140 Info child = this.process(closure); 141 Info child = this.process(closure);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
261 } 262 }
262 String inferredReturnType = 263 String inferredReturnType =
263 '${compiler.typesTask.getGuaranteedReturnTypeOfElement(element)}'; 264 '${compiler.typesTask.getGuaranteedReturnTypeOfElement(element)}';
264 String sideEffects = '${compiler.world.getSideEffectsOfElement(element)}'; 265 String sideEffects = '${compiler.world.getSideEffectsOfElement(element)}';
265 266
266 int inlinedCount = compiler.dumpInfoTask.inlineCount[element]; 267 int inlinedCount = compiler.dumpInfoTask.inlineCount[element];
267 if (inlinedCount == null) inlinedCount = 0; 268 if (inlinedCount == null) inlinedCount = 0;
268 269
269 FunctionInfo info = new FunctionInfo( 270 FunctionInfo info = new FunctionInfo(
270 name: name, 271 name: name,
272 coverageId: '${element.hashCode}',
271 modifiers: modifiers, 273 modifiers: modifiers,
272 size: size, 274 size: size,
273 returnType: returnType, 275 returnType: returnType,
274 inferredReturnType: inferredReturnType, 276 inferredReturnType: inferredReturnType,
275 parameters: parameters, 277 parameters: parameters,
276 sideEffects: sideEffects, 278 sideEffects: sideEffects,
277 inlinedCount: inlinedCount, 279 inlinedCount: inlinedCount,
278 code: code, 280 code: code,
279 type: element.type.toString(), 281 type: element.type.toString(),
280 outputUnit: _unitInfoForElement(element)); 282 outputUnit: _unitInfoForElement(element));
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
532 534
533 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 535 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
534 new StringConversionSink.fromStringSink(buffer)); 536 new StringConversionSink.fromStringSink(buffer));
535 sink.add(result.toJson()); 537 sink.add(result.toJson());
536 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 538 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
537 'text': "View the dumped .info.json file at " 539 'text': "View the dumped .info.json file at "
538 "https://dart-lang.github.io/dump-info-visualizer" 540 "https://dart-lang.github.io/dump-info-visualizer"
539 }); 541 });
540 } 542 }
541 } 543 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/info/info.dart » ('j') | pkg/compiler/lib/src/info/info.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698