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

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

Issue 188433002: Instruction selection before removing HTypeKnown (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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/ssa/interceptor_simplifier.dart
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/interceptor_simplifier.dart b/sdk/lib/_internal/compiler/implementation/ssa/interceptor_simplifier.dart
index f2ae1a506763c0fe8b6bb84a2f9a6b61854d3aa7..6e2f2fe6a8353e87aedaf042f9f47eeb811f7711 100644
--- a/sdk/lib/_internal/compiler/implementation/ssa/interceptor_simplifier.dart
+++ b/sdk/lib/_internal/compiler/implementation/ssa/interceptor_simplifier.dart
@@ -173,11 +173,12 @@ class SsaSimplifyInterceptors extends HBaseVisitor
// it with a set of classes it intercepts.
Set<ClassElement> interceptedClasses;
JavaScriptBackend backend = compiler.backend;
- HInstruction dominator =
- findDominator(node.usedBy.where((i) => i is HInvokeDynamic));
- // If there is an instruction that dominates all others, we can
- // use only the selector of that instruction.
- if (dominator != null) {
+ HInstruction dominator = findDominator(node.usedBy);
+ // If there is a call that dominates all other uses, we can use just the
+ // selector of that instruction.
+ if (dominator is HInvokeDynamic &&
+ dominator.isCallOnInterceptor(compiler) &&
+ node == dominator.receiver) {
interceptedClasses =
backend.getInterceptedClassesOn(dominator.selector.name);
@@ -201,15 +202,17 @@ class SsaSimplifyInterceptors extends HBaseVisitor
} else {
interceptedClasses = new Set<ClassElement>();
for (HInstruction user in node.usedBy) {
- if (user is HIs) {
- // Is-checks can be performed on any intercepted class.
+ if (user is HInvokeDynamic &&
+ user.isCallOnInterceptor(compiler) &&
+ node == user.receiver) {
+ interceptedClasses.addAll(
+ backend.getInterceptedClassesOn(user.selector.name));
+ } else {
+ // Use a most general interceptor for other instructions, example,
+ // is-checks and escaping interceptors.
interceptedClasses.addAll(backend.interceptedClasses);
break;
}
- if (user is! HInvoke) continue;
- // We don't handle escaping interceptors yet.
- interceptedClasses.addAll(
- backend.getInterceptedClassesOn(user.selector.name));
}
}

Powered by Google App Engine
This is Rietveld 408576698