Chromium Code Reviews| Index: pkg/compiler/lib/src/ssa/optimize.dart |
| diff --git a/pkg/compiler/lib/src/ssa/optimize.dart b/pkg/compiler/lib/src/ssa/optimize.dart |
| index fb5f1963b454a5b6bf56af83c6b5c41e84af449a..befe41f0872e61fad98944f4d68d18ebcbae3f42 100644 |
| --- a/pkg/compiler/lib/src/ssa/optimize.dart |
| +++ b/pkg/compiler/lib/src/ssa/optimize.dart |
| @@ -901,8 +901,22 @@ class SsaInstructionSimplifier extends HBaseVisitor |
| } |
| HInstruction receiver = node.getDartReceiver(compiler); |
| Element field = findConcreteFieldForDynamicAccess(receiver, node.selector); |
| - if (field == null) return node; |
| - return directFieldGet(receiver, field); |
| + if (field != null) return directFieldGet(receiver, field); |
| + |
| + if (node.element == null) { |
| + Element element = compiler.closedWorld |
| + .locateSingleElement(node.selector, receiver.instructionType); |
| + if (element != null && element.name == node.selector.name) { |
| + node.element = element; |
| + if (element.isFunction) { |
| + // A property extraction getter, aka a tear-off. |
| + node.sideEffects.clearAllDependencies(); |
| + node.sideEffects.clearAllSideEffects(); |
| + // TODO(sra): Also setUseGvn() to allow tear-offs to be shared. |
|
Siggi Cherem (dart-lang)
2016/10/18 23:26:02
anything blocking this now? or is this just to kee
sra1
2016/10/19 02:16:57
I'll do it
|
| + } |
| + } |
| + } |
| + return node; |
| } |
| HInstruction directFieldGet(HInstruction receiver, Element field) { |
| @@ -1065,10 +1079,11 @@ class SsaInstructionSimplifier extends HBaseVisitor |
| // be a class extending `Interceptor` then it can be called directly. |
| if (new TypeMask.nonNullSubclass(helpers.jsInterceptorClass, closedWorld) |
| .isDisjoint(input.instructionType, closedWorld)) { |
| + var inputs = <HInstruction>[input, input]; // [interceptor, receiver]. |
| HInstruction result = new HInvokeDynamicMethod( |
| selector, |
| input.instructionType, // receiver mask. |
| - <HInstruction>[input, input], // [interceptor, receiver]. |
| + inputs, |
|
sra1
2016/10/18 23:18:22
This is to avoid the formatter bug https://github.
|
| toStringType)..sourceInformation = node.sourceInformation; |
| return result; |
| } |