| Index: sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart
|
| ===================================================================
|
| --- sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart (revision 17440)
|
| +++ sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart (working copy)
|
| @@ -267,7 +267,15 @@
|
| HInstruction tryConvertToBuiltin(HInvokeDynamicMethod instruction,
|
| HTypeMap types) {
|
| if (isBuiltin(instruction, types)) {
|
| - return newBuiltinVariant(instruction.inputs[1], instruction.inputs[2]);
|
| + HInstruction builtin =
|
| + newBuiltinVariant(instruction.inputs[1], instruction.inputs[2]);
|
| + if (builtin != null) return builtin;
|
| + // Even if there is no builtin equivalent instruction, we know
|
| + // the instruction does not have any side effect, and that it
|
| + // can be GVN'ed.
|
| + instruction.clearAllSideEffects();
|
| + instruction.clearAllDependencies();
|
| + instruction.setUseGvn();
|
| }
|
| return null;
|
| }
|
| @@ -325,15 +333,10 @@
|
| return constantSystem.modulo;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamicMethod instruction,
|
| - HTypeMap types) {
|
| + HInstruction newBuiltinVariant(HInstruction left, HInstruction right) {
|
| // Modulo cannot be mapped to the native operator (different semantics).
|
| return null;
|
| }
|
| -
|
| - HInstruction newBuiltinVariant(HInstruction left, HInstruction right) {
|
| - throw 'Modulo has no builtin variant';
|
| - }
|
| }
|
|
|
| class MultiplySpecializer extends BinaryArithmeticSpecializer {
|
| @@ -367,15 +370,10 @@
|
| return constantSystem.truncatingDivide;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamicMethod instruction,
|
| - HTypeMap types) {
|
| + HInstruction newBuiltinVariant(HInstruction left, HInstruction right) {
|
| // Truncating divide does not have a JS equivalent.
|
| return null;
|
| }
|
| -
|
| - HInstruction newBuiltinVariant(HInstruction left, HInstruction right) {
|
| - throw 'Truncating divide has no builtin variant';
|
| - }
|
| }
|
|
|
| abstract class BinaryBitOpSpecializer extends BinaryArithmeticSpecializer {
|
| @@ -436,16 +434,11 @@
|
| class ShiftRightSpecializer extends BinaryBitOpSpecializer {
|
| const ShiftRightSpecializer();
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamicMethod instruction,
|
| - HTypeMap types) {
|
| + HInstruction newBuiltinVariant(HInstruction left, HInstruction right) {
|
| // Shift right cannot be mapped to the native operator easily.
|
| return null;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInstruction left, HInstruction right) {
|
| - throw 'Shift right has no builtin variant';
|
| - }
|
| -
|
| BinaryOperation operation(ConstantSystem constantSystem) {
|
| return constantSystem.shiftRight;
|
| }
|
|
|