Chromium Code Reviews| Index: src/hydrogen-instructions.cc |
| diff --git a/src/hydrogen-instructions.cc b/src/hydrogen-instructions.cc |
| index 074054ce1d0c414ce12c6e8230400a1acd798cba..2805d3983fb4af7473fd53c7730d269559ebf514 100644 |
| --- a/src/hydrogen-instructions.cc |
| +++ b/src/hydrogen-instructions.cc |
| @@ -1457,7 +1457,17 @@ void HGoto::PrintDataTo(StringStream* stream) { |
| void HCompareIDAndBranch::SetInputRepresentation(Representation r) { |
| input_representation_ = r; |
| if (r.IsDouble()) { |
| - SetFlag(kDeoptimizeOnUndefined); |
| + // ==, === and != have special handling of undefined, specifically undeifned |
|
fschneider
2012/03/02 12:39:15
s/undeifned/undefined
danno
2012/03/02 13:28:45
Done.
|
| + // == undefined is 'true' but the standard Crankshaft tagged-to-double |
| + // conversion to ensure the HCompareIDAndBranch's inputs, including |
| + // undefined values, are doubles will convert undefined to NaN, and NaN == |
| + // NaN is 'false'. So all comparisons that aren't explicitly defined by the |
| + // spec to call ToPrimitive() (i.e. anything not an ordered relational |
| + // comparison) must deopt when one of the arguments is undefined. |
| + // See v8:1434 |
|
fschneider
2012/03/02 12:39:15
I'd also refer to the corresponding sections in th
danno
2012/03/02 13:28:45
Done.
|
| + if (!Token::IsOrderedCompareOp(token_)) { |
|
fschneider
2012/03/02 12:39:15
maybe rename to IsRelationalCompareOp.
danno
2012/03/02 13:28:45
Done.
|
| + SetFlag(kDeoptimizeOnUndefined); |
| + } |
| } else { |
| ASSERT(r.IsInteger32()); |
| } |