OLD | NEW |
---|---|
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 class Interceptors { | 5 class Interceptors { |
6 Compiler compiler; | 6 Compiler compiler; |
7 Interceptors(Compiler this.compiler); | 7 Interceptors(Compiler this.compiler); |
8 | 8 |
9 SourceString mapOperatorToMethodName(Operator op) { | 9 SourceString mapOperatorToMethodName(Operator op) { |
10 String name = op.source.stringValue; | 10 String name = op.source.stringValue; |
(...skipping 1624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1635 } | 1635 } |
1636 | 1636 |
1637 void visitUnary(Send node, Operator op) { | 1637 void visitUnary(Send node, Operator op) { |
1638 assert(node.argumentsNode is Prefix); | 1638 assert(node.argumentsNode is Prefix); |
1639 visit(node.receiver); | 1639 visit(node.receiver); |
1640 assert(op.token.kind !== PLUS_TOKEN); | 1640 assert(op.token.kind !== PLUS_TOKEN); |
1641 HInstruction operand = pop(); | 1641 HInstruction operand = pop(); |
1642 | 1642 |
1643 HInstruction target = | 1643 HInstruction target = |
1644 new HStatic(interceptors.getPrefixOperatorInterceptor(op)); | 1644 new HStatic(interceptors.getPrefixOperatorInterceptor(op)); |
1645 target.sourceToken = node.getBeginToken(); | |
floitsch
2012/07/17 14:46:53
Maybe:
attachPosition(target, node);
If this funct
podivilov
2012/07/17 16:42:46
Done.
| |
1645 add(target); | 1646 add(target); |
1646 HInvokeUnary result; | 1647 HInvokeUnary result; |
1647 String value = op.source.stringValue; | 1648 String value = op.source.stringValue; |
1648 switch (value) { | 1649 switch (value) { |
1649 case "-": result = new HNegate(target, operand); break; | 1650 case "-": result = new HNegate(target, operand); break; |
1650 case "~": result = new HBitNot(target, operand); break; | 1651 case "~": result = new HBitNot(target, operand); break; |
1651 default: | 1652 default: |
1652 compiler.internalError('Unexpected unary operator: $value.', node: op); | 1653 compiler.internalError('Unexpected unary operator: $value.', node: op); |
1653 break; | 1654 break; |
1654 } | 1655 } |
(...skipping 1887 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3542 new HSubGraphBlockInformation(elseBranch.graph)); | 3543 new HSubGraphBlockInformation(elseBranch.graph)); |
3543 | 3544 |
3544 HBasicBlock conditionStartBlock = conditionBranch.block; | 3545 HBasicBlock conditionStartBlock = conditionBranch.block; |
3545 conditionStartBlock.setBlockFlow(info, joinBlock); | 3546 conditionStartBlock.setBlockFlow(info, joinBlock); |
3546 SubGraph conditionGraph = conditionBranch.graph; | 3547 SubGraph conditionGraph = conditionBranch.graph; |
3547 HIf branch = conditionGraph.end.last; | 3548 HIf branch = conditionGraph.end.last; |
3548 assert(branch is HIf); | 3549 assert(branch is HIf); |
3549 branch.blockInformation = conditionStartBlock.blockFlow; | 3550 branch.blockInformation = conditionStartBlock.blockFlow; |
3550 } | 3551 } |
3551 } | 3552 } |
OLD | NEW |