Chromium Code Reviews| Index: lib/compiler/implementation/ssa/codegen.dart |
| diff --git a/lib/compiler/implementation/ssa/codegen.dart b/lib/compiler/implementation/ssa/codegen.dart |
| index 163e38087503c1710fd2bd09f39fa5b59e05deac..b57f3c5fcbd2ca4e3590dccc4b33c9b47b4826f9 100644 |
| --- a/lib/compiler/implementation/ssa/codegen.dart |
| +++ b/lib/compiler/implementation/ssa/codegen.dart |
| @@ -1410,11 +1410,23 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| Selector selector = getOptimizedSelectorFor(node, node.selector); |
| backend.registerDynamicInvocation(node, selector); |
| - if (node.element !== null) { |
| + // If we don't know what we're calling or if we are calling a getter, |
| + // we need to register that fact that we may be calling a closure |
| + // with the same arguments. |
| + Element target = node.element; |
| + if (target === null || target.isGetter()) { |
| + // TODO(kasperl): If we have a typed selector for the call, we |
| + // may know something about the types of closures that need |
| + // the specific closure call method. |
| + Selector call = new Selector.callClosureFrom(selector); |
| + world.registerDynamicInvocation(call.name, call); |
| + } |
| + |
| + if (target !== null) { |
| // If we know we're calling a specific method, register that |
| // method only. |
| - if (inLoop) backend.builder.functionsCalledInLoop.add(node.element); |
| - world.registerDynamicInvocationOf(node.element); |
| + if (inLoop) backend.builder.functionsCalledInLoop.add(target); |
| + world.registerDynamicInvocationOf(target); |
| } else { |
| if (inLoop) backend.builder.selectorsCalledInLoop[node.name] = selector; |
| world.registerDynamicInvocation(node.name, selector); |
| @@ -1464,13 +1476,8 @@ class SsaCodeGenerator implements HVisitor, HBlockInformationVisitor { |
| visitArguments(node.inputs)), |
| node); |
| // TODO(floitsch): we should have a separate list for closure invocations. |
|
floitsch
2012/08/15 14:14:04
remove comment.
kasperl
2012/08/16 10:35:47
Done.
|
| - Selector call = new Selector.call( |
| - compiler.namer.CLOSURE_INVOCATION_NAME, |
| - node.selector.library, |
| - node.selector.argumentCount, |
| - node.selector.namedArguments); |
| - world.registerDynamicInvocation(compiler.namer.CLOSURE_INVOCATION_NAME, |
| - call); |
| + Selector call = new Selector.callClosureFrom(node.selector); |
| + world.registerDynamicInvocation(call.name, call); |
| } |
| visitInvokeStatic(HInvokeStatic node) { |