| 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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 // The index should be an int when the receiver is a string or array. | 123 // The index should be an int when the receiver is a string or array. |
| 124 // However it turns out that inserting an integer check in the optimized | 124 // However it turns out that inserting an integer check in the optimized |
| 125 // version is cheaper than having another bailout case. This is true, | 125 // version is cheaper than having another bailout case. This is true, |
| 126 // because the integer check will simply throw if it fails. | 126 // because the integer check will simply throw if it fails. |
| 127 return HType.UNKNOWN; | 127 return HType.UNKNOWN; |
| 128 } | 128 } |
| 129 | 129 |
| 130 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, | 130 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, |
| 131 Compiler compiler) { | 131 Compiler compiler) { |
| 132 if (instruction.inputs[1].isIndexable(compiler)) { | 132 if (instruction.inputs[1].isIndexable(compiler)) { |
| 133 return new HIndex( | 133 HInstruction index = new HIndex( |
| 134 instruction.inputs[1], instruction.inputs[2], instruction.selector); | 134 instruction.inputs[1], instruction.inputs[2], instruction.selector); |
| 135 index.instructionType = |
| 136 new HType.inferredTypeForSelector(instruction.selector, compiler); |
| 137 return index; |
| 135 } | 138 } |
| 136 return null; | 139 return null; |
| 137 } | 140 } |
| 138 } | 141 } |
| 139 | 142 |
| 140 class BitNotSpecializer extends InvokeDynamicSpecializer { | 143 class BitNotSpecializer extends InvokeDynamicSpecializer { |
| 141 const BitNotSpecializer(); | 144 const BitNotSpecializer(); |
| 142 | 145 |
| 143 UnaryOperation operation(ConstantSystem constantSystem) { | 146 UnaryOperation operation(ConstantSystem constantSystem) { |
| 144 return constantSystem.bitNot; | 147 return constantSystem.bitNot; |
| (...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 621 | 624 |
| 622 BinaryOperation operation(ConstantSystem constantSystem) { | 625 BinaryOperation operation(ConstantSystem constantSystem) { |
| 623 return constantSystem.lessEqual; | 626 return constantSystem.lessEqual; |
| 624 } | 627 } |
| 625 | 628 |
| 626 HInstruction newBuiltinVariant(HInvokeDynamic instruction) { | 629 HInstruction newBuiltinVariant(HInvokeDynamic instruction) { |
| 627 return new HLessEqual( | 630 return new HLessEqual( |
| 628 instruction.inputs[1], instruction.inputs[2], instruction.selector); | 631 instruction.inputs[1], instruction.inputs[2], instruction.selector); |
| 629 } | 632 } |
| 630 } | 633 } |
| OLD | NEW |