| Index: src/hydrogen-instructions.h
|
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h
|
| index 64910c8d55ff8a70b27b6b97b49e0fc5038917db..88574a369bbe9cc5add44d573c2de7534ee1889d 100644
|
| --- a/src/hydrogen-instructions.h
|
| +++ b/src/hydrogen-instructions.h
|
| @@ -2369,38 +2369,8 @@ class HBitNot: public HUnaryOperation {
|
|
|
| class HUnaryMathOperation: public HTemplateInstruction<2> {
|
| public:
|
| - HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op)
|
| - : op_(op) {
|
| - SetOperandAt(0, context);
|
| - SetOperandAt(1, value);
|
| - switch (op) {
|
| - case kMathFloor:
|
| - case kMathRound:
|
| - case kMathCeil:
|
| - set_representation(Representation::Integer32());
|
| - break;
|
| - case kMathAbs:
|
| - // Not setting representation here: it is None intentionally.
|
| - SetFlag(kFlexibleRepresentation);
|
| - SetGVNFlag(kChangesNewSpacePromotion);
|
| - break;
|
| - case kMathSqrt:
|
| - case kMathPowHalf:
|
| - case kMathLog:
|
| - case kMathSin:
|
| - case kMathCos:
|
| - case kMathTan:
|
| - set_representation(Representation::Double());
|
| - SetGVNFlag(kChangesNewSpacePromotion);
|
| - break;
|
| - case kMathExp:
|
| - set_representation(Representation::Double());
|
| - break;
|
| - default:
|
| - UNREACHABLE();
|
| - }
|
| - SetFlag(kUseGVN);
|
| - }
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* value, BuiltinFunctionId op);
|
|
|
| HValue* context() { return OperandAt(0); }
|
| HValue* value() { return OperandAt(1); }
|
| @@ -2418,7 +2388,6 @@ class HUnaryMathOperation: public HTemplateInstruction<2> {
|
| switch (op_) {
|
| case kMathFloor:
|
| case kMathRound:
|
| - case kMathCeil:
|
| case kMathSqrt:
|
| case kMathPowHalf:
|
| case kMathLog:
|
| @@ -2450,6 +2419,39 @@ class HUnaryMathOperation: public HTemplateInstruction<2> {
|
| }
|
|
|
| private:
|
| + HUnaryMathOperation(HValue* context, HValue* value, BuiltinFunctionId op)
|
| + : op_(op) {
|
| + SetOperandAt(0, context);
|
| + SetOperandAt(1, value);
|
| + switch (op) {
|
| + case kMathFloor:
|
| + case kMathRound:
|
| + case kMathCeil:
|
| + set_representation(Representation::Integer32());
|
| + break;
|
| + case kMathAbs:
|
| + // Not setting representation here: it is None intentionally.
|
| + SetFlag(kFlexibleRepresentation);
|
| + SetGVNFlag(kChangesNewSpacePromotion);
|
| + break;
|
| + case kMathSqrt:
|
| + case kMathPowHalf:
|
| + case kMathLog:
|
| + case kMathSin:
|
| + case kMathCos:
|
| + case kMathTan:
|
| + set_representation(Representation::Double());
|
| + SetGVNFlag(kChangesNewSpacePromotion);
|
| + break;
|
| + case kMathExp:
|
| + set_representation(Representation::Double());
|
| + break;
|
| + default:
|
| + UNREACHABLE();
|
| + }
|
| + SetFlag(kUseGVN);
|
| + }
|
| +
|
| virtual bool IsDeletable() const { return true; }
|
|
|
| BuiltinFunctionId op_;
|
| @@ -3064,6 +3066,15 @@ class HConstant: public HTemplateInstruction<0> {
|
| // representation of the number in int32_value_.
|
| return int32_value_;
|
| }
|
| + bool HasStringValue() const {
|
| + if (has_double_value_ || has_int32_value_) return false;
|
| + ASSERT(!handle_.is_null());
|
| + return handle_->IsString();
|
| + }
|
| + Handle<String> StringValue() const {
|
| + ASSERT(HasStringValue());
|
| + return Handle<String>::cast(handle_);
|
| + }
|
|
|
| bool ToBoolean();
|
|
|
| @@ -3892,6 +3903,8 @@ class HPower: public HTemplateInstruction<2> {
|
| SetGVNFlag(kChangesNewSpacePromotion);
|
| }
|
|
|
| + static HInstruction* New(Zone* zone, HValue* left, HValue* right);
|
| +
|
| HValue* left() { return OperandAt(0); }
|
| HValue* right() const { return OperandAt(1); }
|
|
|
| @@ -3943,6 +3956,9 @@ class HAdd: public HArithmeticBinaryOperation {
|
| SetFlag(kCanOverflow);
|
| }
|
|
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* left, HValue* right);
|
| +
|
| // Add is only commutative if two integer values are added and not if two
|
| // tagged values are added (because it might be a String concatenation).
|
| virtual bool IsCommutative() const {
|
| @@ -3951,11 +3967,6 @@ class HAdd: public HArithmeticBinaryOperation {
|
|
|
| virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
|
|
|
| - static HInstruction* NewHAdd(Zone* zone,
|
| - HValue* context,
|
| - HValue* left,
|
| - HValue* right);
|
| -
|
| virtual HType CalculateInferredType();
|
|
|
| virtual HValue* Canonicalize();
|
| @@ -3993,15 +4004,13 @@ class HSub: public HArithmeticBinaryOperation {
|
| SetFlag(kCanOverflow);
|
| }
|
|
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* left, HValue* right);
|
| +
|
| virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
|
|
|
| virtual HValue* Canonicalize();
|
|
|
| - static HInstruction* NewHSub(Zone* zone,
|
| - HValue* context,
|
| - HValue* left,
|
| - HValue* right);
|
| -
|
| virtual bool IsRelationTrueInternal(NumericRelation relation, HValue* other) {
|
| if (right()->IsInteger32Constant()) {
|
| HValue* base = left();
|
| @@ -4024,10 +4033,8 @@ class HSub: public HArithmeticBinaryOperation {
|
|
|
| class HMul: public HArithmeticBinaryOperation {
|
| public:
|
| - HMul(HValue* context, HValue* left, HValue* right)
|
| - : HArithmeticBinaryOperation(context, left, right) {
|
| - SetFlag(kCanOverflow);
|
| - }
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* left, HValue* right);
|
|
|
| virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
|
|
|
| @@ -4036,26 +4043,25 @@ class HMul: public HArithmeticBinaryOperation {
|
| return !representation().IsTagged();
|
| }
|
|
|
| - static HInstruction* NewHMul(Zone* zone,
|
| - HValue* context,
|
| - HValue* left,
|
| - HValue* right);
|
| -
|
| DECLARE_CONCRETE_INSTRUCTION(Mul)
|
|
|
| protected:
|
| virtual bool DataEquals(HValue* other) { return true; }
|
|
|
| virtual Range* InferRange(Zone* zone);
|
| +
|
| + private:
|
| + HMul(HValue* context, HValue* left, HValue* right)
|
| + : HArithmeticBinaryOperation(context, left, right) {
|
| + SetFlag(kCanOverflow);
|
| + }
|
| };
|
|
|
|
|
| class HMod: public HArithmeticBinaryOperation {
|
| public:
|
| - HMod(HValue* context, HValue* left, HValue* right)
|
| - : HArithmeticBinaryOperation(context, left, right) {
|
| - SetFlag(kCanBeDivByZero);
|
| - }
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* left, HValue* right);
|
|
|
| bool HasPowerOf2Divisor() {
|
| if (right()->IsConstant() &&
|
| @@ -4069,27 +4075,25 @@ class HMod: public HArithmeticBinaryOperation {
|
|
|
| virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
|
|
|
| - static HInstruction* NewHMod(Zone* zone,
|
| - HValue* context,
|
| - HValue* left,
|
| - HValue* right);
|
| -
|
| DECLARE_CONCRETE_INSTRUCTION(Mod)
|
|
|
| protected:
|
| virtual bool DataEquals(HValue* other) { return true; }
|
|
|
| virtual Range* InferRange(Zone* zone);
|
| +
|
| + private:
|
| + HMod(HValue* context, HValue* left, HValue* right)
|
| + : HArithmeticBinaryOperation(context, left, right) {
|
| + SetFlag(kCanBeDivByZero);
|
| + }
|
| };
|
|
|
|
|
| class HDiv: public HArithmeticBinaryOperation {
|
| public:
|
| - HDiv(HValue* context, HValue* left, HValue* right)
|
| - : HArithmeticBinaryOperation(context, left, right) {
|
| - SetFlag(kCanBeDivByZero);
|
| - SetFlag(kCanOverflow);
|
| - }
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* left, HValue* right);
|
|
|
| bool HasPowerOf2Divisor() {
|
| if (right()->IsConstant() &&
|
| @@ -4103,17 +4107,19 @@ class HDiv: public HArithmeticBinaryOperation {
|
|
|
| virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited);
|
|
|
| - static HInstruction* NewHDiv(Zone* zone,
|
| - HValue* context,
|
| - HValue* left,
|
| - HValue* right);
|
| -
|
| DECLARE_CONCRETE_INSTRUCTION(Div)
|
|
|
| protected:
|
| virtual bool DataEquals(HValue* other) { return true; }
|
|
|
| virtual Range* InferRange(Zone* zone);
|
| +
|
| + private:
|
| + HDiv(HValue* context, HValue* left, HValue* right)
|
| + : HArithmeticBinaryOperation(context, left, right) {
|
| + SetFlag(kCanBeDivByZero);
|
| + SetFlag(kCanOverflow);
|
| + }
|
| };
|
|
|
|
|
| @@ -4121,9 +4127,8 @@ class HMathMinMax: public HArithmeticBinaryOperation {
|
| public:
|
| enum Operation { kMathMin, kMathMax };
|
|
|
| - HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op)
|
| - : HArithmeticBinaryOperation(context, left, right),
|
| - operation_(op) { }
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* left, HValue* right, Operation op);
|
|
|
| virtual Representation RequiredInputRepresentation(int index) {
|
| return index == 0 ? Representation::Tagged()
|
| @@ -4161,18 +4166,21 @@ class HMathMinMax: public HArithmeticBinaryOperation {
|
| virtual Range* InferRange(Zone* zone);
|
|
|
| private:
|
| + HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op)
|
| + : HArithmeticBinaryOperation(context, left, right),
|
| + operation_(op) { }
|
| +
|
| Operation operation_;
|
| };
|
|
|
|
|
| class HBitwise: public HBitwiseBinaryOperation {
|
| public:
|
| - HBitwise(Token::Value op, HValue* context, HValue* left, HValue* right)
|
| - : HBitwiseBinaryOperation(context, left, right), op_(op) {
|
| - ASSERT(op == Token::BIT_AND ||
|
| - op == Token::BIT_OR ||
|
| - op == Token::BIT_XOR);
|
| - }
|
| + static HInstruction* New(Zone* zone,
|
| + Token::Value op,
|
| + HValue* context,
|
| + HValue* left,
|
| + HValue* right);
|
|
|
| Token::Value op() const { return op_; }
|
|
|
| @@ -4180,12 +4188,6 @@ class HBitwise: public HBitwiseBinaryOperation {
|
|
|
| virtual HValue* Canonicalize();
|
|
|
| - static HInstruction* NewHBitwise(Zone* zone,
|
| - Token::Value op,
|
| - HValue* context,
|
| - HValue* left,
|
| - HValue* right);
|
| -
|
| virtual void PrintDataTo(StringStream* stream);
|
|
|
| DECLARE_CONCRETE_INSTRUCTION(Bitwise)
|
| @@ -4198,79 +4200,76 @@ class HBitwise: public HBitwiseBinaryOperation {
|
| virtual Range* InferRange(Zone* zone);
|
|
|
| private:
|
| + HBitwise(Token::Value op, HValue* context, HValue* left, HValue* right)
|
| + : HBitwiseBinaryOperation(context, left, right), op_(op) {
|
| + ASSERT(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR);
|
| + }
|
| +
|
| Token::Value op_;
|
| };
|
|
|
|
|
| class HShl: public HBitwiseBinaryOperation {
|
| public:
|
| - HShl(HValue* context, HValue* left, HValue* right)
|
| - : HBitwiseBinaryOperation(context, left, right) { }
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* left, HValue* right);
|
|
|
| virtual Range* InferRange(Zone* zone);
|
|
|
| - static HInstruction* NewHShl(Zone* zone,
|
| - HValue* context,
|
| - HValue* left,
|
| - HValue* right);
|
| -
|
| DECLARE_CONCRETE_INSTRUCTION(Shl)
|
|
|
| protected:
|
| virtual bool DataEquals(HValue* other) { return true; }
|
| +
|
| + private:
|
| + HShl(HValue* context, HValue* left, HValue* right)
|
| + : HBitwiseBinaryOperation(context, left, right) { }
|
| };
|
|
|
|
|
| class HShr: public HBitwiseBinaryOperation {
|
| public:
|
| - HShr(HValue* context, HValue* left, HValue* right)
|
| - : HBitwiseBinaryOperation(context, left, right) { }
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* left, HValue* right);
|
|
|
| virtual Range* InferRange(Zone* zone);
|
|
|
| - static HInstruction* NewHShr(Zone* zone,
|
| - HValue* context,
|
| - HValue* left,
|
| - HValue* right);
|
| -
|
| DECLARE_CONCRETE_INSTRUCTION(Shr)
|
|
|
| protected:
|
| virtual bool DataEquals(HValue* other) { return true; }
|
| +
|
| + private:
|
| + HShr(HValue* context, HValue* left, HValue* right)
|
| + : HBitwiseBinaryOperation(context, left, right) { }
|
| };
|
|
|
|
|
| class HSar: public HBitwiseBinaryOperation {
|
| public:
|
| - HSar(HValue* context, HValue* left, HValue* right)
|
| - : HBitwiseBinaryOperation(context, left, right) { }
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* left, HValue* right);
|
|
|
| virtual Range* InferRange(Zone* zone);
|
|
|
| - static HInstruction* NewHSar(Zone* zone,
|
| - HValue* context,
|
| - HValue* left,
|
| - HValue* right);
|
| -
|
| DECLARE_CONCRETE_INSTRUCTION(Sar)
|
|
|
| protected:
|
| virtual bool DataEquals(HValue* other) { return true; }
|
| +
|
| + private:
|
| + HSar(HValue* context, HValue* left, HValue* right)
|
| + : HBitwiseBinaryOperation(context, left, right) { }
|
| };
|
|
|
|
|
| class HRor: public HBitwiseBinaryOperation {
|
| public:
|
| HRor(HValue* context, HValue* left, HValue* right)
|
| - : HBitwiseBinaryOperation(context, left, right) {
|
| + : HBitwiseBinaryOperation(context, left, right) {
|
| ChangeRepresentation(Representation::Integer32());
|
| }
|
|
|
| - static HInstruction* NewHRor(Zone* zone,
|
| - HValue* context,
|
| - HValue* left,
|
| - HValue* right);
|
| -
|
| DECLARE_CONCRETE_INSTRUCTION(Ror)
|
|
|
| protected:
|
| @@ -5394,13 +5393,8 @@ class HTransitionElementsKind: public HTemplateInstruction<2> {
|
|
|
| class HStringAdd: public HBinaryOperation {
|
| public:
|
| - HStringAdd(HValue* context, HValue* left, HValue* right)
|
| - : HBinaryOperation(context, left, right) {
|
| - set_representation(Representation::Tagged());
|
| - SetFlag(kUseGVN);
|
| - SetGVNFlag(kDependsOnMaps);
|
| - SetGVNFlag(kChangesNewSpacePromotion);
|
| - }
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* left, HValue* right);
|
|
|
| virtual Representation RequiredInputRepresentation(int index) {
|
| return Representation::Tagged();
|
| @@ -5415,8 +5409,17 @@ class HStringAdd: public HBinaryOperation {
|
| protected:
|
| virtual bool DataEquals(HValue* other) { return true; }
|
|
|
| +
|
| + private:
|
| + HStringAdd(HValue* context, HValue* left, HValue* right)
|
| + : HBinaryOperation(context, left, right) {
|
| + set_representation(Representation::Tagged());
|
| + SetFlag(kUseGVN);
|
| + SetGVNFlag(kDependsOnMaps);
|
| + SetGVNFlag(kChangesNewSpacePromotion);
|
| + }
|
| +
|
| // TODO(svenpanne) Might be safe, but leave it out until we know for sure.
|
| - // private:
|
| // virtual bool IsDeletable() const { return true; }
|
| };
|
|
|
| @@ -5469,6 +5472,9 @@ class HStringCharFromCode: public HTemplateInstruction<2> {
|
| SetGVNFlag(kChangesNewSpacePromotion);
|
| }
|
|
|
| + static HInstruction* New(
|
| + Zone* zone, HValue* context, HValue* char_code);
|
| +
|
| virtual Representation RequiredInputRepresentation(int index) {
|
| return index == 0
|
| ? Representation::Tagged()
|
| @@ -5497,6 +5503,8 @@ class HStringLength: public HUnaryOperation {
|
| SetGVNFlag(kDependsOnMaps);
|
| }
|
|
|
| + static HInstruction* New(Zone* zone, HValue* string);
|
| +
|
| virtual Representation RequiredInputRepresentation(int index) {
|
| return Representation::Tagged();
|
| }
|
|
|