| Index: sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart
|
| ===================================================================
|
| --- sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart (revision 20306)
|
| +++ sdk/lib/_internal/compiler/implementation/ssa/invoke_dynamic_specializers.dart (working copy)
|
| @@ -24,7 +24,8 @@
|
| return instruction.instructionType;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction) {
|
| + HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| + Compiler compiler) {
|
| return null;
|
| }
|
|
|
| @@ -96,7 +97,8 @@
|
| return HType.UNKNOWN;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction) {
|
| + HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| + Compiler compiler) {
|
| if (instruction.inputs[1].isMutableArray()) {
|
| return new HIndexAssign(instruction.inputs[1],
|
| instruction.inputs[2],
|
| @@ -124,7 +126,8 @@
|
| return HType.UNKNOWN;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction) {
|
| + HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| + Compiler compiler) {
|
| if (instruction.inputs[1].isIndexablePrimitive()) {
|
| return new HIndex(instruction.inputs[1], instruction.inputs[2]);
|
| }
|
| @@ -159,7 +162,8 @@
|
| return instruction.instructionType;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction) {
|
| + HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| + Compiler compiler) {
|
| HInstruction input = instruction.inputs[1];
|
| if (input.isNumber()) return new HBitNot(input);
|
| return null;
|
| @@ -194,7 +198,8 @@
|
| return instruction.instructionType;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction) {
|
| + HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| + Compiler compiler) {
|
| HInstruction input = instruction.inputs[1];
|
| if (input.isNumber()) return new HNegate(input);
|
| return null;
|
| @@ -249,7 +254,8 @@
|
| && instruction.inputs[2].isNumber();
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction) {
|
| + HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| + Compiler compiler) {
|
| if (isBuiltin(instruction)) {
|
| HInstruction builtin =
|
| newBuiltinVariant(instruction.inputs[1], instruction.inputs[2]);
|
| @@ -392,7 +398,8 @@
|
| return constantSystem.shiftLeft;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction) {
|
| + HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| + Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| if (!left.isNumber() || !right.isConstantInteger()) return null;
|
| @@ -487,7 +494,8 @@
|
| return HType.UNKNOWN;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction) {
|
| + HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| + Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| if (left.isNumber() && right.isNumber()) {
|
| @@ -528,12 +536,23 @@
|
| return HType.UNKNOWN;
|
| }
|
|
|
| - HInstruction tryConvertToBuiltin(HInvokeDynamic instruction) {
|
| + HInstruction tryConvertToBuiltin(HInvokeDynamic instruction,
|
| + Compiler compiler) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| - if (left.instructionType.isPrimitiveOrNull() || right.isConstantNull()) {
|
| + HType instructionType = left.instructionType;
|
| + if (right.isConstantNull() || instructionType.isPrimitiveOrNull()) {
|
| return newBuiltinVariant(left, right);
|
| }
|
| + // Make the mask non-nullable to avoid finding a potential
|
| + // JSNull::operator==.
|
| + TypeMask mask = instructionType.computeMask(compiler).nonNullable();
|
| + Selector selector = new TypedSelector(mask, instruction.selector);
|
| + World world = compiler.world;
|
| + JavaScriptBackend backend = compiler.backend;
|
| + if (world.locateSingleElement(selector) == backend.objectEquals) {
|
| + return newBuiltinVariant(left, right);
|
| + }
|
| return null;
|
| }
|
|
|
|
|