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

Unified Diff: pkg/compiler/lib/src/inferrer/type_graph_nodes.dart

Issue 858593003: Compute new targets for dynamic call sites eagerly. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
diff --git a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
index bea6f60822660460e7bc6755a355a693ec42fe70..36aee0981eb1eaabfd400c8b0578118df48170fb 100644
--- a/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
+++ b/pkg/compiler/lib/src/inferrer/type_graph_nodes.dart
@@ -857,19 +857,32 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
? compiler.world.allFunctions.filter(typedSelector)
: targets;
+ // Add calls to new targets to the graph.
+ targets.where((target) => !oldTargets.contains(target)).forEach((element) {
+ MemberTypeInformation callee =
+ inferrer.types.getInferredTypeOf(element);
+ callee.addCall(caller, call);
+ callee.addUser(this);
+ inferrer.updateParameterAssignments(
+ this, element, arguments, typedSelector, remove: false,
+ addToQueue: true);
+ });
+
+ // Walk over the old targets, and remove calls that cannot happen
+ // anymore.
+ oldTargets.where((target) => !targets.contains(target)).forEach((element) {
+ MemberTypeInformation callee =
+ inferrer.types.getInferredTypeOf(element);
+ callee.removeCall(caller, call);
+ callee.removeUser(this);
+ inferrer.updateParameterAssignments(
+ this, element, arguments, typedSelector, remove: true,
+ addToQueue: true);
+ });
+
// Walk over the found targets, and compute the joined union type mask
// for all these targets.
- TypeMask newType = inferrer.types.joinTypeMasks(targets.map((element) {
- if (!oldTargets.contains(element)) {
- MemberTypeInformation callee =
- inferrer.types.getInferredTypeOf(element);
- callee.addCall(caller, call);
- callee.addUser(this);
- inferrer.updateParameterAssignments(
- this, element, arguments, typedSelector, remove: false,
- addToQueue: true);
- }
-
+ return inferrer.types.joinTypeMasks(targets.map((element) {
// If [canReachAll] is true, then we are iterating over all
// targets that satisfy the untyped selector. We skip the return
// type of the targets that can only be reached through
@@ -914,22 +927,6 @@ class DynamicCallSiteTypeInformation extends CallSiteTypeInformation {
return inferrer.typeOfElementWithSelector(element, typedSelector).type;
}
}));
-
- // Walk over the old targets, and remove calls that cannot happen
- // anymore.
- oldTargets.forEach((element) {
- if (!targets.contains(element)) {
- MemberTypeInformation callee =
- inferrer.types.getInferredTypeOf(element);
- callee.removeCall(caller, call);
- callee.removeUser(this);
- inferrer.updateParameterAssignments(
- this, element, arguments, typedSelector, remove: true,
- addToQueue: true);
- }
- });
-
- return newType;
}
void giveUp(TypeGraphInferrerEngine inferrer, {bool clearAssignments: true}) {
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698