Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Unified Diff: sdk/lib/_internal/compiler/implementation/ssa/optimize.dart

Issue 11861007: Move indexSet and unary operators to the new interceptor mechanism. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/ssa/nodes.dart ('k') | sdk/lib/_internal/compiler/implementation/ssa/tracer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698