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

Unified Diff: pkg/compiler/lib/src/cps_ir/type_mask_system.dart

Issue 1655183002: dart2js cps: Remove interceptors in cases where type propagation fails. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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
Index: pkg/compiler/lib/src/cps_ir/type_mask_system.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_mask_system.dart b/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
index 0a21c3f657152af2c858ed7ef23181c27822e378..7b59546af5dcfdf6c7a652ec2158b4cc67311b51 100644
--- a/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_mask_system.dart
@@ -173,11 +173,27 @@ class TypeMaskSystem implements AbstractValueDomain {
}
@override
- bool methodUsesReceiverArgument(FunctionElement function) {
+ bool methodIgnoresReceiverArgument(FunctionElement function) {
assert(backend.isInterceptedMethod(function));
ClassElement clazz = function.enclosingClass.declaration;
- return clazz.isSubclassOf(helpers.jsInterceptorClass) ||
- classWorld.isUsedAsMixin(clazz);
+ return !clazz.isSubclassOf(helpers.jsInterceptorClass) &&
+ !classWorld.isUsedAsMixin(clazz);
+ }
+
+ @override
+ bool targetIgnoresReceiverArgument(TypeMask type, Selector selector) {
+ // Check if any of the possible targets depend on the extra receiver
+ // argument. Mixins do this, and tear-offs always needs the extra receiver
+ // argument because BoundClosure uses it for equality and hash code.
+ // TODO(15933): Make automatically generated property extraction
+ // closures work with the dummy receiver optimization.
+ bool needsReceiver(Element target) {
+ if (target is! FunctionElement) return false;
+ FunctionElement function = target;
+ return selector.isGetter && !function.isGetter ||
+ !methodIgnoresReceiverArgument(function);
+ }
+ return !classWorld.allFunctions.filter(selector, type).any(needsReceiver);
}
@override

Powered by Google App Engine
This is Rietveld 408576698