Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index a4377de165ab84721cf40d20c0b9248fefbeb90d..0dafeab1b9adc89abfd686a9382872b437a95e6e 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -124,7 +124,6 @@ class LChunkBuilder; |
V(IsStringAndBranch) \ |
V(IsSmiAndBranch) \ |
V(IsUndetectableAndBranch) \ |
- V(StringCompareAndBranch) \ |
V(JSArrayLength) \ |
V(LeaveInlined) \ |
V(LoadContextSlot) \ |
@@ -141,6 +140,7 @@ class LChunkBuilder; |
V(LoadNamedFieldPolymorphic) \ |
V(LoadNamedGeneric) \ |
V(MathFloorOfDiv) \ |
+ V(MathMinMax) \ |
V(Mod) \ |
V(Mul) \ |
V(ObjectLiteral) \ |
@@ -170,6 +170,7 @@ class LChunkBuilder; |
V(StringAdd) \ |
V(StringCharCodeAt) \ |
V(StringCharFromCode) \ |
+ V(StringCompareAndBranch) \ |
V(StringLength) \ |
V(Sub) \ |
V(ThisFunction) \ |
@@ -286,6 +287,8 @@ class Range: public ZoneObject { |
void Intersect(Range* other); |
void Union(Range* other); |
+ void CombinedMax(Range* other); |
+ void CombinedMin(Range* other); |
void AddConstant(int32_t value); |
void Sar(int32_t value); |
@@ -3470,6 +3473,47 @@ class HDiv: public HArithmeticBinaryOperation { |
}; |
+class HMathMinMax: public HArithmeticBinaryOperation { |
+ public: |
+ enum Operation { kMathMin, kMathMax }; |
+ |
+ HMathMinMax(HValue* context, HValue* left, HValue* right, Operation op) |
+ : HArithmeticBinaryOperation(context, left, right), |
+ operation_(op) { } |
+ |
+ virtual Representation RequiredInputRepresentation(int index) { |
+ return index == 0 |
+ ? Representation::Tagged() |
+ : representation(); |
+ } |
+ |
+ virtual Representation InferredRepresentation() { |
+ if (left()->representation().IsInteger32() && |
+ right()->representation().IsInteger32()) { |
+ return Representation::Integer32(); |
+ } |
+ return Representation::Double(); |
+ } |
+ |
+ virtual bool IsCommutative() const { return true; } |
+ |
+ Operation operation() { return operation_; } |
+ |
+ DECLARE_CONCRETE_INSTRUCTION(MathMinMax) |
+ |
+ protected: |
+ virtual bool DataEquals(HValue* other) { |
+ return other->IsMathMinMax() && |
+ HMathMinMax::cast(other)->operation_ == operation_; |
+ } |
+ |
+ virtual Range* InferRange(Zone* zone); |
+ |
+ private: |
+ Operation operation_; |
+}; |
+ |
+ |
class HBitwise: public HBitwiseBinaryOperation { |
public: |
HBitwise(Token::Value op, HValue* context, HValue* left, HValue* right) |