| 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 ChunkedConversionSink, JsonEncoder, StringConversionSink; | 8 show ChunkedConversionSink, JsonEncoder, StringConversionSink; |
| 9 | 9 |
| 10 import 'package:dart2js_info/info.dart'; | 10 import 'package:dart2js_info/info.dart'; |
| (...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 parameter.name, | 259 parameter.name, |
| 260 '${compiler.globalInference.getGuaranteedTypeOfElement(parameter)}', | 260 '${compiler.globalInference.getGuaranteedTypeOfElement(parameter)}', |
| 261 '${parameter.node.type}')); | 261 '${parameter.node.type}')); |
| 262 }); | 262 }); |
| 263 } | 263 } |
| 264 | 264 |
| 265 String returnType = null; | 265 String returnType = null; |
| 266 // TODO(sigmund): why all these checks? | 266 // TODO(sigmund): why all these checks? |
| 267 if (element.isInstanceMember && | 267 if (element.isInstanceMember && |
| 268 !element.isAbstract && | 268 !element.isAbstract && |
| 269 compiler.world.allFunctions.contains(element)) { | 269 compiler.closedWorld.allFunctions.contains(element)) { |
| 270 returnType = '${element.type.returnType}'; | 270 returnType = '${element.type.returnType}'; |
| 271 } | 271 } |
| 272 String inferredReturnType = | 272 String inferredReturnType = |
| 273 '${compiler.globalInference.getGuaranteedReturnTypeOfElement(element)}'; | 273 '${compiler.globalInference.getGuaranteedReturnTypeOfElement(element)}'; |
| 274 String sideEffects = '${compiler.world.getSideEffectsOfElement(element)}'; | 274 String sideEffects = |
| 275 '${compiler.closedWorld.getSideEffectsOfElement(element)}'; |
| 275 | 276 |
| 276 int inlinedCount = compiler.dumpInfoTask.inlineCount[element]; | 277 int inlinedCount = compiler.dumpInfoTask.inlineCount[element]; |
| 277 if (inlinedCount == null) inlinedCount = 0; | 278 if (inlinedCount == null) inlinedCount = 0; |
| 278 | 279 |
| 279 FunctionInfo info = new FunctionInfo( | 280 FunctionInfo info = new FunctionInfo( |
| 280 name: name, | 281 name: name, |
| 281 functionKind: kind, | 282 functionKind: kind, |
| 282 // We use element.hashCode because it is globally unique and it is | 283 // We use element.hashCode because it is globally unique and it is |
| 283 // available while we are doing codegen. | 284 // available while we are doing codegen. |
| 284 coverageId: '${element.hashCode}', | 285 coverageId: '${element.hashCode}', |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 431 */ | 432 */ |
| 432 Iterable<Selection> getRetaining(Element element) { | 433 Iterable<Selection> getRetaining(Element element) { |
| 433 WorldImpact impact = impacts[element]; | 434 WorldImpact impact = impacts[element]; |
| 434 if (impact == null) return const <Selection>[]; | 435 if (impact == null) return const <Selection>[]; |
| 435 | 436 |
| 436 var selections = <Selection>[]; | 437 var selections = <Selection>[]; |
| 437 compiler.impactStrategy.visitImpact( | 438 compiler.impactStrategy.visitImpact( |
| 438 element, | 439 element, |
| 439 impact, | 440 impact, |
| 440 new WorldImpactVisitorImpl(visitDynamicUse: (dynamicUse) { | 441 new WorldImpactVisitorImpl(visitDynamicUse: (dynamicUse) { |
| 441 selections.addAll(compiler.world.allFunctions | 442 selections.addAll(compiler.closedWorld.allFunctions |
| 442 .filter(dynamicUse.selector, dynamicUse.mask) | 443 .filter(dynamicUse.selector, dynamicUse.mask) |
| 443 .map((e) => new Selection(e, dynamicUse.mask))); | 444 .map((e) => new Selection(e, dynamicUse.mask))); |
| 444 }, visitStaticUse: (staticUse) { | 445 }, visitStaticUse: (staticUse) { |
| 445 selections.add(new Selection(staticUse.element, null)); | 446 selections.add(new Selection(staticUse.element, null)); |
| 446 }), | 447 }), |
| 447 IMPACT_USE); | 448 IMPACT_USE); |
| 448 return selections; | 449 return selections; |
| 449 } | 450 } |
| 450 | 451 |
| 451 // Returns true if we care about tracking the size of | 452 // Returns true if we care about tracking the size of |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 | 587 |
| 587 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( | 588 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( |
| 588 new StringConversionSink.fromStringSink(buffer)); | 589 new StringConversionSink.fromStringSink(buffer)); |
| 589 sink.add(new AllInfoJsonCodec().encode(result)); | 590 sink.add(new AllInfoJsonCodec().encode(result)); |
| 590 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { | 591 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { |
| 591 'text': "View the dumped .info.json file at " | 592 'text': "View the dumped .info.json file at " |
| 592 "https://dart-lang.github.io/dump-info-visualizer" | 593 "https://dart-lang.github.io/dump-info-visualizer" |
| 593 }); | 594 }); |
| 594 } | 595 } |
| 595 } | 596 } |
| OLD | NEW |