Chromium Code Reviews| Index: frog/leg/ssa/builder.dart |
| =================================================================== |
| --- frog/leg/ssa/builder.dart (revision 3592) |
| +++ frog/leg/ssa/builder.dart (working copy) |
| @@ -236,7 +236,7 @@ |
| add(newObject); |
| // Call the method body. |
| - SourceString methodName = compiler.namer.getConstructorName(bodyElement); |
| + SourceString methodName = bodyElement.name; |
| List bodyCallInputs = <HInstruction>[]; |
| bodyCallInputs.add(newObject); |
| @@ -903,7 +903,22 @@ |
| visitDynamicSend(Send node) { |
| var inputs = <HInstruction>[]; |
| - SourceString dartMethodName = node.selector.asIdentifier().source; |
| + SourceString dartMethodName; |
| + bool isNotEquals = false; |
| + if (node.isIndex && !node.arguments.tail.isEmpty()) { |
| + dartMethodName = Elements.constructOperatorName( |
| + const SourceString('operator'), |
| + const SourceString('[]=')); |
| + } else if (node.selector.asOperator() != null) { |
| + SourceString name = node.selector.asIdentifier().source; |
| + isNotEquals = name.stringValue === '!='; |
| + dartMethodName = Elements.constructOperatorName( |
| + const SourceString('operator'), |
| + name, |
| + node.argumentsNode is Prefix); |
| + } else { |
| + dartMethodName = node.selector.asIdentifier().source; |
| + } |
| Element interceptor = null; |
| if (methodInterceptionEnabled) { |
| @@ -936,6 +951,11 @@ |
| // The first entry in the inputs list is the receiver. |
| push(new HInvokeDynamicMethod(dartMethodName, inputs)); |
| + |
| + if (isNotEquals) { |
| + HNot not = new HNot(popBoolified()); |
| + push(not); |
| + } |
| } |
| visitClosureSend(Send node) { |
| @@ -1015,7 +1035,7 @@ |
| } |
| visitSend(Send node) { |
| - if (node.selector is Operator) { |
| + if (node.selector is Operator && methodInterceptionEnabled) { |
| visitOperatorSend(node); |
| } else if (node.isPropertyAccess) { |
| generateGetter(node, elements[node]); |
| @@ -1059,44 +1079,51 @@ |
| visitSendSet(SendSet node) { |
| Operator op = node.assignmentOperator; |
| if (node.isIndex) { |
| - HStatic target = new HStatic(interceptors.getIndexAssignmentInterceptor()); |
| - add(target); |
| - visit(node.receiver); |
| - HInstruction receiver = pop(); |
| - visit(node.argumentsNode); |
| - if (const SourceString("=") == op.source) { |
| - HInstruction value = pop(); |
| - HInstruction index = pop(); |
| - push(new HIndexAssign(target, receiver, index, value)); |
| + if (!methodInterceptionEnabled) { |
| + assert(op.source == const SourceString("=")); |
|
Lasse Reichstein Nielsen
2012/01/27 09:42:34
Might as well do
op.source.stringValue == "="
(
ngeoffray
2012/01/27 10:50:04
Done.
|
| + visitDynamicSend(node); |
| } else { |
| - HInstruction value; |
| - HInstruction index; |
| - bool isCompoundAssignment = op.source.stringValue.endsWith('='); |
| - bool isPrefix = !node.isPostfix; // Compound assignments are prefix. |
| - Element getter = elements[node.selector]; |
| - if (isCompoundAssignment) { |
| - value = pop(); |
| - index = pop(); |
| + HStatic target = new HStatic( |
| + interceptors.getIndexAssignmentInterceptor()); |
| + add(target); |
| + visit(node.receiver); |
| + HInstruction receiver = pop(); |
| + visit(node.argumentsNode); |
| + if (const SourceString("=") == op.source) { |
| + HInstruction value = pop(); |
| + HInstruction index = pop(); |
| + push(new HIndexAssign(target, receiver, index, value)); |
| } else { |
| - index = pop(); |
| - value = new HLiteral(1, HType.INTEGER); |
| - add(value); |
| + HInstruction value; |
| + HInstruction index; |
| + bool isCompoundAssignment = op.source.stringValue.endsWith('='); |
| + bool isPrefix = !node.isPostfix; // Compound assignments are prefix. |
|
Lasse Reichstein Nielsen
2012/01/27 09:42:34
"are prefix." => "are considered as being prefix."
ngeoffray
2012/01/27 10:50:04
Done.
|
| + Element getter = elements[node.selector]; |
| + if (isCompoundAssignment) { |
| + value = pop(); |
| + index = pop(); |
| + } else { |
| + index = pop(); |
| + value = new HLiteral(1, HType.INTEGER); |
| + add(value); |
| + } |
| + HStatic indexMethod = new HStatic(interceptors.getIndexInterceptor()); |
| + add(indexMethod); |
| + HInstruction left = new HIndex(indexMethod, receiver, index); |
| + add(left); |
| + Element opElement = elements[op]; |
| + visitBinary(left, op, value); |
| + HInstruction assign = new HIndexAssign( |
| + target, receiver, index, pop()); |
| + add(assign); |
| + if (isPrefix) { |
| + stack.add(assign); |
| + } else { |
| + stack.add(left); |
| + } |
| } |
| - HStatic indexMethod = new HStatic(interceptors.getIndexInterceptor()); |
| - add(indexMethod); |
| - HInstruction left = new HIndex(indexMethod, receiver, index); |
| - add(left); |
| - Element opElement = elements[op]; |
| - visitBinary(left, op, value); |
| - HInstruction assign = new HIndexAssign(target, receiver, index, pop()); |
| - add(assign); |
| - if (isPrefix) { |
| - stack.add(assign); |
| - } else { |
| - stack.add(left); |
| - } |
| } |
| - } else if (const SourceString("=") == op.source) { |
| + } else if (const SourceString("=") == op.source && !node.isIndex) { |
|
Lasse Reichstein Nielsen
2012/01/27 09:42:34
Change that to
assert(!node.isIndex);
It can't ha
ngeoffray
2012/01/27 10:50:04
You're right, that's a leftover from a previous im
|
| Element element = elements[node]; |
| Link<Node> link = node.arguments; |
| assert(!link.isEmpty() && link.tail.isEmpty()); |