| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 * [InvokeDynamicSpecializer] and its subclasses are helpers to | 8 * [InvokeDynamicSpecializer] and its subclasses are helpers to |
| 9 * optimize intercepted dynamic calls. It knows what input types | 9 * optimize intercepted dynamic calls. It knows what input types |
| 10 * would be beneficial for performance, and how to change a invoke | 10 * would be beneficial for performance, and how to change a invoke |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 62 return const EqualsSpecializer(); | 62 return const EqualsSpecializer(); |
| 63 } else if (selector.name == '<') { | 63 } else if (selector.name == '<') { |
| 64 return const LessSpecializer(); | 64 return const LessSpecializer(); |
| 65 } else if (selector.name == '<=') { | 65 } else if (selector.name == '<=') { |
| 66 return const LessEqualSpecializer(); | 66 return const LessEqualSpecializer(); |
| 67 } else if (selector.name == '>') { | 67 } else if (selector.name == '>') { |
| 68 return const GreaterSpecializer(); | 68 return const GreaterSpecializer(); |
| 69 } else if (selector.name == '>=') { | 69 } else if (selector.name == '>=') { |
| 70 return const GreaterEqualSpecializer(); | 70 return const GreaterEqualSpecializer(); |
| 71 } | 71 } |
| 72 } else if (selector.kind == SelectorKind.CALL) { |
| 73 if (selector.argumentCount == 1 && selector.namedArguments.length == 0) { |
| 74 if (selector.name == 'codeUnitAt') { |
| 75 return const CodeUnitAtSpecializer(); |
| 76 } |
| 77 } |
| 72 } | 78 } |
| 73 return const InvokeDynamicSpecializer(); | 79 return const InvokeDynamicSpecializer(); |
| 74 } | 80 } |
| 75 } | 81 } |
| 76 | 82 |
| 77 class IndexAssignSpecializer extends InvokeDynamicSpecializer { | 83 class IndexAssignSpecializer extends InvokeDynamicSpecializer { |
| 78 const IndexAssignSpecializer(); | 84 const IndexAssignSpecializer(); |
| 79 | 85 |
| 80 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, | 86 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, |
| 81 Compiler compiler) { | 87 Compiler compiler) { |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 719 } | 725 } |
| 720 | 726 |
| 721 HInstruction newBuiltinVariant(HInvokeDynamic instruction, | 727 HInstruction newBuiltinVariant(HInvokeDynamic instruction, |
| 722 Compiler compiler) { | 728 Compiler compiler) { |
| 723 JavaScriptBackend backend = compiler.backend; | 729 JavaScriptBackend backend = compiler.backend; |
| 724 return new HLessEqual( | 730 return new HLessEqual( |
| 725 instruction.inputs[1], instruction.inputs[2], | 731 instruction.inputs[1], instruction.inputs[2], |
| 726 instruction.selector, backend.boolType); | 732 instruction.selector, backend.boolType); |
| 727 } | 733 } |
| 728 } | 734 } |
| 735 |
| 736 class CodeUnitAtSpecializer extends InvokeDynamicSpecializer { |
| 737 const CodeUnitAtSpecializer(); |
| 738 |
| 739 BinaryOperation operation(ConstantSystem constantSystem) { |
| 740 return constantSystem.codeUnitAt; |
| 741 } |
| 742 |
| 743 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, |
| 744 Compiler compiler) { |
| 745 // TODO(sra): Implement a builtin HCodeUnitAt instruction and the same index |
| 746 // bounds checking optimizations as for HIndex. |
| 747 return null; |
| 748 } |
| 749 } |
| OLD | NEW |