| 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 part of ssa; | 5 part of ssa; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A special element for the extra parameter taken by intercepted | 8 * A special element for the extra parameter taken by intercepted |
| 9 * methods. We need to override [Element.computeType] because our | 9 * methods. We need to override [Element.computeType] because our |
| 10 * optimizers may look at its declared type. | 10 * optimizers may look at its declared type. |
| (...skipping 2684 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2695 | 2695 |
| 2696 visitOperatorSend(node) { | 2696 visitOperatorSend(node) { |
| 2697 assert(node.selector is Operator); | 2697 assert(node.selector is Operator); |
| 2698 if (!methodInterceptionEnabled) { | 2698 if (!methodInterceptionEnabled) { |
| 2699 visitDynamicSend(node); | 2699 visitDynamicSend(node); |
| 2700 return; | 2700 return; |
| 2701 } | 2701 } |
| 2702 | 2702 |
| 2703 Operator op = node.selector; | 2703 Operator op = node.selector; |
| 2704 if (const SourceString("[]") == op.source) { | 2704 if (const SourceString("[]") == op.source) { |
| 2705 HStatic target = new HStatic(interceptors.getIndexInterceptor()); | 2705 visitDynamicSend(node); |
| 2706 add(target); | |
| 2707 visit(node.receiver); | |
| 2708 HInstruction receiver = pop(); | |
| 2709 visit(node.argumentsNode); | |
| 2710 HInstruction index = pop(); | |
| 2711 push(new HIndex(target, receiver, index)); | |
| 2712 } else if (const SourceString("&&") == op.source || | 2706 } else if (const SourceString("&&") == op.source || |
| 2713 const SourceString("||") == op.source) { | 2707 const SourceString("||") == op.source) { |
| 2714 visitLogicalAndOr(node, op); | 2708 visitLogicalAndOr(node, op); |
| 2715 } else if (const SourceString("!") == op.source) { | 2709 } else if (const SourceString("!") == op.source) { |
| 2716 visitLogicalNot(node); | 2710 visitLogicalNot(node); |
| 2717 } else if (node.argumentsNode is Prefix) { | 2711 } else if (node.argumentsNode is Prefix) { |
| 2718 visitUnary(node, op); | 2712 visitUnary(node, op); |
| 2719 } else if (const SourceString("is") == op.source) { | 2713 } else if (const SourceString("is") == op.source) { |
| 2720 visit(node.receiver); | 2714 visit(node.receiver); |
| 2721 HInstruction expression = pop(); | 2715 HInstruction expression = pop(); |
| (...skipping 863 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3585 String reasons = fetchReasonsFromMalformedType(type); | 3579 String reasons = fetchReasonsFromMalformedType(type); |
| 3586 // TODO(johnniwinther): Change to resemble type errors from bounds check | 3580 // TODO(johnniwinther): Change to resemble type errors from bounds check |
| 3587 // on type arguments. | 3581 // on type arguments. |
| 3588 generateRuntimeError(node, '$type is malformed: $reasons'); | 3582 generateRuntimeError(node, '$type is malformed: $reasons'); |
| 3589 } else { | 3583 } else { |
| 3590 visitNewSend(node.send, type); | 3584 visitNewSend(node.send, type); |
| 3591 } | 3585 } |
| 3592 } | 3586 } |
| 3593 } | 3587 } |
| 3594 | 3588 |
| 3589 HInvokeDynamicMethod buildInvokeDynamicWithOneArgument( |
| 3590 Node node, Selector selector, HInstruction receiver, HInstruction arg0) { |
| 3591 Set<ClassElement> interceptedClasses = |
| 3592 getInterceptedClassesOn(node, selector); |
| 3593 List<HInstruction> inputs = <HInstruction>[]; |
| 3594 if (interceptedClasses != null) { |
| 3595 inputs.add(invokeInterceptor(interceptedClasses, receiver, node)); |
| 3596 } |
| 3597 inputs.add(receiver); |
| 3598 inputs.add(arg0); |
| 3599 return new HInvokeDynamicMethod(selector, inputs); |
| 3600 } |
| 3601 |
| 3595 visitSendSet(SendSet node) { | 3602 visitSendSet(SendSet node) { |
| 3596 Element element = elements[node]; | 3603 Element element = elements[node]; |
| 3597 if (!Elements.isUnresolved(element) && element.impliesType()) { | 3604 if (!Elements.isUnresolved(element) && element.impliesType()) { |
| 3598 Identifier selector = node.selector; | 3605 Identifier selector = node.selector; |
| 3599 generateThrowNoSuchMethod(node, selector.source.slowToString(), | 3606 generateThrowNoSuchMethod(node, selector.source.slowToString(), |
| 3600 argumentNodes: node.arguments); | 3607 argumentNodes: node.arguments); |
| 3601 return; | 3608 return; |
| 3602 } | 3609 } |
| 3603 Operator op = node.assignmentOperator; | 3610 Operator op = node.assignmentOperator; |
| 3604 if (node.isSuperCall) { | 3611 if (node.isSuperCall) { |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3636 // Compound assignments are considered as being prefix. | 3643 // Compound assignments are considered as being prefix. |
| 3637 bool isPrefix = !node.isPostfix; | 3644 bool isPrefix = !node.isPostfix; |
| 3638 Element getter = elements[node.selector]; | 3645 Element getter = elements[node.selector]; |
| 3639 if (isCompoundAssignment) { | 3646 if (isCompoundAssignment) { |
| 3640 value = pop(); | 3647 value = pop(); |
| 3641 index = pop(); | 3648 index = pop(); |
| 3642 } else { | 3649 } else { |
| 3643 index = pop(); | 3650 index = pop(); |
| 3644 value = graph.addConstantInt(1, constantSystem); | 3651 value = graph.addConstantInt(1, constantSystem); |
| 3645 } | 3652 } |
| 3646 HStatic indexMethod = new HStatic(interceptors.getIndexInterceptor()); | 3653 |
| 3647 add(indexMethod); | 3654 HInvokeDynamicMethod left = buildInvokeDynamicWithOneArgument( |
| 3648 HInstruction left = new HIndex(indexMethod, receiver, index); | 3655 node, new Selector.index(), receiver, index); |
| 3649 add(left); | 3656 add(left); |
| 3650 Element opElement = elements[op]; | 3657 Element opElement = elements[op]; |
| 3651 visitBinary(left, op, value); | 3658 visitBinary(left, op, value); |
| 3652 value = pop(); | 3659 value = pop(); |
| 3653 HInstruction assign = new HIndexAssign( | 3660 HInstruction assign = new HIndexAssign( |
| 3654 target, receiver, index, value); | 3661 target, receiver, index, value); |
| 3655 add(assign); | 3662 add(assign); |
| 3656 if (isPrefix) { | 3663 if (isPrefix) { |
| 3657 stack.add(value); | 3664 stack.add(value); |
| 3658 } else { | 3665 } else { |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5032 new HSubGraphBlockInformation(elseBranch.graph)); | 5039 new HSubGraphBlockInformation(elseBranch.graph)); |
| 5033 | 5040 |
| 5034 HBasicBlock conditionStartBlock = conditionBranch.block; | 5041 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 5035 conditionStartBlock.setBlockFlow(info, joinBlock); | 5042 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 5036 SubGraph conditionGraph = conditionBranch.graph; | 5043 SubGraph conditionGraph = conditionBranch.graph; |
| 5037 HIf branch = conditionGraph.end.last; | 5044 HIf branch = conditionGraph.end.last; |
| 5038 assert(branch is HIf); | 5045 assert(branch is HIf); |
| 5039 branch.blockInformation = conditionStartBlock.blockFlow; | 5046 branch.blockInformation = conditionStartBlock.blockFlow; |
| 5040 } | 5047 } |
| 5041 } | 5048 } |
| OLD | NEW |