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

Unified Diff: lib/compiler/implementation/js_backend/backend.dart

Issue 10870035: Fix bug 4648: invalidate type parameter optimization on a method if a call with a selector that has… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/js_backend/backend.dart
===================================================================
--- lib/compiler/implementation/js_backend/backend.dart (revision 11214)
+++ lib/compiler/implementation/js_backend/backend.dart (working copy)
@@ -38,13 +38,20 @@
// Update the type information with the provided types.
bool typesChanged = false;
bool allUnknown = true;
- for (int i = 0; i < providedTypes.length; i++) {
- HType newType = providedTypes[i].union(types[node.inputs[i + 1]]);
- if (newType != providedTypes[i]) {
- typesChanged = true;
- providedTypes[i] = newType;
+
+ if (providedTypes.length != node.inputs.length - 1) {
+ // If the signatures don't match, remove all optimizations on
+ // that selector.
+ typesChanged = true;
Søren Gjesse 2012/08/23 10:37:09 Maybe add allUnknown = true here for clarity.
ngeoffray 2012/08/23 12:30:19 Done.
+ } else {
+ for (int i = 0; i < providedTypes.length; i++) {
+ HType newType = providedTypes[i].union(types[node.inputs[i + 1]]);
+ if (newType != providedTypes[i]) {
+ typesChanged = true;
+ providedTypes[i] = newType;
+ }
+ if (providedTypes[i] != HType.UNKNOWN) allUnknown = false;
}
- if (providedTypes[i] != HType.UNKNOWN) allUnknown = false;
}
// If the provided types change we need to recompile all functions which
// have been compiled under the now invalidated assumptions.
@@ -288,15 +295,20 @@
Map<Selector, InvocationInfo> invocationInfos =
invocationInfo.putIfAbsent(selector.name,
() => new Map<Selector, InvocationInfo>());
- InvocationInfo info = invocationInfos[selector];
- if (info != null) {
- void recompile(Element element) {
- if (compiler.phase == Compiler.PHASE_COMPILING) {
- invalidateAfterCodegen.add(element);
+ if (!invocationInfos.isEmpty()) {
+ invocationInfos.forEach((Selector _, InvocationInfo info) {
+ // TODO(ngeoffray): Check that the signature of [info] applies to
+ // [element]. We cannot do that right now because the
+ // strategy is all or nothing. We should actually retain the
+ // methods that don't apply to [selector].
+ void recompile(Element element) {
+ if (compiler.phase == Compiler.PHASE_COMPILING) {
+ invalidateAfterCodegen.add(element);
+ }
}
- }
- info.update(node, types, recompile);
+ info.update(node, types, recompile);
+ });
} else {
invocationInfos[selector] = new InvocationInfo(node, types);
}
« no previous file with comments | « no previous file | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698