Index: sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
index bb45083a3b197687fd74f24d44e8b2043e724c42..34d2919d7c48daf46131d89a4cb37f3cac51072d 100644 |
--- a/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
+++ b/sdk/lib/_internal/compiler/implementation/ssa/builder.dart |
@@ -2633,6 +2633,15 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
push(result); |
} |
+ void pushInvokeHelper5(Element helper, HInstruction a0, HInstruction a1, |
+ HInstruction a2, HInstruction a3, HInstruction a4) { |
+ HInstruction reference = new HStatic(helper); |
+ add(reference); |
+ List<HInstruction> inputs = <HInstruction>[reference, a0, a1, a2, a3, a4]; |
+ HInstruction result = new HInvokeStatic(inputs); |
+ push(result); |
+ } |
+ |
visitOperatorSend(node) { |
assert(node.selector is Operator); |
if (!methodInterceptionEnabled) { |
@@ -3031,21 +3040,54 @@ class SsaBuilder extends ResolvedVisitor implements Visitor { |
} |
generateSuperNoSuchMethodSend(Send node) { |
+ Selector selector = elements.getSelector(node); |
+ SourceString name = selector.name; |
+ compiler.enqueuer.codegen.registerDynamicInvocation(name, selector); |
ngeoffray
2012/12/06 22:46:09
Why do you need this? Because you're creating an i
Johnni Winther
2012/12/11 14:26:41
Removed.
|
+ |
ClassElement cls = work.element.getEnclosingClass(); |
Element element = cls.lookupSuperMember(Compiler.NO_SUCH_METHOD); |
HStatic target = new HStatic(element); |
add(target); |
HInstruction self = localsHandler.readThis(); |
- Identifier identifier = node.selector.asIdentifier(); |
- String name = identifier.source.slowToString(); |
- // TODO(ahe): Add the arguments to this list. |
- push(new HLiteralList([])); |
- Constant nameConstant = |
- constantSystem.createString(new DartString.literal(name), node); |
+ Constant nameConstant = constantSystem.createString( |
+ new DartString.literal(name.slowToString()), node); |
+ |
+ String internalName = backend.namer.instanceMethodInvocationName( |
+ currentLibrary, name, selector); |
+ Constant internalNameConstant = |
+ constantSystem.createString(new DartString.literal(internalName), node); |
+ |
+ Element createInvocationMirror = |
+ compiler.findHelper(Compiler.CREATE_INVOCATION_MIRROR); |
+ |
+ var arguments = new List<HInstruction>(); |
+ addGenericSendArgumentsToList(node.arguments, arguments); |
+ var argumentsInstruction = new HLiteralList(arguments); |
+ add(argumentsInstruction); |
+ |
+ var argumentNames = new List<HInstruction>(); |
+ for (SourceString argumentName in selector.namedArguments) { |
+ Constant argumentNameConstant = |
+ constantSystem.createString(new DartString.literal( |
+ argumentName.slowToString()), node); |
+ argumentNames.add(graph.addConstant(argumentNameConstant)); |
+ } |
+ var argumentNamesInstruction = new HLiteralList(argumentNames); |
+ add(argumentNamesInstruction); |
+ |
+ Constant kindConstant = |
+ constantSystem.createInt(selector.invocationMirrorKind); |
+ |
+ pushInvokeHelper5(createInvocationMirror, |
+ graph.addConstant(nameConstant), |
+ graph.addConstant(internalNameConstant), |
+ graph.addConstant(kindConstant), |
+ argumentsInstruction, |
+ argumentNamesInstruction); |
+ |
var inputs = <HInstruction>[ |
target, |
self, |
- graph.addConstant(nameConstant), |
pop()]; |
push(new HInvokeSuper(inputs)); |
} |