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

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

Issue 1568103003: Specializations of instance methods have non-null receiver. (Closed) Base URL: https://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
« no previous file with comments | « no previous file | no next file » | 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 01547fe57d071ba812c15318707ea164164c97c0..4cc1fc6c905eb304f496f9d4b7727c8b06901c52 100644
--- a/pkg/compiler/lib/src/cps_ir/inline.dart
+++ b/pkg/compiler/lib/src/cps_ir/inline.dart
@@ -371,10 +371,17 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
Reference<Primitive> dartReceiver = invoke.dartReceiverReference;
TypeMask abstractReceiver =
dartReceiver == null ? null : abstractType(dartReceiver);
+ // The receiver is non-null in a method body, unless the receiver is known
+ // to be `null` (isEmpty covers `null` and unreachable).
+ TypeMask abstractReceiverInMethod = abstractReceiver == null
+ ? null
+ : abstractReceiver.isEmpty
+ ? abstractReceiver
+ : abstractReceiver.nonNullable();
List<TypeMask> abstractArguments =
invoke.arguments.map(abstractType).toList();
var cachedResult = _inliner.cache.get(target, callStructure,
- abstractReceiver,
+ abstractReceiverInMethod,
abstractArguments);
// Negative inlining result in the cache.
@@ -409,8 +416,8 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
// before. Make an inlining decision.
assert(cachedResult == InliningCache.ABSENT);
Primitive doNotInline() {
- _inliner.cache.putNegative(target, callStructure, abstractReceiver,
- abstractArguments);
+ _inliner.cache.putNegative(
+ target, callStructure, abstractReceiverInMethod, abstractArguments);
return null;
}
if (backend.annotations.noInline(target)) return doNotInline();
@@ -429,11 +436,19 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
void setValue(Variable variable, Reference<Primitive> value) {
variable.type = value.definition.type;
}
- if (invoke.receiver != null) {
+ if (invoke.callingConvention == CallingConvention.Intercepted) {
setValue(function.thisParameter, invoke.receiver);
- }
- for (int i = 0; i < invoke.arguments.length; ++i) {
- setValue(function.parameters[i], invoke.arguments[i]);
+ function.parameters[0].type = abstractReceiverInMethod;
+ for (int i = 1; i < invoke.arguments.length; ++i) {
+ setValue(function.parameters[i], invoke.arguments[i]);
+ }
+ } else {
+ if (invoke.receiver != null) {
+ function.thisParameter.type = abstractReceiverInMethod;
+ }
+ for (int i = 0; i < invoke.arguments.length; ++i) {
+ setValue(function.parameters[i], invoke.arguments[i]);
+ }
}
optimizeBeforeInlining(function);
}
@@ -446,7 +461,7 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
int size = SizeVisitor.sizeOf(invoke, function);
if (!_inliner.isCalledOnce(target) && size > 11) return doNotInline();
- _inliner.cache.putPositive(target, callStructure, abstractReceiver,
+ _inliner.cache.putPositive(target, callStructure, abstractReceiverInMethod,
abstractArguments, function);
return finish(function);
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698