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

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
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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 int size = compiler.dumpInfoTask.sizeOf(element); 114 int size = compiler.dumpInfoTask.sizeOf(element);
115 String code; 115 String code;
116 StringBuffer emittedCode = compiler.dumpInfoTask.codeOf(element); 116 StringBuffer emittedCode = compiler.dumpInfoTask.codeOf(element);
117 if (emittedCode != null) { 117 if (emittedCode != null) {
118 size += emittedCode.length; 118 size += emittedCode.length;
119 code = emittedCode.toString(); 119 code = emittedCode.toString();
120 } 120 }
121 121
122 FieldInfo info = new FieldInfo( 122 FieldInfo info = new FieldInfo(
123 name: element.name, 123 name: element.name,
124 coverageId: '${element.hashCode}',
124 type: '${element.type}', 125 type: '${element.type}',
125 inferredType: '$inferredType', 126 inferredType: '$inferredType',
126 size: size, 127 size: size,
127 code: code, 128 code: code,
128 outputUnit: _unitInfoForElement(element)); 129 outputUnit: _unitInfoForElement(element));
129 _elementToInfo[element] = info; 130 _elementToInfo[element] = info;
130 131
131 List<FunctionInfo> nestedClosures = <FunctionInfo>[]; 132 List<FunctionInfo> nestedClosures = <FunctionInfo>[];
132 for (Element closure in element.nestedClosures) { 133 for (Element closure in element.nestedClosures) {
133 Info child = this.process(closure); 134 Info child = this.process(closure);
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 255 }
255 String inferredReturnType = 256 String inferredReturnType =
256 '${compiler.typesTask.getGuaranteedReturnTypeOfElement(element)}'; 257 '${compiler.typesTask.getGuaranteedReturnTypeOfElement(element)}';
257 String sideEffects = '${compiler.world.getSideEffectsOfElement(element)}'; 258 String sideEffects = '${compiler.world.getSideEffectsOfElement(element)}';
258 259
259 int inlinedCount = compiler.dumpInfoTask.inlineCount[element]; 260 int inlinedCount = compiler.dumpInfoTask.inlineCount[element];
260 if (inlinedCount == null) inlinedCount = 0; 261 if (inlinedCount == null) inlinedCount = 0;
261 262
262 FunctionInfo info = new FunctionInfo( 263 FunctionInfo info = new FunctionInfo(
263 name: name, 264 name: name,
265 coverageId: '${element.hashCode}',
264 modifiers: modifiers, 266 modifiers: modifiers,
265 size: size, 267 size: size,
266 returnType: returnType, 268 returnType: returnType,
267 inferredReturnType: inferredReturnType, 269 inferredReturnType: inferredReturnType,
268 parameters: parameters, 270 parameters: parameters,
269 sideEffects: sideEffects, 271 sideEffects: sideEffects,
270 inlinedCount: inlinedCount, 272 inlinedCount: inlinedCount,
271 code: code, 273 code: code,
272 type: element.type.toString(), 274 type: element.type.toString(),
273 outputUnit: _unitInfoForElement(element)); 275 outputUnit: _unitInfoForElement(element));
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 527
526 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 528 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
527 new StringConversionSink.fromStringSink(buffer)); 529 new StringConversionSink.fromStringSink(buffer));
528 sink.add(result.toJson()); 530 sink.add(result.toJson());
529 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 531 compiler.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
530 'text': "View the dumped .info.json file at " 532 'text': "View the dumped .info.json file at "
531 "https://dart-lang.github.io/dump-info-visualizer" 533 "https://dart-lang.github.io/dump-info-visualizer"
532 }); 534 });
533 } 535 }
534 } 536 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/info/info.dart » ('j') | pkg/compiler/tool/coverage_log_server.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698