| Index: lib/compiler/implementation/ssa/nodes.dart
|
| ===================================================================
|
| --- lib/compiler/implementation/ssa/nodes.dart (revision 12169)
|
| +++ 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 isSideEffectFree;
|
| + HInvokeDynamicGetter(
|
| + selector, element, receiver, this.isSideEffectFree)
|
| : super(selector, element,[receiver]);
|
| toString() => 'invoke dynamic getter: $selector';
|
| accept(HVisitor visitor) => visitor.visitInvokeDynamicGetter(this);
|
| +
|
| + void prepareGvn(HTypeMap types) {
|
| + if (isSideEffectFree) {
|
| + setUseGvn();
|
| + clearAllSideEffects();
|
| + setDependsOnSomething();
|
| + } else {
|
| + setAllSideEffects();
|
| + }
|
| + }
|
| +
|
| + int typeCode() => HInstruction.INVOKE_DYNAMIC_GETTER_TYPECODE;
|
| + bool typeEquals(other) => other is HInvokeDynamicGetter;
|
| + bool dataEquals(HInvokeDynamicGetter other) => selector == other.selector;
|
| }
|
|
|
| class HInvokeDynamicSetter extends HInvokeDynamicField {
|
| @@ -1356,11 +1373,12 @@
|
|
|
| class HInvokeInterceptor extends HInvokeStatic {
|
| final Selector selector;
|
| + final bool isSideEffectFree;
|
|
|
| HInvokeInterceptor(this.selector,
|
| List<HInstruction> inputs,
|
| - [HType knownType = HType.UNKNOWN])
|
| - : super(inputs, knownType);
|
| + [bool this.isSideEffectFree = false])
|
| + : 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 (isSideEffectFree) {
|
| + setUseGvn();
|
| + clearAllSideEffects();
|
| + setDependsOnSomething();
|
| } else {
|
| setAllSideEffects();
|
| }
|
|
|