Chromium Code Reviews| Index: src/hydrogen-instructions.cc |
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
| index d4938e5c3848d9509b7d0603ae19c2cf253a4373..b276cb20c77ba9e8595ebdd5c85fad7eb28ac9c7 100644 |
| --- a/src/hydrogen-instructions.cc |
| +++ b/src/hydrogen-instructions.cc |
| @@ -3565,6 +3565,7 @@ void HPhi::InferRepresentation(HInferRepresentation* h_infer) { |
| Representation HPhi::RepresentationFromInputs() { |
| + bool tagged_smi_occurred = false; |
|
Jakob Kummerow
2013/05/31 16:39:40
I don't think we should treat tagged_smi different
|
| bool double_occurred = false; |
| bool int32_occurred = false; |
| bool smi_occurred = false; |
| @@ -3574,10 +3575,18 @@ Representation HPhi::RepresentationFromInputs() { |
| HPhi* hint_value = HUnknownOSRValue::cast(value)->incoming_value(); |
| if (hint_value != NULL) { |
| Representation hint = hint_value->representation(); |
| - if (hint.IsTagged()) return hint; |
| - if (hint.IsDouble()) double_occurred = true; |
| - if (hint.IsInteger32()) int32_occurred = true; |
| - if (hint.IsSmi()) smi_occurred = true; |
| + if (hint.IsTagged()) { |
| + if (!hint_value->type().IsSmi()) return hint; |
| + if (double_occurred) return hint; |
| + if (int32_occurred) return hint; |
| + tagged_smi_occurred = true; |
| + } else if (tagged_smi_occurred) { |
| + if (!hint.IsSmi()) return Representation::Tagged(); |
| + } else { |
| + if (hint.IsDouble()) double_occurred = true; |
| + if (hint.IsInteger32()) int32_occurred = true; |
| + if (hint.IsSmi()) smi_occurred = true; |
| + } |
| } |
| continue; |
| } |
| @@ -3587,7 +3596,9 @@ Representation HPhi::RepresentationFromInputs() { |
| if (value->representation().IsTagged()) { |
| if (value->IsConstant()) { |
| HConstant* constant = HConstant::cast(value); |
| - if (constant->IsConvertibleToInteger()) { |
| + if (constant->HasSmiValue()) { |
| + smi_occurred = true; |
| + } else if (constant->IsConvertibleToInteger()) { |
| int32_occurred = true; |
| } else if (constant->HasNumberValue()) { |
| double_occurred = true; |
| @@ -3596,12 +3607,16 @@ Representation HPhi::RepresentationFromInputs() { |
| } |
| } else { |
| if (value->IsPhi() && !IsConvertibleToInteger()) { |
| - return Representation::Tagged(); |
| + if (!value->type().IsSmi()) return Representation::Tagged(); |
| + if (double_occurred) return Representation::Tagged(); |
| + if (int32_occurred) return Representation::Tagged(); |
| + tagged_smi_occurred = true; |
| } |
| } |
| } |
| } |
| + if (tagged_smi_occurred) return Representation::Smi(); |
| if (double_occurred) return Representation::Double(); |
| if (int32_occurred) return Representation::Integer32(); |
| if (smi_occurred) return Representation::Smi(); |