| 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 cc046eec2c56c6588041c26cee5f3c652ae5b072..024baf2bd1866896640e95d70320643bc7173ab4 100644
|
| --- a/pkg/compiler/lib/src/cps_ir/inline.dart
|
| +++ b/pkg/compiler/lib/src/cps_ir/inline.dart
|
| @@ -128,13 +128,14 @@ class InliningCache {
|
| /// lookup result returns [NO_INLINE]. If there is no cached result,
|
| /// [ABSENT] is returned.
|
| get(ExecutableElement element, CallStructure callStructure, TypeMask receiver,
|
| - List<TypeMask> arguments) {
|
| + List<TypeMask> arguments, DartType concreteType) {
|
| List<CacheEntry> entries = map[element];
|
| if (entries != null) {
|
| for (CacheEntry entry in entries) {
|
| if (entry.match(callStructure, receiver, arguments)) {
|
| if (entry.decision) {
|
| - FunctionDefinition function = copier.copy(entry.function);
|
| + FunctionDefinition function = copier.copy(entry.function,
|
| + concreteType: concreteType);
|
| ParentVisitor.setParents(function);
|
| return function;
|
| }
|
| @@ -359,7 +360,8 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
|
| // if the call was inlined, and the inlined function body is available in
|
| // [_fragment]. If the call was not inlined, null is returned.
|
| Primitive tryInlining(InvocationPrimitive invoke, FunctionElement target,
|
| - CallStructure callStructure) {
|
| + CallStructure callStructure,
|
| + {GenericType concreteType}) {
|
| // Quick checks: do not inline or even cache calls to targets without an
|
| // AST node, targets that are asynchronous or generator functions, or
|
| // targets containing a try statement.
|
| @@ -386,7 +388,8 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
|
| invoke.arguments.map(abstractType).toList();
|
| var cachedResult = _inliner.cache.get(target, callStructure,
|
| abstractReceiverInMethod,
|
| - abstractArguments);
|
| + abstractArguments,
|
| + concreteType);
|
|
|
| // Negative inlining result in the cache.
|
| if (cachedResult == InliningCache.NO_INLINE) return null;
|
| @@ -523,14 +526,6 @@ class InliningVisitor extends TrampolineRecursiveVisitor {
|
|
|
| @override
|
| Primitive visitInvokeConstructor(InvokeConstructor node) {
|
| - if (node.dartType is GenericType) {
|
| - // We cannot inline a constructor invocation containing type arguments
|
| - // because CreateInstance in the body does not know the type arguments.
|
| - // We would incorrectly instantiate a class like A instead of A<B>.
|
| - // TODO(kmillikin): try to fix this.
|
| - GenericType generic = node.dartType;
|
| - if (generic.typeArguments.any((DartType t) => !t.isDynamic)) return null;
|
| - }
|
| - return tryInlining(node, node.target, null);
|
| + return tryInlining(node, node.target, null, concreteType: node.dartType);
|
| }
|
| }
|
|
|