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

Side by Side Diff: pkg/compiler/lib/src/inferrer/inferrer_engine.dart

Issue 2814973003: Extract ClosedWorldRefiner implementation from ClosedWorldImpl to ClosedWorldBase (Closed)
Patch Set: Created 3 years, 8 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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 import 'package:kernel/ast.dart' as ir; 5 import 'package:kernel/ast.dart' as ir;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart'; 8 import '../common/names.dart';
9 import '../compiler.dart'; 9 import '../compiler.dart';
10 import '../constants/expressions.dart'; 10 import '../constants/expressions.dart';
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
125 sideEffects.setDependsOnStaticPropertyStore(); 125 sideEffects.setDependsOnStaticPropertyStore();
126 } else { 126 } else {
127 sideEffects.setAllSideEffects(); 127 sideEffects.setAllSideEffects();
128 sideEffects.setDependsOnSomething(); 128 sideEffects.setDependsOnSomething();
129 } 129 }
130 } 130 }
131 } else if (callee.isGetter && !selector.isGetter) { 131 } else if (callee.isGetter && !selector.isGetter) {
132 sideEffects.setAllSideEffects(); 132 sideEffects.setAllSideEffects();
133 sideEffects.setDependsOnSomething(); 133 sideEffects.setDependsOnSomething();
134 } else { 134 } else {
135 sideEffects.add(closedWorldRefiner.getCurrentlyKnownSideEffects(callee)); 135 sideEffects.add(
136 closedWorldRefiner.getCurrentlyKnownSideEffects(callee.declaration));
136 } 137 }
137 } 138 }
138 139
139 /** 140 /**
140 * Returns the type for [nativeBehavior]. See documentation on 141 * Returns the type for [nativeBehavior]. See documentation on
141 * [native.NativeBehavior]. 142 * [native.NativeBehavior].
142 */ 143 */
143 TypeInformation typeOfNativeBehavior(native.NativeBehavior nativeBehavior) { 144 TypeInformation typeOfNativeBehavior(native.NativeBehavior nativeBehavior) {
144 if (nativeBehavior == null) return types.dynamicType; 145 if (nativeBehavior == null) return types.dynamicType;
145 List typesReturned = nativeBehavior.typesReturned; 146 List typesReturned = nativeBehavior.typesReturned;
(...skipping 404 matching lines...) Expand 10 before | Expand all | Expand 10 after
550 } 551 }
551 } else { 552 } else {
552 recordReturnType(element, type); 553 recordReturnType(element, type);
553 } 554 }
554 } 555 }
555 556
556 void processLoopInformation() { 557 void processLoopInformation() {
557 types.allocatedCalls.forEach((info) { 558 types.allocatedCalls.forEach((info) {
558 if (!info.inLoop) return; 559 if (!info.inLoop) return;
559 if (info is StaticCallSiteTypeInformation) { 560 if (info is StaticCallSiteTypeInformation) {
560 closedWorldRefiner.addFunctionCalledInLoop(info.calledElement); 561 closedWorldRefiner
562 .addFunctionCalledInLoop(info.calledElement.declaration);
561 } else if (info.mask != null && !info.mask.containsAll(closedWorld)) { 563 } else if (info.mask != null && !info.mask.containsAll(closedWorld)) {
562 // For instance methods, we only register a selector called in a 564 // For instance methods, we only register a selector called in a
563 // loop if it is a typed selector, to avoid marking too many 565 // loop if it is a typed selector, to avoid marking too many
564 // methods as being called from within a loop. This cuts down 566 // methods as being called from within a loop. This cuts down
565 // on the code bloat. 567 // on the code bloat.
566 info.targets.forEach((MemberElement element) { 568 info.targets.forEach((MemberElement element) {
567 closedWorldRefiner.addFunctionCalledInLoop(element); 569 closedWorldRefiner.addFunctionCalledInLoop(element);
568 }); 570 });
569 } 571 }
570 }); 572 });
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
951 return info; 953 return info;
952 } 954 }
953 955
954 // Sorts the resolved elements by size. We do this for this inferrer 956 // Sorts the resolved elements by size. We do this for this inferrer
955 // to get the same results for [ListTracer] compared to the 957 // to get the same results for [ListTracer] compared to the
956 // [SimpleTypesInferrer]. 958 // [SimpleTypesInferrer].
957 Iterable<ResolvedAst> sortResolvedAsts() { 959 Iterable<ResolvedAst> sortResolvedAsts() {
958 int max = 0; 960 int max = 0;
959 Map<int, Setlet<ResolvedAst>> methodSizes = <int, Setlet<ResolvedAst>>{}; 961 Map<int, Setlet<ResolvedAst>> methodSizes = <int, Setlet<ResolvedAst>>{};
960 compiler.enqueuer.resolution.processedEntities 962 compiler.enqueuer.resolution.processedEntities
961 .forEach((AstElement element) { 963 .forEach((MemberElement element) {
962 ResolvedAst resolvedAst = element.resolvedAst; 964 ResolvedAst resolvedAst = element.resolvedAst;
963 element = element.implementation; 965 element = element.implementation;
964 if (element.impliesType) return; 966 if (element.impliesType) return;
965 assert(invariant( 967 assert(invariant(
966 element, 968 element,
967 element.isField || 969 element.isField ||
968 element.isFunction || 970 element.isFunction ||
969 element.isConstructor || 971 element.isConstructor ||
970 element.isGetter || 972 element.isGetter ||
971 element.isSetter, 973 element.isSetter,
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
1061 /** 1063 /**
1062 * Records that the captured variable [local] is read. 1064 * Records that the captured variable [local] is read.
1063 */ 1065 */
1064 void recordCapturedLocalRead(Local local) {} 1066 void recordCapturedLocalRead(Local local) {}
1065 1067
1066 /** 1068 /**
1067 * Records that the variable [local] is being updated. 1069 * Records that the variable [local] is being updated.
1068 */ 1070 */
1069 void recordLocalUpdate(Local local, TypeInformation type) {} 1071 void recordLocalUpdate(Local local, TypeInformation type) {}
1070 } 1072 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698