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

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

Issue 1238163003: dart2js cps: Share interceptors by default and propagate to use later. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Renamed to let_sinking.dart Created 5 years, 5 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/js_backend/codegen/task.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_propagation.dart
diff --git a/pkg/compiler/lib/src/cps_ir/type_propagation.dart b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
index 7f788189c94067f1bc2290eec4351887202fa743..212f5107bbefb3bb74ad4ae084bb2e157e00a93f 100644
--- a/pkg/compiler/lib/src/cps_ir/type_propagation.dart
+++ b/pkg/compiler/lib/src/cps_ir/type_propagation.dart
@@ -44,6 +44,8 @@ class TypeMaskSystem {
TypeMask numStringBoolType;
+ ClassElement get jsNullClass => backend.jsNullClass;
+
// TODO(karlklose): remove compiler here.
TypeMaskSystem(dart2js.Compiler compiler)
: inferrer = compiler.typesTask,
@@ -1549,6 +1551,23 @@ class TransformingVisitor extends RecursiveVisitor {
visit(body);
}
}
+
+ void visitInterceptor(Interceptor node) {
+ // Filter out intercepted classes that do not match the input type.
+ AbstractValue value = getValue(node.input.definition);
+ node.interceptedClasses.retainWhere((ClassElement clazz) {
+ if (clazz == typeSystem.jsNullClass) {
+ return value.isNullable;
+ } else {
+ TypeMask classMask = typeSystem.nonNullSubclass(clazz);
+ return !typeSystem.areDisjoint(value.type, classMask);
+ }
+ });
+ // Remove the interceptor call if it can only return its input.
+ if (node.interceptedClasses.isEmpty) {
+ node.input.definition.substituteFor(node);
+ }
+ }
}
/**
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/optimizers.dart ('k') | pkg/compiler/lib/src/js_backend/codegen/task.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698