| 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 546 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 557 | 557 |
| 558 BinaryOperation operation(ConstantSystem constantSystem) { | 558 BinaryOperation operation(ConstantSystem constantSystem) { |
| 559 return constantSystem.bitAnd; | 559 return constantSystem.bitAnd; |
| 560 } | 560 } |
| 561 | 561 |
| 562 TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction, | 562 TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction, |
| 563 Compiler compiler) { | 563 Compiler compiler) { |
| 564 HInstruction left = instruction.inputs[1]; | 564 HInstruction left = instruction.inputs[1]; |
| 565 HInstruction right = instruction.inputs[2]; | 565 HInstruction right = instruction.inputs[2]; |
| 566 JavaScriptBackend backend = compiler.backend; | 566 JavaScriptBackend backend = compiler.backend; |
| 567 if (left.isUInt31(compiler) || right.isUInt31(compiler)) { | 567 if (left.isPrimitiveOrNull(compiler) && |
| 568 (left.isUInt31(compiler) || right.isUInt31(compiler))) { |
| 568 return backend.uint31Type; | 569 return backend.uint31Type; |
| 569 } | 570 } |
| 570 return super.computeTypeFromInputTypes(instruction, compiler); | 571 return super.computeTypeFromInputTypes(instruction, compiler); |
| 571 } | 572 } |
| 572 | 573 |
| 573 HInstruction newBuiltinVariant(HInvokeDynamic instruction, | 574 HInstruction newBuiltinVariant(HInvokeDynamic instruction, |
| 574 Compiler compiler) { | 575 Compiler compiler) { |
| 575 JavaScriptBackend backend = compiler.backend; | 576 JavaScriptBackend backend = compiler.backend; |
| 576 return new HBitAnd( | 577 return new HBitAnd( |
| 577 instruction.inputs[1], instruction.inputs[2], | 578 instruction.inputs[1], instruction.inputs[2], |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 740 return constantSystem.codeUnitAt; | 741 return constantSystem.codeUnitAt; |
| 741 } | 742 } |
| 742 | 743 |
| 743 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, | 744 HInstruction tryConvertToBuiltin(HInvokeDynamic instruction, |
| 744 Compiler compiler) { | 745 Compiler compiler) { |
| 745 // TODO(sra): Implement a builtin HCodeUnitAt instruction and the same index | 746 // TODO(sra): Implement a builtin HCodeUnitAt instruction and the same index |
| 746 // bounds checking optimizations as for HIndex. | 747 // bounds checking optimizations as for HIndex. |
| 747 return null; | 748 return null; |
| 748 } | 749 } |
| 749 } | 750 } |
| OLD | NEW |