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

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

Issue 2860733002: Remove ClosedWorld.allFunctions (Closed)
Patch Set: Created 3 years, 7 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 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 kind = FunctionInfo.CONSTRUCTOR_FUNCTION_KIND; 255 kind = FunctionInfo.CONSTRUCTOR_FUNCTION_KIND;
256 } 256 }
257 257
258 FunctionModifiers modifiers = new FunctionModifiers( 258 FunctionModifiers modifiers = new FunctionModifiers(
259 isStatic: element.isStatic, 259 isStatic: element.isStatic,
260 isConst: element.isConst, 260 isConst: element.isConst,
261 isFactory: element.isFactoryConstructor, 261 isFactory: element.isFactoryConstructor,
262 isExternal: element.isPatched); 262 isExternal: element.isPatched);
263 String code = compiler.dumpInfoTask.codeOf(element); 263 String code = compiler.dumpInfoTask.codeOf(element);
264 264
265 String returnType = null;
265 List<ParameterInfo> parameters = <ParameterInfo>[]; 266 List<ParameterInfo> parameters = <ParameterInfo>[];
266 if (element.hasFunctionSignature) { 267 if (element.hasFunctionSignature) {
267 FunctionSignature signature = element.functionSignature; 268 FunctionSignature signature = element.functionSignature;
268 signature.forEachParameter((parameter) { 269 signature.forEachParameter((parameter) {
269 parameters.add(new ParameterInfo(parameter.name, 270 parameters.add(new ParameterInfo(parameter.name,
270 '${_resultOfParameter(parameter).type}', '${parameter.node.type}')); 271 '${_resultOfParameter(parameter).type}', '${parameter.node.type}'));
271 }); 272 });
273 returnType = '${element.type.returnType}';
272 } 274 }
273 275
274 String returnType = null;
275 // TODO(sigmund): why all these checks?
276 if (element.isInstanceMember &&
277 !element.isAbstract &&
278 closedWorld.allFunctions.contains(element as MemberElement)) {
279 returnType = '${element.type.returnType}';
280 }
Johnni Winther 2017/05/03 13:54:51 This seemed to be an attempt at only pulling the r
281 String inferredReturnType = '${_resultOfElement(element).returnType}'; 276 String inferredReturnType = '${_resultOfElement(element).returnType}';
282 String sideEffects = '${closedWorld.getSideEffectsOfElement(element)}'; 277 String sideEffects = '${closedWorld.getSideEffectsOfElement(element)}';
283 278
284 int inlinedCount = compiler.dumpInfoTask.inlineCount[element]; 279 int inlinedCount = compiler.dumpInfoTask.inlineCount[element];
285 if (inlinedCount == null) inlinedCount = 0; 280 if (inlinedCount == null) inlinedCount = 0;
286 281
287 FunctionInfo info = new FunctionInfo( 282 FunctionInfo info = new FunctionInfo(
288 name: name, 283 name: name,
289 functionKind: kind, 284 functionKind: kind,
290 modifiers: modifiers, 285 modifiers: modifiers,
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 */ 449 */
455 Iterable<Selection> getRetaining(Element element, ClosedWorld closedWorld) { 450 Iterable<Selection> getRetaining(Element element, ClosedWorld closedWorld) {
456 WorldImpact impact = impacts[element]; 451 WorldImpact impact = impacts[element];
457 if (impact == null) return const <Selection>[]; 452 if (impact == null) return const <Selection>[];
458 453
459 var selections = <Selection>[]; 454 var selections = <Selection>[];
460 compiler.impactStrategy.visitImpact( 455 compiler.impactStrategy.visitImpact(
461 element, 456 element,
462 impact, 457 impact,
463 new WorldImpactVisitorImpl(visitDynamicUse: (dynamicUse) { 458 new WorldImpactVisitorImpl(visitDynamicUse: (dynamicUse) {
464 selections.addAll(closedWorld.allFunctions 459 selections.addAll(closedWorld
465 .filter(dynamicUse.selector, dynamicUse.mask) 460 .locateMembers(dynamicUse.selector, dynamicUse.mask)
466 .map((MemberElement e) => new Selection(e, dynamicUse.mask))); 461 .map((MemberElement e) => new Selection(e, dynamicUse.mask)));
467 }, visitStaticUse: (staticUse) { 462 }, visitStaticUse: (staticUse) {
468 selections.add(new Selection(staticUse.element, null)); 463 selections.add(new Selection(staticUse.element, null));
469 }), 464 }),
470 IMPACT_USE); 465 IMPACT_USE);
471 return selections; 466 return selections;
472 } 467 }
473 468
474 // Returns true if we care about tracking the size of 469 // Returns true if we care about tracking the size of
475 // this node. 470 // this node.
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
617 612
618 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion( 613 ChunkedConversionSink<Object> sink = encoder.startChunkedConversion(
619 new StringConversionSink.fromStringSink(buffer)); 614 new StringConversionSink.fromStringSink(buffer));
620 sink.add(new AllInfoJsonCodec().encode(result)); 615 sink.add(new AllInfoJsonCodec().encode(result));
621 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, { 616 compiler.reporter.reportInfo(NO_LOCATION_SPANNABLE, MessageKind.GENERIC, {
622 'text': "View the dumped .info.json file at " 617 'text': "View the dumped .info.json file at "
623 "https://dart-lang.github.io/dump-info-visualizer" 618 "https://dart-lang.github.io/dump-info-visualizer"
624 }); 619 });
625 } 620 }
626 } 621 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/builder.dart » ('j') | pkg/compiler/lib/src/universe/function_set.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698