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

Unified Diff: sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart

Issue 14217011: If we know a call will actually not reach an element anymore, because we have more information on t… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 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 side-by-side diff with in-line comments
Download patch
Index: sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart (revision 21880)
+++ sdk/lib/_internal/compiler/implementation/types/simple_types_inferrer.dart (working copy)
@@ -823,7 +823,7 @@
assert(arguments != null);
bool isUseful = addArguments(node, callee, arguments);
if (hasAnalyzedAll && isUseful) {
- updateArgumentsType(callee);
+ enqueueAgain(callee);
}
}
@@ -838,13 +838,13 @@
types.remove(send);
if (hasAnalyzedAll) updateNonFinalFieldType(callee);
}
- } if (callee.isGetter()) {
+ } else if (callee.isGetter()) {
return;
} else {
Map<Node, ArgumentsTypes> types = typeOfArguments[callee];
if (types == null || !types.containsKey(send)) return;
types.remove(send);
- if (hasAnalyzedAll) updateArgumentsType(callee);
+ if (hasAnalyzedAll) enqueueAgain(callee);
}
}
@@ -862,7 +862,7 @@
if (element.name == Compiler.NO_SUCH_METHOD) return;
FunctionSignature signature = element.computeSignature(compiler);
- if (typeOfArguments[element].isEmpty) {
+ if (typeOfArguments[element] == null || typeOfArguments[element].isEmpty) {
signature.forEachParameter((Element parameter) {
typeOf.remove(parameter);
});
@@ -941,23 +941,25 @@
Selector constraint,
bool inLoop) {
TypeMask result;
- iterateOverElements(selector, (Element element) {
+ bool isReceiverDynamic = isDynamicType(receiverType);
+ assert(selector.mask == receiverType
+ || (selector.mask == null && isReceiverDynamic));
+ iterateOverElements(selector.asUntyped, (Element element) {
assert(element.isImplementation);
- // TODO(ngeoffray): Enable unregistering by having a
- // [: TypeMask.appliesTo(element) :] method, that will return
- // whether [: element :] is a potential target for the type.
- if (true) {
+ if (isReceiverDynamic
+ || receiverType.canHit(element, selector, compiler)) {
registerCalledElement(
node, selector, caller, element, arguments,
constraint, inLoop);
+
+ if (!selector.isSetter()) {
+ TypeMask type = handleIntrisifiedSelector(selector, arguments);
+ if (type == null) type = typeOfElementWithSelector(element, selector);
+ result = computeLUB(result, type);
+ }
} else {
- unregisterCalledElement(node, selector.asUntyped, caller, element);
+ unregisterCalledElement(node, selector, caller, element);
}
- if (!selector.isSetter()) {
- TypeMask type = handleIntrisifiedSelector(selector, arguments);
- if (type == null) type = typeOfElementWithSelector(element, selector);
- result = computeLUB(result, type);
- }
return true;
});
@@ -1356,6 +1358,9 @@
}
FunctionElement function = analyzedElement;
+ if (inferrer.hasAnalyzedAll) {
+ inferrer.updateArgumentsType(function);
+ }
FunctionSignature signature = function.computeSignature(compiler);
signature.forEachOptionalParameter((element) {
Node node = element.parseNode(compiler);

Powered by Google App Engine
This is Rietveld 408576698