Chromium Code Reviews| 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, |