| Index: sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart
|
| ===================================================================
|
| --- sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart (revision 23949)
|
| +++ sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart (working copy)
|
| @@ -40,6 +40,10 @@
|
| return null;
|
| }
|
|
|
| + bool hasBuiltinVariant(HInvokeDynamic instruction, Compiler compiler) {
|
| + return false;
|
| + }
|
| +
|
| Operation operation(ConstantSystem constantSystem) => null;
|
|
|
| static InvokeDynamicSpecializer lookupSpecializer(Selector selector) {
|
| @@ -123,6 +127,10 @@
|
| }
|
| return null;
|
| }
|
| +
|
| + bool hasBuiltinVariant(HInvokeDynamic instruction, Compiler compiler) {
|
| + return true;
|
| + }
|
| }
|
|
|
| class IndexSpecializer extends InvokeDynamicSpecializer {
|
| @@ -159,6 +167,10 @@
|
| }
|
| return null;
|
| }
|
| +
|
| + bool hasBuiltinVariant(HInvokeDynamic instruction, Compiler compiler) {
|
| + return true;
|
| + }
|
| }
|
|
|
| class BitNotSpecializer extends InvokeDynamicSpecializer {
|
| @@ -194,6 +206,10 @@
|
| if (input.isNumber()) return new HBitNot(input, instruction.selector);
|
| return null;
|
| }
|
| +
|
| + bool hasBuiltinVariant(HInvokeDynamic instruction, Compiler compiler) {
|
| + return true;
|
| + }
|
| }
|
|
|
| class UnaryNegateSpecializer extends InvokeDynamicSpecializer {
|
| @@ -230,6 +246,10 @@
|
| if (input.isNumber()) return new HNegate(input, instruction.selector);
|
| return null;
|
| }
|
| +
|
| + bool hasBuiltinVariant(HInvokeDynamic instruction, Compiler compiler) {
|
| + return true;
|
| + }
|
| }
|
|
|
| abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
|
| @@ -295,6 +315,10 @@
|
| return null;
|
| }
|
|
|
| + bool hasBuiltinVariant(HInvokeDynamic instruction, Compiler compiler) {
|
| + return true;
|
| + }
|
| +
|
| HInstruction newBuiltinVariant(HInvokeDynamic instruction);
|
| }
|
|
|
| @@ -352,6 +376,10 @@
|
| // Modulo cannot be mapped to the native operator (different semantics).
|
| return null;
|
| }
|
| +
|
| + bool hasBuiltinVariant(HInvokeDynamic instruction, Compiler compiler) {
|
| + return false;
|
| + }
|
| }
|
|
|
| class MultiplySpecializer extends BinaryArithmeticSpecializer {
|
| @@ -391,6 +419,10 @@
|
| // Truncating divide does not have a JS equivalent.
|
| return null;
|
| }
|
| +
|
| + bool hasBuiltinVariant(HInvokeDynamic instruction, Compiler compiler) {
|
| + return false;
|
| + }
|
| }
|
|
|
| abstract class BinaryBitOpSpecializer extends BinaryArithmeticSpecializer {
|
| @@ -431,11 +463,8 @@
|
| Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| - if (!left.isNumber() || !right.isConstantInteger()) return null;
|
| - HConstant rightConstant = right;
|
| - IntConstant intConstant = rightConstant.constant;
|
| - int count = intConstant.value;
|
| - if (count >= 0 && count <= 31) {
|
| + if (!left.isNumber()) return null;
|
| + if (argumentLessThan32(right)) {
|
| return newBuiltinVariant(instruction);
|
| }
|
| return null;
|
| @@ -445,6 +474,18 @@
|
| return new HShiftLeft(
|
| instruction.inputs[1], instruction.inputs[2], instruction.selector);
|
| }
|
| +
|
| + bool argumentLessThan32(HInstruction instruction) {
|
| + if (!instruction.isConstantInteger()) return false;
|
| + HConstant rightConstant = instruction;
|
| + IntConstant intConstant = rightConstant.constant;
|
| + int count = intConstant.value;
|
| + return count >= 0 && count <= 31;
|
| + }
|
| +
|
| + bool hasBuiltinVariant(HInvokeDynamic instruction, Compiler compiler) {
|
| + return argumentLessThan32(instruction.inputs[2]);
|
| + }
|
| }
|
|
|
| class ShiftRightSpecializer extends BinaryBitOpSpecializer {
|
| @@ -458,6 +499,10 @@
|
| BinaryOperation operation(ConstantSystem constantSystem) {
|
| return constantSystem.shiftRight;
|
| }
|
| +
|
| + bool hasBuiltinVariant(HInvokeDynamic instruction, Compiler compiler) {
|
| + return true;
|
| + }
|
| }
|
|
|
| class BitOrSpecializer extends BinaryBitOpSpecializer {
|
| @@ -537,6 +582,10 @@
|
| return null;
|
| }
|
|
|
| + bool hasBuiltinVariant(HInvokeDynamic instruction, Compiler compiler) {
|
| + return true;
|
| + }
|
| +
|
| HInstruction newBuiltinVariant(HInvokeDynamic instruction);
|
| }
|
|
|
|
|