Chromium Code Reviews| Index: lib/compiler/implementation/ssa/nodes.dart |
| =================================================================== |
| --- lib/compiler/implementation/ssa/nodes.dart (revision 12117) |
| +++ lib/compiler/implementation/ssa/nodes.dart (working copy) |
| @@ -797,6 +797,7 @@ |
| static const int TYPE_CONVERSION_TYPECODE = 28; |
| static const int BAILOUT_TARGET_TYPECODE = 29; |
| static const int INVOKE_STATIC_TYPECODE = 30; |
| + static const int INVOKE_DYNAMIC_GETTER_TYPECODE = 31; |
| HInstruction(this.inputs) |
| : id = idCounter++, |
| @@ -1304,10 +1305,26 @@ |
| } |
| class HInvokeDynamicGetter extends HInvokeDynamicField { |
| - HInvokeDynamicGetter(selector, element, receiver) |
| + final bool possibleTargetsAreFields; |
|
kasperl
2012/09/11 07:39:11
Maybe this should be allPossibleTargetsAreFields -
ngeoffray
2012/09/11 08:51:08
Done.
|
| + HInvokeDynamicGetter( |
| + selector, element, receiver, this.possibleTargetsAreFields) |
| : super(selector, element,[receiver]); |
| toString() => 'invoke dynamic getter: $selector'; |
| accept(HVisitor visitor) => visitor.visitInvokeDynamicGetter(this); |
| + |
| + void prepareGvn(HTypeMap types) { |
| + if (possibleTargetsAreFields) { |
| + setUseGvn(); |
| + clearAllSideEffects(); |
| + setDependsOnSomething(); |
| + } else { |
| + setAllSideEffects(); |
| + } |
| + } |
| + |
| + int typeCode() => HInstruction.INVOKE_DYNAMIC_GETTER_TYPECODE; |
| + bool typeEquals(other) => other is HInvokeDynamicGetter; |
| + bool dataEquals(HInvokeInterceptor other) => selector == other.selector; |
| } |
| class HInvokeDynamicSetter extends HInvokeDynamicField { |
| @@ -1356,11 +1373,12 @@ |
| class HInvokeInterceptor extends HInvokeStatic { |
| final Selector selector; |
| + final bool _hasSideEffects; |
|
kasperl
2012/09/11 07:39:11
Is this private just because of naming conflicts?
ngeoffray
2012/09/11 08:51:08
Done.
|
| HInvokeInterceptor(this.selector, |
| List<HInstruction> inputs, |
| - [HType knownType = HType.UNKNOWN]) |
| - : super(inputs, knownType); |
| + [bool this._hasSideEffects = true]) |
| + : super(inputs); |
| toString() => 'invoke interceptor: ${element.name}'; |
| accept(HVisitor visitor) => visitor.visitInvokeInterceptor(this); |
| @@ -1416,6 +1434,10 @@ |
| // we don't express that type yet: a mutable array might be |
| // extendable. |
| if (!inputs[1].isString(types)) setDependsOnSomething(); |
| + } else if (!_hasSideEffects) { |
| + setUseGvn(); |
| + clearAllSideEffects(); |
| + setDependsOnSomething(); |
| } else { |
| setAllSideEffects(); |
| } |