Index: src/hydrogen-instructions.h |
diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
index f977a750d946a6b24d657b08229fc4a238c368b2..b54eb7bdcfdbc83fe8a572e4cf5cf12eb3066f13 100644 |
--- a/src/hydrogen-instructions.h |
+++ b/src/hydrogen-instructions.h |
@@ -97,6 +97,7 @@ class LChunkBuilder; |
V(ClampToUint8) \ |
V(ClassOfTestAndBranch) \ |
V(CompareNumericAndBranch) \ |
+ V(CompareHoleAndBranch) \ |
V(CompareGeneric) \ |
V(CompareObjectEqAndBranch) \ |
V(CompareMap) \ |
@@ -802,10 +803,10 @@ class HValue: public ZoneObject { |
bool CheckFlag(Flag f) const { return (flags_ & (1 << f)) != 0; } |
// Returns true if the flag specified is set for all uses, false otherwise. |
- bool CheckUsesForFlag(Flag f); |
+ bool CheckUsesForFlag(Flag f) const; |
// Returns true if the flag specified is set for all uses, and this set |
// of uses is non-empty. |
- bool HasAtLeastOneUseWithFlagAndNoneWithout(Flag f); |
+ bool HasAtLeastOneUseWithFlagAndNoneWithout(Flag f) const; |
GVNFlagSet gvn_flags() const { return gvn_flags_; } |
void SetGVNFlag(GVNFlag f) { gvn_flags_.Add(f); } |
@@ -1518,15 +1519,13 @@ class HChange: public HUnaryOperation { |
HChange(HValue* value, |
Representation to, |
bool is_truncating_to_smi, |
- bool is_truncating_to_int32, |
- bool allow_undefined_as_nan) |
+ bool is_truncating_to_int32) |
: HUnaryOperation(value) { |
ASSERT(!value->representation().IsNone()); |
ASSERT(!to.IsNone()); |
ASSERT(!value->representation().Equals(to)); |
set_representation(to); |
SetFlag(kUseGVN); |
- if (allow_undefined_as_nan) SetFlag(kAllowUndefinedAsNaN); |
if (is_truncating_to_smi) SetFlag(kTruncatingToSmi); |
if (is_truncating_to_int32) SetFlag(kTruncatingToInt32); |
if (value->representation().IsSmi() || value->type().IsSmi()) { |
@@ -1537,15 +1536,16 @@ class HChange: public HUnaryOperation { |
} |
} |
+ bool can_convert_undefined_to_nan() { |
+ return CheckUsesForFlag(kAllowUndefinedAsNaN); |
+ } |
+ |
virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
virtual HType CalculateInferredType(); |
virtual HValue* Canonicalize(); |
Representation from() const { return value()->representation(); } |
Representation to() const { return representation(); } |
- bool allow_undefined_as_nan() const { |
- return CheckFlag(kAllowUndefinedAsNaN); |
- } |
bool deoptimize_on_minus_zero() const { |
return CheckFlag(kBailoutOnMinusZero); |
} |
@@ -3945,6 +3945,32 @@ class HCompareNumericAndBranch: public HTemplateControlInstruction<2, 2> { |
}; |
+class HCompareHoleAndBranch: public HTemplateControlInstruction<2, 1> { |
+ public: |
+ // TODO(danno): make this private when the IfBuilder properly constructs |
+ // control flow instructions. |
+ explicit HCompareHoleAndBranch(HValue* object) { |
+ SetFlag(kFlexibleRepresentation); |
+ SetFlag(kAllowUndefinedAsNaN); |
+ SetOperandAt(0, object); |
+ } |
+ |
+ DECLARE_INSTRUCTION_FACTORY_P1(HCompareHoleAndBranch, HValue*); |
+ |
+ HValue* object() { return OperandAt(0); } |
+ |
+ virtual void InferRepresentation(HInferRepresentationPhase* h_infer); |
+ |
+ virtual Representation RequiredInputRepresentation(int index) { |
+ return representation(); |
+ } |
+ |
+ virtual void PrintDataTo(StringStream* stream); |
+ |
+ DECLARE_CONCRETE_INSTRUCTION(CompareHoleAndBranch) |
+}; |
+ |
+ |
class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { |
public: |
// TODO(danno): make this private when the IfBuilder properly constructs |
@@ -4328,6 +4354,11 @@ class HAdd: public HArithmeticBinaryOperation { |
} |
} |
+ virtual void RepresentationChanged(Representation to) { |
+ if (to.IsTagged()) ClearFlag(kAllowUndefinedAsNaN); |
+ HArithmeticBinaryOperation::RepresentationChanged(to); |
+ } |
+ |
DECLARE_CONCRETE_INSTRUCTION(Add) |
protected: |