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

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

Issue 1668913002: dart2js cps: More aggressive operator specialization. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Update test expectations 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/gvn.dart ('k') | pkg/compiler/lib/src/cps_ir/redundant_join.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/inline.dart
diff --git a/pkg/compiler/lib/src/cps_ir/inline.dart b/pkg/compiler/lib/src/cps_ir/inline.dart
index 554e93e39239a9804a5d1b860301e0ffbc6a192c..972241e138952849eef411d0f1d7e0d3dda025be 100644
--- a/pkg/compiler/lib/src/cps_ir/inline.dart
+++ b/pkg/compiler/lib/src/cps_ir/inline.dart
@@ -405,6 +405,14 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
return null;
}
+ if (isBlacklisted(target)) return null;
+
+ if (invoke.callingConvention == CallingConvention.OneShotIntercepted) {
+ // One-shot interceptor calls with a known target are only inserted on
+ // uncommon code paths, so they should not be inlined.
+ return null;
+ }
+
Reference<Primitive> dartReceiver = invoke.dartReceiverReference;
TypeMask abstractReceiver =
dartReceiver == null ? null : abstractType(dartReceiver);
@@ -512,7 +520,9 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
CpsFragment fragment,
Primitive dartReceiver,
TypeMask abstractReceiver) {
- Selector selector = invoke is InvokeMethod ? invoke.selector : null;
+ if (invoke is! InvokeMethod) return dartReceiver;
+ InvokeMethod invokeMethod = invoke;
+ Selector selector = invokeMethod.selector;
if (typeSystem.isDefinitelyNum(abstractReceiver, allowNull: true)) {
Primitive condition = _fragment.letPrim(
new ApplyBuiltinOperator(BuiltinOperator.IsNotNumber,
@@ -520,15 +530,16 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
invoke.sourceInformation));
condition.type = typeSystem.boolType;
Primitive check = _fragment.letPrim(
- new NullCheck.guarded(
- condition, dartReceiver, selector, invoke.sourceInformation));
+ new ReceiverCheck.nullCheck(dartReceiver, selector,
+ invoke.sourceInformation,
+ condition: condition));
check.type = abstractReceiver.nonNullable();
return check;
}
Primitive check = _fragment.letPrim(
- new NullCheck(dartReceiver, invoke.sourceInformation,
- selector: selector));
+ new ReceiverCheck.nullCheck(dartReceiver, selector,
+ invoke.sourceInformation));
check.type = abstractReceiver.nonNullable();
return check;
}
@@ -571,4 +582,16 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
}
return tryInlining(node, node.target, null);
}
+
+ bool isBlacklisted(FunctionElement target) {
+ ClassElement enclosingClass = target.enclosingClass;
+ if (target.isOperator &&
+ (enclosingClass == backend.helpers.jsNumberClass ||
+ enclosingClass == backend.helpers.jsDoubleClass ||
+ enclosingClass == backend.helpers.jsIntClass)) {
+ // These should be handled by operator specialization.
+ return true;
+ }
+ return false;
+ }
}
« no previous file with comments | « pkg/compiler/lib/src/cps_ir/gvn.dart ('k') | pkg/compiler/lib/src/cps_ir/redundant_join.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698