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

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart

Issue 11418183: Fix a bad merge that lead to unused optimization: implement the dataEquals in HInterceptor in order… (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 1 month 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 | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | tests/language/interceptor3_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart
===================================================================
--- sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (revision 15445)
+++ sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (working copy)
@@ -45,6 +45,7 @@
new SsaDeadPhiEliminator(),
new SsaConstantFolder(constantSystem, backend, work, types),
new SsaTypePropagator(compiler, types),
+ new SsaReceiverSpecialization(compiler),
new SsaGlobalValueNumberer(compiler, types),
new SsaCodeMotion(),
new SsaValueRangeAnalyzer(constantSystem, types, work),
@@ -1416,3 +1417,32 @@
});
}
}
+
+/**
+ * This phase specializes dominated uses of a call, where the call
+ * can give us some type information of what the receiver might be.
+ * For example, after a call to [:a.foo():], if [:foo:] is only
+ * in class [:A:], a can be of type [:A:].
+ */
+class SsaReceiverSpecialization extends HBaseVisitor
+ implements OptimizationPhase {
+ final String name = "SsaReceiverSpecialization";
+ final Compiler compiler;
+
+ SsaReceiverSpecialization(this.compiler);
+
+ void visitGraph(HGraph graph) {
+ visitDominatorTree(graph);
+ }
+
+ void visitInterceptor(HInterceptor interceptor) {
+ HInstruction receiver = interceptor.receiver;
+ for (var user in receiver.usedBy) {
+ if (user is HInterceptor && interceptor.dominates(user)) {
kasperl 2012/11/29 08:22:27 This is probably fine, but an alternative implemen
ngeoffray 2012/11/29 08:31:56 Good point. Filed http://code.google.com/p/dart/is
+ user.interceptedClasses = interceptor.interceptedClasses;
+ }
+ }
+ }
+
+ // TODO(ngeoffray): Also implement it for non-intercepted calls.
+}
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | tests/language/interceptor3_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698