Index: pkg/compiler/lib/src/ssa/builder.dart |
diff --git a/pkg/compiler/lib/src/ssa/builder.dart b/pkg/compiler/lib/src/ssa/builder.dart |
index a3c8830caae00180b69b0f959743748fa54553b7..631fa6c1d5f8a9a0ac62cb55e3227ed9daf63f63 100644 |
--- a/pkg/compiler/lib/src/ssa/builder.dart |
+++ b/pkg/compiler/lib/src/ssa/builder.dart |
@@ -1244,7 +1244,8 @@ class SsaBuilder extends NewResolvedVisitor { |
* For each parameter name in the signature, if the argument name matches |
* we use the next provided argument, otherwise we get the default. |
*/ |
- List<String> selectorArgumentNames = selector.getOrderedNamedArguments(); |
+ List<String> selectorArgumentNames = |
+ selector.callStructure.getOrderedNamedArguments(); |
int namedArgumentIndex = 0; |
int firstProvidedNamedArgument = index; |
signature.orderedOptionalParameters.forEach((element) { |
@@ -1893,13 +1894,12 @@ class SsaBuilder extends NewResolvedVisitor { |
} |
Element target = constructor.definingConstructor.implementation; |
- bool match = Selector.addForwardingElementArgumentsToList( |
+ bool match = CallStructure.addForwardingElementArgumentsToList( |
constructor, |
arguments, |
target, |
compileArgument, |
- handleConstantForOptionalParameter, |
- compiler.world); |
+ handleConstantForOptionalParameter); |
if (!match) { |
if (compiler.elementHasCompileTimeError(constructor)) { |
return; |
@@ -1933,12 +1933,13 @@ class SsaBuilder extends NewResolvedVisitor { |
assert(ast.Initializers.isSuperConstructorCall(call) || |
ast.Initializers.isConstructorRedirect(call)); |
FunctionElement target = elements[call].implementation; |
- Selector selector = elements.getSelector(call); |
+ CallStructure callStructure = |
+ elements.getSelector(call).callStructure; |
Link<ast.Node> arguments = call.arguments; |
List<HInstruction> compiledArguments; |
inlinedFrom(constructor, () { |
compiledArguments = |
- makeStaticArgumentList(selector, arguments, target); |
+ makeStaticArgumentList(callStructure, arguments, target); |
}); |
inlineSuperOrRedirect(target, |
compiledArguments, |
@@ -1972,12 +1973,12 @@ class SsaBuilder extends NewResolvedVisitor { |
compiler.internalError(superClass, |
"No default constructor available."); |
} |
- Selector selector = new Selector.callDefaultConstructor(); |
List<HInstruction> arguments = |
- selector.makeArgumentsList(const Link<ast.Node>(), |
- target.implementation, |
- null, |
- handleConstantForOptionalParameter); |
+ CallStructure.NO_ARGS.makeArgumentsList( |
+ const Link<ast.Node>(), |
+ target.implementation, |
+ null, |
+ handleConstantForOptionalParameter); |
inlineSuperOrRedirect(target, |
arguments, |
constructors, |
@@ -3522,13 +3523,13 @@ class SsaBuilder extends NewResolvedVisitor { |
} |
void addDynamicSendArgumentsToList(ast.Send node, List<HInstruction> list) { |
- Selector selector = elements.getSelector(node); |
- if (selector.namedArgumentCount == 0) { |
+ CallStructure callStructure = elements.getSelector(node).callStructure; |
+ if (callStructure.namedArgumentCount == 0) { |
addGenericSendArgumentsToList(node.arguments, list); |
} else { |
// Visit positional arguments and add them to the list. |
Link<ast.Node> arguments = node.arguments; |
- int positionalArgumentCount = selector.positionalArgumentCount; |
+ int positionalArgumentCount = callStructure.positionalArgumentCount; |
for (int i = 0; |
i < positionalArgumentCount; |
arguments = arguments.tail, i++) { |
@@ -3539,7 +3540,7 @@ class SsaBuilder extends NewResolvedVisitor { |
// Visit named arguments and add them into a temporary map. |
Map<String, HInstruction> instructions = |
new Map<String, HInstruction>(); |
- List<String> namedArguments = selector.namedArguments; |
+ List<String> namedArguments = callStructure.namedArguments; |
int nameIndex = 0; |
for (; !arguments.isEmpty; arguments = arguments.tail) { |
visit(arguments.head); |
@@ -3549,7 +3550,7 @@ class SsaBuilder extends NewResolvedVisitor { |
// Iterate through the named arguments to add them to the list |
// of instructions, in an order that can be shared with |
// selectors with the same named arguments. |
- List<String> orderedNames = selector.getOrderedNamedArguments(); |
+ List<String> orderedNames = callStructure.getOrderedNamedArguments(); |
for (String name in orderedNames) { |
list.add(instructions[name]); |
} |
@@ -3562,7 +3563,7 @@ class SsaBuilder extends NewResolvedVisitor { |
* Precondition: `this.applies(element, world)`. |
* Invariant: [element] must be an implementation element. |
*/ |
- List<HInstruction> makeStaticArgumentList(Selector selector, |
+ List<HInstruction> makeStaticArgumentList(CallStructure callStructure, |
Link<ast.Node> arguments, |
FunctionElement element) { |
assert(invariant(element, element.isImplementation)); |
@@ -3572,10 +3573,11 @@ class SsaBuilder extends NewResolvedVisitor { |
return pop(); |
} |
- return selector.makeArgumentsList(arguments, |
- element, |
- compileArgument, |
- handleConstantForOptionalParameter); |
+ return callStructure.makeArgumentsList( |
+ arguments, |
+ element, |
+ compileArgument, |
+ handleConstantForOptionalParameter); |
} |
void addGenericSendArgumentsToList(Link<ast.Node> link, List<HInstruction> list) { |
@@ -4103,7 +4105,7 @@ class SsaBuilder extends NewResolvedVisitor { |
// calling [makeStaticArgumentList]. |
FunctionElement function = element.implementation; |
assert(selector.applies(function, compiler.world)); |
- inputs = makeStaticArgumentList(selector, |
+ inputs = makeStaticArgumentList(selector.callStructure, |
node.arguments, |
function); |
push(buildInvokeSuper(selector, element, inputs)); |
@@ -4347,7 +4349,7 @@ class SsaBuilder extends NewResolvedVisitor { |
} |
Element constructor = elements[send]; |
- Selector selector = elements.getSelector(send); |
+ CallStructure callStructure = elements.getSelector(send).callStructure; |
ConstructorElement constructorDeclaration = constructor; |
ConstructorElement constructorImplementation = constructor.implementation; |
constructor = constructorImplementation.effectiveTarget; |
@@ -4361,8 +4363,8 @@ class SsaBuilder extends NewResolvedVisitor { |
constructor = compiler.symbolValidatedConstructor; |
assert(invariant(send, constructor != null, |
message: 'Constructor Symbol.validated is missing')); |
- selector = compiler.symbolValidatedConstructorSelector; |
- assert(invariant(send, selector != null, |
+ callStructure = compiler.symbolValidatedConstructorSelector.callStructure; |
+ assert(invariant(send, callStructure != null, |
message: 'Constructor Symbol.validated is missing')); |
} |
@@ -4387,11 +4389,11 @@ class SsaBuilder extends NewResolvedVisitor { |
} |
// TODO(5347): Try to avoid the need for calling [implementation] before |
// calling [makeStaticArgumentList]. |
- if (!selector.applies(constructor.implementation, compiler.world)) { |
+ if (!callStructure.signatureApplies(constructor.implementation)) { |
generateWrongArgumentCountError(send, constructor, send.arguments); |
return; |
} |
- inputs.addAll(makeStaticArgumentList(selector, |
+ inputs.addAll(makeStaticArgumentList(callStructure, |
send.arguments, |
constructor.implementation)); |
@@ -4550,7 +4552,7 @@ class SsaBuilder extends NewResolvedVisitor { |
} |
visitStaticSend(ast.Send node) { |
- Selector selector = elements.getSelector(node); |
+ CallStructure callStructure = elements.getSelector(node).callStructure; |
Element element = elements[node]; |
if (elements.isAssert(node)) { |
element = backend.assertMethod; |
@@ -4577,13 +4579,13 @@ class SsaBuilder extends NewResolvedVisitor { |
if (element.isFunction) { |
// TODO(5347): Try to avoid the need for calling [implementation] before |
// calling [makeStaticArgumentList]. |
- if (!selector.applies(element.implementation, compiler.world)) { |
+ if (!callStructure.signatureApplies(element.implementation)) { |
generateWrongArgumentCountError(node, element, node.arguments); |
return; |
} |
List<HInstruction> inputs = |
- makeStaticArgumentList(selector, |
+ makeStaticArgumentList(callStructure, |
node.arguments, |
element.implementation); |
@@ -4598,7 +4600,7 @@ class SsaBuilder extends NewResolvedVisitor { |
generateGetter(node, element); |
List<HInstruction> inputs = <HInstruction>[pop()]; |
addDynamicSendArgumentsToList(node, inputs); |
- Selector closureSelector = new Selector.callClosureFrom(selector); |
+ Selector closureSelector = callStructure.callSelector; |
pushWithPosition( |
new HInvokeClosure(closureSelector, inputs, backend.dynamicType), |
node); |