Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 7ec1f5bf95e1cf5b7b28405db9402b974cb822e9..4ac26a026733f961fe0f37ebfe1eccd278496984 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -5311,32 +5311,37 @@ bool HGraphBuilder::TryInlineBuiltinMethodCall(Call* expr, |
AddCheckConstantFunction(expr, receiver, receiver_map, true); |
HValue* right = Pop(); |
HValue* left = Pop(); |
- // Do not inline if the return representation is not certain. |
- if (!left->representation().Equals(right->representation())) { |
- Push(left); |
- Push(right); |
- return false; |
+ Pop(); // Pop receiver. |
+ |
+ HValue* left_operand = left; |
+ HValue* right_operand = right; |
+ |
+ // If we do not have two integers, we convert to double for comparison. |
+ if (!left->representation().IsInteger32() || |
+ !right->representation().IsInteger32()) { |
+ if (!left->representation().IsDouble()) { |
+ HChange* left_convert = new(zone()) HChange( |
+ left, Representation::Double(), false, true); |
fschneider
2012/02/20 12:18:39
Please break like this and comment the boolean par
Yang
2012/02/20 13:14:11
Done.
|
+ left_convert->SetFlag(HValue::kBailoutOnMinusZero); |
+ left_operand = AddInstruction(left_convert); |
+ } |
+ if (!right->representation().IsDouble()) { |
+ HChange* right_convert = new(zone()) HChange( |
+ right, Representation::Double(), false, true); |
fschneider
2012/02/20 12:18:39
Also here: Short same-line comment for the boolean
Yang
2012/02/20 13:14:11
Done.
|
+ right_convert->SetFlag(HValue::kBailoutOnMinusZero); |
+ right_operand = AddInstruction(right_convert); |
+ } |
} |
- Pop(); // Pop receiver. |
+ ASSERT(left_operand->representation().Equals( |
+ right_operand->representation())); |
+ ASSERT(!left_operand->representation().IsTagged()); |
+ |
Token::Value op = (id == kMathMin) ? Token::LT : Token::GT; |
- HCompareIDAndBranch* compare = NULL; |
- |
- if (left->representation().IsTagged()) { |
- HChange* left_cvt = |
- new(zone()) HChange(left, Representation::Double(), false, true); |
- left_cvt->SetFlag(HValue::kBailoutOnMinusZero); |
- AddInstruction(left_cvt); |
- HChange* right_cvt = |
- new(zone()) HChange(right, Representation::Double(), false, true); |
- right_cvt->SetFlag(HValue::kBailoutOnMinusZero); |
- AddInstruction(right_cvt); |
- compare = new(zone()) HCompareIDAndBranch(left_cvt, right_cvt, op); |
- compare->SetInputRepresentation(Representation::Double()); |
- } else { |
- compare = new(zone()) HCompareIDAndBranch(left, right, op); |
- compare->SetInputRepresentation(left->representation()); |
- } |
+ |
+ HCompareIDAndBranch* compare = |
+ new(zone()) HCompareIDAndBranch(left_operand, right_operand, op); |
+ compare->SetInputRepresentation(left_operand->representation()); |
HBasicBlock* return_left = graph()->CreateBasicBlock(); |
HBasicBlock* return_right = graph()->CreateBasicBlock(); |