| Index: pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
|
| diff --git a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
|
| index 9e03bb99fbec03cae1d6771f28158af577d5695c..ff565f9ebb0aea1daea1f1e7da8ff68c83a87dd5 100644
|
| --- a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
|
| +++ b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
|
| @@ -24,14 +24,14 @@ import 'types.dart';
|
| class InvokeDynamicSpecializer {
|
| const InvokeDynamicSpecializer();
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| return TypeMaskFactory.inferredTypeForSelector(
|
| instruction.selector, instruction.mask, compiler);
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| return null;
|
| }
|
|
|
| @@ -94,18 +94,16 @@ class InvokeDynamicSpecializer {
|
| class IndexAssignSpecializer extends InvokeDynamicSpecializer {
|
| const IndexAssignSpecializer();
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| if (instruction.inputs[1].isMutableIndexable(compiler)) {
|
| - if (!instruction.inputs[2].isInteger(compiler)
|
| - && compiler.options.enableTypeAssertions) {
|
| + if (!instruction.inputs[2].isInteger(compiler) &&
|
| + compiler.options.enableTypeAssertions) {
|
| // We want the right checked mode error.
|
| return null;
|
| }
|
| - return new HIndexAssign(instruction.inputs[1],
|
| - instruction.inputs[2],
|
| - instruction.inputs[3],
|
| - instruction.selector);
|
| + return new HIndexAssign(instruction.inputs[1], instruction.inputs[2],
|
| + instruction.inputs[3], instruction.selector);
|
| }
|
| return null;
|
| }
|
| @@ -114,11 +112,11 @@ class IndexAssignSpecializer extends InvokeDynamicSpecializer {
|
| class IndexSpecializer extends InvokeDynamicSpecializer {
|
| const IndexSpecializer();
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| if (!instruction.inputs[1].isIndexablePrimitive(compiler)) return null;
|
| - if (!instruction.inputs[2].isInteger(compiler)
|
| - && compiler.options.enableTypeAssertions) {
|
| + if (!instruction.inputs[2].isInteger(compiler) &&
|
| + compiler.options.enableTypeAssertions) {
|
| // We want the right checked mode error.
|
| return null;
|
| }
|
| @@ -126,8 +124,7 @@ class IndexSpecializer extends InvokeDynamicSpecializer {
|
| instruction.getDartReceiver(compiler).instructionType;
|
| TypeMask type = TypeMaskFactory.inferredTypeForSelector(
|
| instruction.selector, receiverType, compiler);
|
| - return new HIndex(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + return new HIndex(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, type);
|
| }
|
| }
|
| @@ -139,8 +136,8 @@ class BitNotSpecializer extends InvokeDynamicSpecializer {
|
| return constantSystem.bitNot;
|
| }
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| // All bitwise operations on primitive types either produce an
|
| // integer or throw an error.
|
| JavaScriptBackend backend = compiler.backend;
|
| @@ -150,12 +147,12 @@ class BitNotSpecializer extends InvokeDynamicSpecializer {
|
| return super.computeTypeFromInputTypes(instruction, compiler);
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction input = instruction.inputs[1];
|
| if (input.isNumber(compiler)) {
|
| return new HBitNot(input, instruction.selector,
|
| - computeTypeFromInputTypes(instruction, compiler));
|
| + computeTypeFromInputTypes(instruction, compiler));
|
| }
|
| return null;
|
| }
|
| @@ -168,15 +165,15 @@ class UnaryNegateSpecializer extends InvokeDynamicSpecializer {
|
| return constantSystem.negate;
|
| }
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| TypeMask operandType = instruction.inputs[1].instructionType;
|
| if (instruction.inputs[1].isNumberOrNull(compiler)) return operandType;
|
| return super.computeTypeFromInputTypes(instruction, compiler);
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction input = instruction.inputs[1];
|
| if (input.isNumber(compiler)) {
|
| return new HNegate(input, instruction.selector, input.instructionType);
|
| @@ -188,8 +185,8 @@ class UnaryNegateSpecializer extends InvokeDynamicSpecializer {
|
| abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
|
| const BinaryArithmeticSpecializer();
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| JavaScriptBackend backend = compiler.backend;
|
| @@ -206,12 +203,12 @@ abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
|
| }
|
|
|
| bool isBuiltin(HInvokeDynamic instruction, Compiler compiler) {
|
| - return instruction.inputs[1].isNumber(compiler)
|
| - && instruction.inputs[2].isNumber(compiler);
|
| + return instruction.inputs[1].isNumber(compiler) &&
|
| + instruction.inputs[2].isNumber(compiler);
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| if (isBuiltin(instruction, compiler)) {
|
| HInstruction builtin = newBuiltinVariant(instruction, compiler);
|
| if (builtin != null) return builtin;
|
| @@ -232,8 +229,8 @@ abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
|
| bool inputsArePositiveIntegers(HInstruction instruction, Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| - return left.isPositiveIntegerOrNull(compiler)
|
| - && right.isPositiveIntegerOrNull(compiler);
|
| + return left.isPositiveIntegerOrNull(compiler) &&
|
| + right.isPositiveIntegerOrNull(compiler);
|
| }
|
|
|
| bool inputsAreUInt31(HInstruction instruction, Compiler compiler) {
|
| @@ -244,9 +241,8 @@ abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
|
|
|
| HInstruction newBuiltinVariant(HInvokeDynamic instruction, Compiler compiler);
|
|
|
| - Selector renameToOptimizedSelector(String name,
|
| - Selector selector,
|
| - Compiler compiler) {
|
| + Selector renameToOptimizedSelector(
|
| + String name, Selector selector, Compiler compiler) {
|
| if (selector.name == name) return selector;
|
| JavaScriptBackend backend = compiler.backend;
|
| return new Selector.call(
|
| @@ -258,8 +254,8 @@ abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
|
| class AddSpecializer extends BinaryArithmeticSpecializer {
|
| const AddSpecializer();
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| if (inputsAreUInt31(instruction, compiler)) {
|
| JavaScriptBackend backend = compiler.backend;
|
| return backend.uint32Type;
|
| @@ -275,10 +271,9 @@ class AddSpecializer extends BinaryArithmeticSpecializer {
|
| return constantSystem.add;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| - return new HAdd(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| + return new HAdd(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, computeTypeFromInputTypes(instruction, compiler));
|
| }
|
| }
|
| @@ -290,8 +285,8 @@ class DivideSpecializer extends BinaryArithmeticSpecializer {
|
| return constantSystem.divide;
|
| }
|
|
|
| - TypeMask computeTypeFromInputTypes(HInstruction instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInstruction instruction, Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| JavaScriptBackend backend = compiler.backend;
|
| if (left.isNumberOrNull(compiler)) {
|
| @@ -300,11 +295,10 @@ class DivideSpecializer extends BinaryArithmeticSpecializer {
|
| return super.computeTypeFromInputTypes(instruction, compiler);
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| JavaScriptBackend backend = compiler.backend;
|
| - return new HDivide(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + return new HDivide(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, backend.doubleType);
|
| }
|
| }
|
| @@ -312,8 +306,8 @@ class DivideSpecializer extends BinaryArithmeticSpecializer {
|
| class ModuloSpecializer extends BinaryArithmeticSpecializer {
|
| const ModuloSpecializer();
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| if (inputsArePositiveIntegers(instruction, compiler)) {
|
| JavaScriptBackend backend = compiler.backend;
|
| return backend.positiveIntType;
|
| @@ -325,8 +319,8 @@ class ModuloSpecializer extends BinaryArithmeticSpecializer {
|
| return constantSystem.modulo;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| // Modulo cannot be mapped to the native operator (different semantics).
|
| // TODO(sra): For non-negative values we can use JavaScript's %.
|
| return null;
|
| @@ -340,8 +334,8 @@ class MultiplySpecializer extends BinaryArithmeticSpecializer {
|
| return constantSystem.multiply;
|
| }
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| if (inputsArePositiveIntegers(instruction, compiler)) {
|
| JavaScriptBackend backend = compiler.backend;
|
| return backend.positiveIntType;
|
| @@ -349,10 +343,9 @@ class MultiplySpecializer extends BinaryArithmeticSpecializer {
|
| return super.computeTypeFromInputTypes(instruction, compiler);
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| - return new HMultiply(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| + return new HMultiply(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, computeTypeFromInputTypes(instruction, compiler));
|
| }
|
| }
|
| @@ -364,10 +357,9 @@ class SubtractSpecializer extends BinaryArithmeticSpecializer {
|
| return constantSystem.subtract;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| - return new HSubtract(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| + return new HSubtract(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, computeTypeFromInputTypes(instruction, compiler));
|
| }
|
| }
|
| @@ -379,8 +371,8 @@ class TruncatingDivideSpecializer extends BinaryArithmeticSpecializer {
|
| return constantSystem.truncatingDivide;
|
| }
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| JavaScriptBackend backend = compiler.backend;
|
| if (hasUint31Result(instruction, compiler)) {
|
| return backend.uint31Type;
|
| @@ -421,8 +413,8 @@ class TruncatingDivideSpecializer extends BinaryArithmeticSpecializer {
|
| return false;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction right = instruction.inputs[2];
|
| if (isBuiltin(instruction, compiler)) {
|
| if (right.isPositiveInteger(compiler) && isNotZero(right, compiler)) {
|
| @@ -439,10 +431,9 @@ class TruncatingDivideSpecializer extends BinaryArithmeticSpecializer {
|
| return null;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| - return new HTruncatingDivide(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| + return new HTruncatingDivide(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, computeTypeFromInputTypes(instruction, compiler));
|
| }
|
| }
|
| @@ -450,8 +441,8 @@ class TruncatingDivideSpecializer extends BinaryArithmeticSpecializer {
|
| abstract class BinaryBitOpSpecializer extends BinaryArithmeticSpecializer {
|
| const BinaryBitOpSpecializer();
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| // All bitwise operations on primitive types either produce an
|
| // integer or throw an error.
|
| HInstruction left = instruction.inputs[1];
|
| @@ -484,8 +475,8 @@ class ShiftLeftSpecializer extends BinaryBitOpSpecializer {
|
| return constantSystem.shiftLeft;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| if (left.isNumber(compiler)) {
|
| @@ -504,10 +495,9 @@ class ShiftLeftSpecializer extends BinaryBitOpSpecializer {
|
| return null;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| - return new HShiftLeft(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| + return new HShiftLeft(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, computeTypeFromInputTypes(instruction, compiler));
|
| }
|
| }
|
| @@ -515,15 +505,15 @@ class ShiftLeftSpecializer extends BinaryBitOpSpecializer {
|
| class ShiftRightSpecializer extends BinaryBitOpSpecializer {
|
| const ShiftRightSpecializer();
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| if (left.isUInt32(compiler)) return left.instructionType;
|
| return super.computeTypeFromInputTypes(instruction, compiler);
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| if (left.isNumber(compiler)) {
|
| @@ -548,10 +538,9 @@ class ShiftRightSpecializer extends BinaryBitOpSpecializer {
|
| return null;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| - return new HShiftRight(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| + return new HShiftRight(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, computeTypeFromInputTypes(instruction, compiler));
|
| }
|
|
|
| @@ -567,8 +556,8 @@ class BitOrSpecializer extends BinaryBitOpSpecializer {
|
| return constantSystem.bitOr;
|
| }
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| JavaScriptBackend backend = compiler.backend;
|
| @@ -578,10 +567,9 @@ class BitOrSpecializer extends BinaryBitOpSpecializer {
|
| return super.computeTypeFromInputTypes(instruction, compiler);
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| - return new HBitOr(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| + return new HBitOr(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, computeTypeFromInputTypes(instruction, compiler));
|
| }
|
| }
|
| @@ -593,8 +581,8 @@ class BitAndSpecializer extends BinaryBitOpSpecializer {
|
| return constantSystem.bitAnd;
|
| }
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| JavaScriptBackend backend = compiler.backend;
|
| @@ -605,10 +593,9 @@ class BitAndSpecializer extends BinaryBitOpSpecializer {
|
| return super.computeTypeFromInputTypes(instruction, compiler);
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| - return new HBitAnd(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| + return new HBitAnd(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, computeTypeFromInputTypes(instruction, compiler));
|
| }
|
| }
|
| @@ -620,8 +607,8 @@ class BitXorSpecializer extends BinaryBitOpSpecializer {
|
| return constantSystem.bitXor;
|
| }
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| JavaScriptBackend backend = compiler.backend;
|
| @@ -631,10 +618,9 @@ class BitXorSpecializer extends BinaryBitOpSpecializer {
|
| return super.computeTypeFromInputTypes(instruction, compiler);
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| - return new HBitXor(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| + return new HBitXor(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, computeTypeFromInputTypes(instruction, compiler));
|
| }
|
| }
|
| @@ -642,8 +628,8 @@ class BitXorSpecializer extends BinaryBitOpSpecializer {
|
| abstract class RelationalSpecializer extends InvokeDynamicSpecializer {
|
| const RelationalSpecializer();
|
|
|
| - TypeMask computeTypeFromInputTypes(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + TypeMask computeTypeFromInputTypes(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| JavaScriptBackend backend = compiler.backend;
|
| if (instruction.inputs[1].isPrimitiveOrNull(compiler)) {
|
| return backend.boolType;
|
| @@ -651,8 +637,8 @@ abstract class RelationalSpecializer extends InvokeDynamicSpecializer {
|
| return super.computeTypeFromInputTypes(instruction, compiler);
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| if (left.isNumber(compiler) && right.isNumber(compiler)) {
|
| @@ -667,8 +653,8 @@ abstract class RelationalSpecializer extends InvokeDynamicSpecializer {
|
| class EqualsSpecializer extends RelationalSpecializer {
|
| const EqualsSpecializer();
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| TypeMask instructionType = left.instructionType;
|
| @@ -677,8 +663,8 @@ class EqualsSpecializer extends RelationalSpecializer {
|
| }
|
| World world = compiler.world;
|
| JavaScriptBackend backend = compiler.backend;
|
| - Iterable<Element> matches = world.allFunctions.filter(
|
| - instruction.selector, instructionType);
|
| + Iterable<Element> matches =
|
| + world.allFunctions.filter(instruction.selector, instructionType);
|
| // This test relies the on `Object.==` and `Interceptor.==` always being
|
| // implemented because if the selector matches by subtype, it still will be
|
| // a regular object or an interceptor.
|
| @@ -692,11 +678,10 @@ class EqualsSpecializer extends RelationalSpecializer {
|
| return constantSystem.equal;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| JavaScriptBackend backend = compiler.backend;
|
| - return new HIdentity(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + return new HIdentity(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, backend.boolType);
|
| }
|
| }
|
| @@ -708,11 +693,10 @@ class LessSpecializer extends RelationalSpecializer {
|
| return constantSystem.less;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| JavaScriptBackend backend = compiler.backend;
|
| - return new HLess(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + return new HLess(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, backend.boolType);
|
| }
|
| }
|
| @@ -724,11 +708,10 @@ class GreaterSpecializer extends RelationalSpecializer {
|
| return constantSystem.greater;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| JavaScriptBackend backend = compiler.backend;
|
| - return new HGreater(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + return new HGreater(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, backend.boolType);
|
| }
|
| }
|
| @@ -740,11 +723,10 @@ class GreaterEqualSpecializer extends RelationalSpecializer {
|
| return constantSystem.greaterEqual;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| JavaScriptBackend backend = compiler.backend;
|
| - return new HGreaterEqual(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + return new HGreaterEqual(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, backend.boolType);
|
| }
|
| }
|
| @@ -756,11 +738,10 @@ class LessEqualSpecializer extends RelationalSpecializer {
|
| return constantSystem.lessEqual;
|
| }
|
|
|
| - HInstruction newBuiltinVariant(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction newBuiltinVariant(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| JavaScriptBackend backend = compiler.backend;
|
| - return new HLessEqual(
|
| - instruction.inputs[1], instruction.inputs[2],
|
| + return new HLessEqual(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, backend.boolType);
|
| }
|
| }
|
| @@ -772,8 +753,8 @@ class CodeUnitAtSpecializer extends InvokeDynamicSpecializer {
|
| return constantSystem.codeUnitAt;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| - Compiler compiler) {
|
| + HInstruction tryConvertToBuiltin(
|
| + HInvokeDynamic instruction, Compiler compiler) {
|
| // TODO(sra): Implement a builtin HCodeUnitAt instruction and the same index
|
| // bounds checking optimizations as for HIndex.
|
| return null;
|
|
|