| 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 f5acaa9760f894fcb3264a7e5d9f677ab486220e..51ff1f353ca85b5938b0144e65fbf07a3edf2cbc 100644
|
| --- a/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
|
| +++ b/pkg/compiler/lib/src/ssa/invoke_dynamic_specializers.dart
|
| @@ -2,11 +2,11 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| +import '../common_elements.dart' show CommonElements;
|
| import '../constants/constant_system.dart';
|
| import '../constants/values.dart';
|
| import '../elements/elements.dart' show Name;
|
| import '../elements/entities.dart';
|
| -import '../js_backend/backend_helpers.dart';
|
| import '../options.dart';
|
| import '../types/types.dart';
|
| import '../universe/call_structure.dart';
|
| @@ -28,7 +28,6 @@ class InvokeDynamicSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return TypeMaskFactory.inferredTypeForSelector(
|
| instruction.selector, instruction.mask, results);
|
| @@ -39,7 +38,7 @@ class InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| return null;
|
| }
|
| @@ -51,9 +50,9 @@ class InvokeDynamicSpecializer {
|
| }
|
|
|
| Selector renameToOptimizedSelector(
|
| - String name, Selector selector, BackendHelpers helpers) {
|
| + String name, Selector selector, CommonElements commonElements) {
|
| if (selector.name == name) return selector;
|
| - return new Selector.call(new Name(name, helpers.interceptorsLibrary),
|
| + return new Selector.call(new Name(name, commonElements.interceptorsLibrary),
|
| new CallStructure(selector.argumentCount));
|
| }
|
|
|
| @@ -120,7 +119,7 @@ class IndexAssignSpecializer extends InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| if (instruction.inputs[1].isMutableIndexable(closedWorld)) {
|
| if (!instruction.inputs[2].isInteger(closedWorld) &&
|
| @@ -143,7 +142,7 @@ class IndexSpecializer extends InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| if (!instruction.inputs[1].isIndexablePrimitive(closedWorld)) return null;
|
| if (!instruction.inputs[2].isInteger(closedWorld) &&
|
| @@ -171,15 +170,14 @@ class BitNotSpecializer extends InvokeDynamicSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| // All bitwise operations on primitive types either produce an
|
| // integer or throw an error.
|
| if (instruction.inputs[1].isPrimitiveOrNull(closedWorld)) {
|
| return closedWorld.commonMasks.uint32Type;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| HInstruction tryConvertToBuiltin(
|
| @@ -187,7 +185,7 @@ class BitNotSpecializer extends InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| HInstruction input = instruction.inputs[1];
|
| if (input.isNumber(closedWorld)) {
|
| @@ -195,7 +193,7 @@ class BitNotSpecializer extends InvokeDynamicSpecializer {
|
| input,
|
| instruction.selector,
|
| computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + instruction, results, options, closedWorld));
|
| }
|
| return null;
|
| }
|
| @@ -212,12 +210,11 @@ class UnaryNegateSpecializer extends InvokeDynamicSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| TypeMask operandType = instruction.inputs[1].instructionType;
|
| if (instruction.inputs[1].isNumberOrNull(closedWorld)) return operandType;
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| HInstruction tryConvertToBuiltin(
|
| @@ -225,7 +222,7 @@ class UnaryNegateSpecializer extends InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| HInstruction input = instruction.inputs[1];
|
| if (input.isNumber(closedWorld)) {
|
| @@ -242,7 +239,6 @@ abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| @@ -257,8 +253,8 @@ abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
|
| }
|
| return closedWorld.commonMasks.numType;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| bool isBuiltin(HInvokeDynamic instruction, ClosedWorld closedWorld) {
|
| @@ -271,11 +267,11 @@ abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| if (isBuiltin(instruction, closedWorld)) {
|
| - HInstruction builtin = newBuiltinVariant(
|
| - instruction, results, options, helpers, closedWorld);
|
| + HInstruction builtin =
|
| + newBuiltinVariant(instruction, results, options, closedWorld);
|
| 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
|
| @@ -303,7 +299,6 @@ abstract class BinaryArithmeticSpecializer extends InvokeDynamicSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld);
|
| }
|
|
|
| @@ -314,7 +309,6 @@ class AddSpecializer extends BinaryArithmeticSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| if (inputsAreUInt31(instruction, closedWorld)) {
|
| return closedWorld.commonMasks.uint32Type;
|
| @@ -322,8 +316,8 @@ class AddSpecializer extends BinaryArithmeticSpecializer {
|
| if (inputsArePositiveIntegers(instruction, closedWorld)) {
|
| return closedWorld.commonMasks.positiveIntType;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| BinaryOperation operation(ConstantSystem constantSystem) {
|
| @@ -334,14 +328,12 @@ class AddSpecializer extends BinaryArithmeticSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return new HAdd(
|
| instruction.inputs[1],
|
| instruction.inputs[2],
|
| instruction.selector,
|
| - computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + computeTypeFromInputTypes(instruction, results, options, closedWorld));
|
| }
|
| }
|
|
|
| @@ -356,21 +348,19 @@ class DivideSpecializer extends BinaryArithmeticSpecializer {
|
| HInstruction instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| HInstruction left = instruction.inputs[1];
|
| if (left.isNumberOrNull(closedWorld)) {
|
| return closedWorld.commonMasks.doubleType;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| HInstruction newBuiltinVariant(
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return new HDivide(instruction.inputs[1], instruction.inputs[2],
|
| instruction.selector, closedWorld.commonMasks.doubleType);
|
| @@ -384,13 +374,12 @@ class ModuloSpecializer extends BinaryArithmeticSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| if (inputsArePositiveIntegers(instruction, closedWorld)) {
|
| return closedWorld.commonMasks.positiveIntType;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| BinaryOperation operation(ConstantSystem constantSystem) {
|
| @@ -401,7 +390,6 @@ class ModuloSpecializer extends BinaryArithmeticSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| // Modulo cannot be mapped to the native operator (different semantics).
|
|
|
| @@ -450,7 +438,7 @@ class ModuloSpecializer extends BinaryArithmeticSpecializer {
|
| instruction.inputs[2],
|
| instruction.selector,
|
| computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + instruction, results, options, closedWorld));
|
| }
|
| // TODO(sra):
|
| // a % N --> a & (N-1), N=2^k, where a>=0, does not have -0.0 problem.
|
| @@ -472,13 +460,12 @@ class RemainderSpecializer extends BinaryArithmeticSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| if (inputsArePositiveIntegers(instruction, closedWorld)) {
|
| return closedWorld.commonMasks.positiveIntType;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| BinaryOperation operation(ConstantSystem constantSystem) {
|
| @@ -489,14 +476,12 @@ class RemainderSpecializer extends BinaryArithmeticSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return new HRemainder(
|
| instruction.inputs[1],
|
| instruction.inputs[2],
|
| instruction.selector,
|
| - computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + computeTypeFromInputTypes(instruction, results, options, closedWorld));
|
| }
|
| }
|
|
|
| @@ -511,27 +496,24 @@ class MultiplySpecializer extends BinaryArithmeticSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| if (inputsArePositiveIntegers(instruction, closedWorld)) {
|
| return closedWorld.commonMasks.positiveIntType;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| HInstruction newBuiltinVariant(
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return new HMultiply(
|
| instruction.inputs[1],
|
| instruction.inputs[2],
|
| instruction.selector,
|
| - computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + computeTypeFromInputTypes(instruction, results, options, closedWorld));
|
| }
|
| }
|
|
|
| @@ -546,14 +528,12 @@ class SubtractSpecializer extends BinaryArithmeticSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return new HSubtract(
|
| instruction.inputs[1],
|
| instruction.inputs[2],
|
| instruction.selector,
|
| - computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + computeTypeFromInputTypes(instruction, results, options, closedWorld));
|
| }
|
| }
|
|
|
| @@ -568,7 +548,6 @@ class TruncatingDivideSpecializer extends BinaryArithmeticSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| if (hasUint31Result(instruction, closedWorld)) {
|
| return closedWorld.commonMasks.uint31Type;
|
| @@ -576,8 +555,8 @@ class TruncatingDivideSpecializer extends BinaryArithmeticSpecializer {
|
| if (inputsArePositiveIntegers(instruction, closedWorld)) {
|
| return closedWorld.commonMasks.positiveIntType;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| bool isNotZero(HInstruction instruction) {
|
| @@ -615,19 +594,18 @@ class TruncatingDivideSpecializer extends BinaryArithmeticSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| HInstruction right = instruction.inputs[2];
|
| if (isBuiltin(instruction, closedWorld)) {
|
| if (right.isPositiveInteger(closedWorld) && isNotZero(right)) {
|
| if (hasUint31Result(instruction, closedWorld)) {
|
| - return newBuiltinVariant(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return newBuiltinVariant(instruction, results, options, closedWorld);
|
| }
|
| // We can call _tdivFast because the rhs is a 32bit integer
|
| // and not 0, nor -1.
|
| instruction.selector = renameToOptimizedSelector(
|
| - '_tdivFast', instruction.selector, helpers);
|
| + '_tdivFast', instruction.selector, commonElements);
|
| }
|
| clearAllSideEffects(instruction);
|
| }
|
| @@ -638,14 +616,12 @@ class TruncatingDivideSpecializer extends BinaryArithmeticSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return new HTruncatingDivide(
|
| instruction.inputs[1],
|
| instruction.inputs[2],
|
| instruction.selector,
|
| - computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + computeTypeFromInputTypes(instruction, results, options, closedWorld));
|
| }
|
| }
|
|
|
| @@ -656,7 +632,6 @@ abstract class BinaryBitOpSpecializer extends BinaryArithmeticSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| // All bitwise operations on primitive types either produce an
|
| // integer or throw an error.
|
| @@ -664,8 +639,8 @@ abstract class BinaryBitOpSpecializer extends BinaryArithmeticSpecializer {
|
| if (left.isPrimitiveOrNull(closedWorld)) {
|
| return closedWorld.commonMasks.uint32Type;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| bool argumentLessThan32(HInstruction instruction) {
|
| @@ -707,14 +682,13 @@ class ShiftLeftSpecializer extends BinaryBitOpSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| if (left.isNumber(closedWorld)) {
|
| if (argumentLessThan32(right)) {
|
| - return newBuiltinVariant(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return newBuiltinVariant(instruction, results, options, closedWorld);
|
| }
|
| // Even if there is no builtin equivalent instruction, we know
|
| // the instruction does not have any side effect, and that it
|
| @@ -722,7 +696,7 @@ class ShiftLeftSpecializer extends BinaryBitOpSpecializer {
|
| clearAllSideEffects(instruction);
|
| if (isPositive(right, closedWorld)) {
|
| instruction.selector = renameToOptimizedSelector(
|
| - '_shlPositive', instruction.selector, helpers);
|
| + '_shlPositive', instruction.selector, commonElements);
|
| }
|
| }
|
| return null;
|
| @@ -732,14 +706,12 @@ class ShiftLeftSpecializer extends BinaryBitOpSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return new HShiftLeft(
|
| instruction.inputs[1],
|
| instruction.inputs[2],
|
| instruction.selector,
|
| - computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + computeTypeFromInputTypes(instruction, results, options, closedWorld));
|
| }
|
| }
|
|
|
| @@ -750,12 +722,11 @@ class ShiftRightSpecializer extends BinaryBitOpSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| HInstruction left = instruction.inputs[1];
|
| if (left.isUInt32(closedWorld)) return left.instructionType;
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| HInstruction tryConvertToBuiltin(
|
| @@ -763,14 +734,13 @@ class ShiftRightSpecializer extends BinaryBitOpSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| if (left.isNumber(closedWorld)) {
|
| if (argumentLessThan32(right) && isPositive(left, closedWorld)) {
|
| - return newBuiltinVariant(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return newBuiltinVariant(instruction, results, options, closedWorld);
|
| }
|
| // Even if there is no builtin equivalent instruction, we know
|
| // the instruction does not have any side effect, and that it
|
| @@ -778,13 +748,13 @@ class ShiftRightSpecializer extends BinaryBitOpSpecializer {
|
| clearAllSideEffects(instruction);
|
| if (isPositive(right, closedWorld) && isPositive(left, closedWorld)) {
|
| instruction.selector = renameToOptimizedSelector(
|
| - '_shrBothPositive', instruction.selector, helpers);
|
| + '_shrBothPositive', instruction.selector, commonElements);
|
| } else if (isPositive(left, closedWorld) && right.isNumber(closedWorld)) {
|
| instruction.selector = renameToOptimizedSelector(
|
| - '_shrReceiverPositive', instruction.selector, helpers);
|
| + '_shrReceiverPositive', instruction.selector, commonElements);
|
| } else if (isPositive(right, closedWorld)) {
|
| instruction.selector = renameToOptimizedSelector(
|
| - '_shrOtherPositive', instruction.selector, helpers);
|
| + '_shrOtherPositive', instruction.selector, commonElements);
|
| }
|
| }
|
| return null;
|
| @@ -794,14 +764,12 @@ class ShiftRightSpecializer extends BinaryBitOpSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return new HShiftRight(
|
| instruction.inputs[1],
|
| instruction.inputs[2],
|
| instruction.selector,
|
| - computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + computeTypeFromInputTypes(instruction, results, options, closedWorld));
|
| }
|
|
|
| BinaryOperation operation(ConstantSystem constantSystem) {
|
| @@ -820,29 +788,26 @@ class BitOrSpecializer extends BinaryBitOpSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| if (left.isUInt31(closedWorld) && right.isUInt31(closedWorld)) {
|
| return closedWorld.commonMasks.uint31Type;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| HInstruction newBuiltinVariant(
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return new HBitOr(
|
| instruction.inputs[1],
|
| instruction.inputs[2],
|
| instruction.selector,
|
| - computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + computeTypeFromInputTypes(instruction, results, options, closedWorld));
|
| }
|
| }
|
|
|
| @@ -857,7 +822,6 @@ class BitAndSpecializer extends BinaryBitOpSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| @@ -865,22 +829,20 @@ class BitAndSpecializer extends BinaryBitOpSpecializer {
|
| (left.isUInt31(closedWorld) || right.isUInt31(closedWorld))) {
|
| return closedWorld.commonMasks.uint31Type;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| HInstruction newBuiltinVariant(
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return new HBitAnd(
|
| instruction.inputs[1],
|
| instruction.inputs[2],
|
| instruction.selector,
|
| - computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + computeTypeFromInputTypes(instruction, results, options, closedWorld));
|
| }
|
| }
|
|
|
| @@ -895,29 +857,26 @@ class BitXorSpecializer extends BinaryBitOpSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| if (left.isUInt31(closedWorld) && right.isUInt31(closedWorld)) {
|
| return closedWorld.commonMasks.uint31Type;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| HInstruction newBuiltinVariant(
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| return new HBitXor(
|
| instruction.inputs[1],
|
| instruction.inputs[2],
|
| instruction.selector,
|
| - computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld));
|
| + computeTypeFromInputTypes(instruction, results, options, closedWorld));
|
| }
|
| }
|
|
|
| @@ -928,13 +887,12 @@ abstract class RelationalSpecializer extends InvokeDynamicSpecializer {
|
| HInvokeDynamic instruction,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| ClosedWorld closedWorld) {
|
| if (instruction.inputs[1].isPrimitiveOrNull(closedWorld)) {
|
| return closedWorld.commonMasks.boolType;
|
| }
|
| - return super.computeTypeFromInputTypes(
|
| - instruction, results, options, helpers, closedWorld);
|
| + return super
|
| + .computeTypeFromInputTypes(instruction, results, options, closedWorld);
|
| }
|
|
|
| HInstruction tryConvertToBuiltin(
|
| @@ -942,7 +900,7 @@ abstract class RelationalSpecializer extends InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| @@ -964,7 +922,7 @@ class EqualsSpecializer extends RelationalSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| HInstruction left = instruction.inputs[1];
|
| HInstruction right = instruction.inputs[2];
|
| @@ -1063,7 +1021,7 @@ class CodeUnitAtSpecializer extends InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| // TODO(sra): Implement a builtin HCodeUnitAt instruction and the same index
|
| // bounds checking optimizations as for HIndex.
|
| @@ -1075,7 +1033,7 @@ class CodeUnitAtSpecializer extends InvokeDynamicSpecializer {
|
| clearAllSideEffects(instruction);
|
| if (instruction.inputs.last.isPositiveInteger(closedWorld)) {
|
| instruction.selector = renameToOptimizedSelector(
|
| - '_codeUnitAt', instruction.selector, helpers);
|
| + '_codeUnitAt', instruction.selector, commonElements);
|
| }
|
| }
|
| return null;
|
| @@ -1090,7 +1048,7 @@ class CompareToSpecializer extends InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| HInstruction receiver = instruction.getDartReceiver(closedWorld);
|
| // `compareTo` has no side-effect (other than throwing) and can be GVN'ed
|
| @@ -1120,7 +1078,7 @@ class IdempotentStringOperationSpecializer extends InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| HInstruction receiver = instruction.getDartReceiver(closedWorld);
|
| if (receiver.isStringOrNull(closedWorld)) {
|
| @@ -1148,7 +1106,7 @@ class PatternMatchSpecializer extends InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| HInstruction receiver = instruction.getDartReceiver(closedWorld);
|
| HInstruction pattern = instruction.inputs[2];
|
| @@ -1174,7 +1132,7 @@ class RoundSpecializer extends InvokeDynamicSpecializer {
|
| HGraph graph,
|
| GlobalTypeInferenceResults results,
|
| CompilerOptions options,
|
| - BackendHelpers helpers,
|
| + CommonElements commonElements,
|
| ClosedWorld closedWorld) {
|
| HInstruction receiver = instruction.getDartReceiver(closedWorld);
|
| if (receiver.isNumberOrNull(closedWorld)) {
|
|
|