Chromium Code Reviews| 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 2602 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2613 | 2613 |
| 2614 visitOperatorSend(node) { | 2614 visitOperatorSend(node) { |
| 2615 assert(node.selector is Operator); | 2615 assert(node.selector is Operator); |
| 2616 if (!methodInterceptionEnabled) { | 2616 if (!methodInterceptionEnabled) { |
| 2617 visitDynamicSend(node); | 2617 visitDynamicSend(node); |
| 2618 return; | 2618 return; |
| 2619 } | 2619 } |
| 2620 | 2620 |
| 2621 Operator op = node.selector; | 2621 Operator op = node.selector; |
| 2622 if (const SourceString("[]") == op.source) { | 2622 if (const SourceString("[]") == op.source) { |
| 2623 HStatic target = new HStatic(interceptors.getIndexInterceptor()); | |
| 2624 add(target); | |
| 2625 visit(node.receiver); | 2623 visit(node.receiver); |
| 2626 HInstruction receiver = pop(); | 2624 HInstruction receiver = pop(); |
| 2627 visit(node.argumentsNode); | 2625 visit(node.argumentsNode); |
| 2628 HInstruction index = pop(); | 2626 HInstruction index = pop(); |
| 2629 push(new HIndex(target, receiver, index)); | 2627 Selector selector = elements.getSelector(node); |
|
kasperl
2012/11/30 09:23:04
How about refactoring this? Maybe add a helper tha
ngeoffray
2012/11/30 13:18:14
Done.
| |
| 2628 Set<ClassElement> interceptedClasses = | |
| 2629 getInterceptedClassesOn(node, selector); | |
| 2630 List<HInstruction> inputs = <HInstruction>[]; | |
| 2631 if (interceptedClasses != null) { | |
| 2632 inputs.add(invokeInterceptor(interceptedClasses, receiver, node)); | |
| 2633 } | |
| 2634 inputs.add(receiver); | |
| 2635 inputs.add(index); | |
| 2636 push(new HInvokeDynamicMethod(selector, inputs)); | |
| 2630 } else if (const SourceString("&&") == op.source || | 2637 } else if (const SourceString("&&") == op.source || |
| 2631 const SourceString("||") == op.source) { | 2638 const SourceString("||") == op.source) { |
| 2632 visitLogicalAndOr(node, op); | 2639 visitLogicalAndOr(node, op); |
| 2633 } else if (const SourceString("!") == op.source) { | 2640 } else if (const SourceString("!") == op.source) { |
| 2634 visitLogicalNot(node); | 2641 visitLogicalNot(node); |
| 2635 } else if (node.argumentsNode is Prefix) { | 2642 } else if (node.argumentsNode is Prefix) { |
| 2636 visitUnary(node, op); | 2643 visitUnary(node, op); |
| 2637 } else if (const SourceString("is") == op.source) { | 2644 } else if (const SourceString("is") == op.source) { |
| 2638 visit(node.receiver); | 2645 visit(node.receiver); |
| 2639 HInstruction expression = pop(); | 2646 HInstruction expression = pop(); |
| (...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3506 // Compound assignments are considered as being prefix. | 3513 // Compound assignments are considered as being prefix. |
| 3507 bool isPrefix = !node.isPostfix; | 3514 bool isPrefix = !node.isPostfix; |
| 3508 Element getter = elements[node.selector]; | 3515 Element getter = elements[node.selector]; |
| 3509 if (isCompoundAssignment) { | 3516 if (isCompoundAssignment) { |
| 3510 value = pop(); | 3517 value = pop(); |
| 3511 index = pop(); | 3518 index = pop(); |
| 3512 } else { | 3519 } else { |
| 3513 index = pop(); | 3520 index = pop(); |
| 3514 value = graph.addConstantInt(1, constantSystem); | 3521 value = graph.addConstantInt(1, constantSystem); |
| 3515 } | 3522 } |
| 3516 HStatic indexMethod = new HStatic(interceptors.getIndexInterceptor()); | 3523 Selector selector = new Selector.index(); |
| 3517 add(indexMethod); | 3524 Set<ClassElement> interceptedClasses = |
| 3518 HInstruction left = new HIndex(indexMethod, receiver, index); | 3525 getInterceptedClassesOn(node, selector); |
| 3526 List<HInstruction> inputs = <HInstruction>[]; | |
| 3527 if (interceptedClasses != null) { | |
| 3528 inputs.add(invokeInterceptor(interceptedClasses, receiver, node)); | |
| 3529 } | |
| 3530 inputs.add(receiver); | |
| 3531 inputs.add(index); | |
| 3532 HInstruction left = new HInvokeDynamicMethod( selector, inputs); | |
|
kasperl
2012/11/30 09:23:04
Remove space before selector.
ngeoffray
2012/11/30 13:18:14
Done.
| |
| 3519 add(left); | 3533 add(left); |
| 3520 Element opElement = elements[op]; | 3534 Element opElement = elements[op]; |
| 3521 visitBinary(left, op, value); | 3535 visitBinary(left, op, value); |
| 3522 value = pop(); | 3536 value = pop(); |
| 3523 HInstruction assign = new HIndexAssign( | 3537 HInstruction assign = new HIndexAssign( |
| 3524 target, receiver, index, value); | 3538 target, receiver, index, value); |
| 3525 add(assign); | 3539 add(assign); |
| 3526 if (isPrefix) { | 3540 if (isPrefix) { |
| 3527 stack.add(value); | 3541 stack.add(value); |
| 3528 } else { | 3542 } else { |
| (...skipping 1373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 4902 new HSubGraphBlockInformation(elseBranch.graph)); | 4916 new HSubGraphBlockInformation(elseBranch.graph)); |
| 4903 | 4917 |
| 4904 HBasicBlock conditionStartBlock = conditionBranch.block; | 4918 HBasicBlock conditionStartBlock = conditionBranch.block; |
| 4905 conditionStartBlock.setBlockFlow(info, joinBlock); | 4919 conditionStartBlock.setBlockFlow(info, joinBlock); |
| 4906 SubGraph conditionGraph = conditionBranch.graph; | 4920 SubGraph conditionGraph = conditionBranch.graph; |
| 4907 HIf branch = conditionGraph.end.last; | 4921 HIf branch = conditionGraph.end.last; |
| 4908 assert(branch is HIf); | 4922 assert(branch is HIf); |
| 4909 branch.blockInformation = conditionStartBlock.blockFlow; | 4923 branch.blockInformation = conditionStartBlock.blockFlow; |
| 4910 } | 4924 } |
| 4911 } | 4925 } |
| OLD | NEW |