Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 Loading... | |
| 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 Loading... | |
| 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 } |
| OLD | NEW |