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

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: Remove debugging code & rebase Created 4 years, 10 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 | « pkg/compiler/lib/src/cps_ir/optimizers.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5b30cafa0f93a8876ec464fbec642c576d94894f..ea8bb4300e7985ff8bc1c750966c86e92142f0e2 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
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/optimizers.dart ('k') | pkg/compiler/lib/src/cps_ir/type_propagation.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698