Chromium Code Reviews| Index: src/hydrogen-instructions.h |
| diff --git a/src/hydrogen-instructions.h b/src/hydrogen-instructions.h |
| index daeba2d2a36faa712650521b052595522047c8e0..11d9f6f8346c6d82c5882e5680df7d8367bb9572 100644 |
| --- a/src/hydrogen-instructions.h |
| +++ b/src/hydrogen-instructions.h |
| @@ -3227,7 +3227,7 @@ class HConstant: public HTemplateInstruction<0> { |
| return int32_value_; |
| } |
| bool HasSmiValue() const { |
| - return HasInteger32Value() && Smi::IsValid(Integer32Value()); |
| + return has_smi_value_; |
| } |
| bool HasDoubleValue() const { return has_double_value_; } |
| double DoubleValue() const { |
| @@ -3327,6 +3327,7 @@ class HConstant: public HTemplateInstruction<0> { |
| // int32_value_ and double_value_ hold valid, safe representations |
| // of the constant. has_int32_value_ implies has_double_value_ but |
| // not the converse. |
| + bool has_smi_value_ : 1; |
| bool has_int32_value_ : 1; |
| bool has_double_value_ : 1; |
| bool is_internalized_string_ : 1; // TODO(yangguo): make this part of HType. |
| @@ -3395,6 +3396,16 @@ class HBinaryOperation: public HTemplateInstruction<3> { |
| virtual Representation RepresentationFromInputs(); |
| virtual void AssumeRepresentation(Representation r); |
| + virtual void UpdateRepresentation(Representation new_rep, |
| + HInferRepresentation* h_infer, |
| + const char* reason) { |
| + // By default, binary instructions don't handle Smis. |
|
Jakob Kummerow
2013/05/27 07:15:44
nit: s/instructions/operations/ for consistency in
|
| + if (new_rep.IsSmi()) { |
| + new_rep = Representation::Integer32(); |
| + } |
| + HValue::UpdateRepresentation(new_rep, h_infer, reason); |
| + } |
| + |
| virtual bool IsCommutative() const { return false; } |
| virtual void PrintDataTo(StringStream* stream); |
| @@ -3563,15 +3574,7 @@ class HBoundsCheck: public HTemplateInstruction<2> { |
| responsibility_direction_(DIRECTION_NONE) { |
| SetOperandAt(0, index); |
| SetOperandAt(1, length); |
| - if (r.IsNone()) { |
| - // In the normal compilation pipeline the representation is flexible |
| - // (see InferRepresentation). |
| - SetFlag(kFlexibleRepresentation); |
| - } else { |
| - // When compiling stubs we want to set the representation explicitly |
| - // so the compilation pipeline can skip the HInferRepresentation phase. |
| - set_representation(r); |
| - } |
| + SetFlag(kFlexibleRepresentation); |
| SetFlag(kUseGVN); |
| } |
| @@ -3718,7 +3721,9 @@ class HBitwiseBinaryOperation: public HBinaryOperation { |
| HInferRepresentation* h_infer, |
| const char* reason) { |
| // We only generate either int32 or generic tagged bitwise operations. |
| - if (new_rep.IsDouble()) new_rep = Representation::Integer32(); |
| + if (new_rep.IsSmi() || new_rep.IsDouble()) { |
| + new_rep = Representation::Integer32(); |
| + } |
| HValue::UpdateRepresentation(new_rep, h_infer, reason); |
| } |