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

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

Issue 1561953005: Fix null receiver guard an uncached site. (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 f348ce295701b5250026b50ae3a178c8f10fc0f4..aa6cd4b9f4fa8e2fa9c124a8e819b7ee2293f6de 100644
--- a/pkg/compiler/lib/src/cps_ir/inline.dart
+++ b/pkg/compiler/lib/src/cps_ir/inline.dart
@@ -380,11 +380,10 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
// Negative inlining result in the cache.
if (cachedResult == InliningCache.NO_INLINE) return null;
- // Positive inlining result in the cache.
- if (cachedResult is FunctionDefinition) {
- FunctionDefinition function = cachedResult;
+ Primitive finish(FunctionDefinition function) {
_fragment = new CpsFragment(invoke.sourceInformation);
Primitive receiver = invoke.receiver?.definition;
+ Reference<Primitive> dartReceiver = invoke.dartReceiverReference;
Kevin Millikin (Google) 2016/01/07 18:15:08 This is already in scope, isn't it?
sra1 2016/01/07 18:23:14 Yes, thanks.
List<Primitive> arguments =
invoke.arguments.map((Reference ref) => ref.definition).toList();
// Add a null check to the inlined function body if necessary. The
@@ -402,6 +401,11 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
hint: invoke.hint);
}
+ // Positive inlining result in the cache.
+ if (cachedResult is FunctionDefinition) {
+ return finish(cachedResult);
+ }
+
// We have not seen this combination of target and abstract arguments
// before. Make an inlining decision.
assert(cachedResult == InliningCache.ABSENT);
@@ -445,23 +449,7 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
_inliner.cache.putPositive(target, callStructure, abstractReceiver,
abstractArguments, function);
- _fragment = new CpsFragment(invoke.sourceInformation);
- Primitive receiver = invoke.receiver?.definition;
- List<Primitive> arguments =
- invoke.arguments.map((Reference ref) => ref.definition).toList();
- if (dartReceiver != null && abstractReceiver.isNullable) {
- Primitive check =
- _fragment.letPrim(new NullCheck(dartReceiver.definition,
- invoke.sourceInformation));
- check.type = abstractReceiver.nonNullable();
- if (invoke.callingConvention == CallingConvention.Intercepted) {
- arguments[0] = check;
- } else {
- receiver = check;
- }
- }
- return _fragment.inlineFunction(function, receiver, arguments,
- hint: invoke.hint);
+ return finish(function);
}
Primitive nullReceiverGuard(InvocationPrimitive invoke,
« 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