Index: src/hydrogen-instructions.cc |
diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
index 6db297b681e5900697136aa7fcfd309bf00b906a..2b12bc7d20f2017a54a0133b14b48b46ac9f5eed 100644 |
--- a/src/hydrogen-instructions.cc |
+++ b/src/hydrogen-instructions.cc |
@@ -2257,6 +2257,38 @@ void HIn::PrintDataTo(StringStream* stream) { |
} |
+Representation HPhi::InferredRepresentation() { |
+ bool double_occurred = false; |
+ bool int32_occurred = false; |
+ for (int i = 0; i < OperandCount(); ++i) { |
+ HValue* value = OperandAt(i); |
+ if (value->IsUnknownOSRValue()) continue; |
+ if (value->representation().IsDouble()) double_occurred = true; |
+ if (value->representation().IsInteger32()) int32_occurred = true; |
+ if (value->representation().IsTagged()) { |
+ if (value->IsConstant()) { |
+ HConstant* constant = HConstant::cast(value); |
+ if (constant->IsConvertibleToInteger()) { |
+ int32_occurred = true; |
+ } else if (constant->HasNumberValue()) { |
+ double_occurred = true; |
+ } else { |
+ return Representation::Tagged(); |
+ } |
+ } else { |
+ return Representation::Tagged(); |
+ } |
+ } |
+ } |
+ |
+ if (double_occurred) return Representation::Double(); |
+ |
+ if (int32_occurred) return Representation::Integer32(); |
+ |
+ return Representation::None(); |
+} |
+ |
+ |
// Node-specific verification code is only included in debug mode. |
#ifdef DEBUG |