Index: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart |
=================================================================== |
--- sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (revision 17016) |
+++ sdk/lib/_internal/compiler/implementation/ssa/optimize.dart (working copy) |
@@ -230,8 +230,25 @@ |
Selector selector = node.selector; |
- if (node.isIndexOperatorOnIndexablePrimitive(types)) { |
- return new HIndex(node.inputs[1], node.inputs[2]); |
+ // TODO(ngeoffray): Move this logic into a separate class. |
+ if (selector.kind == SelectorKind.INDEX |
+ && input.isIndexablePrimitive(types)) { |
+ if (selector.name == const SourceString('[]')) { |
+ return new HIndex(node.inputs[1], node.inputs[2]); |
+ } else if (input.isMutableArray(types)) { |
+ assert(selector.name == const SourceString('[]=')); |
+ return new HIndexAssign(node.inputs[1], node.inputs[2], node.inputs[3]); |
+ } |
+ } else if (selector.kind == SelectorKind.OPERATOR) { |
+ if (selector.name == const SourceString('-')) { |
+ if (input.isNumber(types)) { |
+ return new HNegate(input); |
+ } |
+ } else if (selector.name == const SourceString('~')) { |
+ if (input.isNumber(types)) { |
+ return new HBitNot(input); |
+ } |
+ } |
} |
SourceString selectorName = selector.name; |
@@ -350,14 +367,6 @@ |
return node; |
} |
- HInstruction visitIndexAssign(HIndexAssign node) { |
- if (!node.receiver.canBePrimitive(types)) { |
- Selector selector = new Selector.indexSet(); |
- return fromPrimitiveInstructionToDynamicInvocation(node, selector); |
- } |
- return node; |
- } |
- |
HInstruction visitInvokeBinary(HInvokeBinary node) { |
HInstruction left = node.left; |
HInstruction right = node.right; |
@@ -832,7 +841,6 @@ |
} |
index = insertBoundsCheck(node, node.receiver, index); |
node.changeUse(node.index, index); |
- assert(node.isBuiltin(types)); |
} |
void visitInvokeDynamicMethod(HInvokeDynamicMethod node) { |