Index: src/ic.cc |
diff --git a/src/ic.cc b/src/ic.cc |
index 9bea13b9484d769cfaf3165a3d8ef38dd2cd325c..b66cf6bdf5d34ae68eabd65f2e96f373c1035d7e 100644 |
--- a/src/ic.cc |
+++ b/src/ic.cc |
@@ -2482,6 +2482,14 @@ CompareIC::State CompareIC::TargetState(State state, |
case UNINITIALIZED: |
if (x->IsSmi() && y->IsSmi()) return SMIS; |
if (x->IsNumber() && y->IsNumber()) return HEAP_NUMBERS; |
+ if (Token::IsOrderedCompareOp(op_)) { |
+ // Ordered comparisons treat undefined as NaN, so the |
+ // HEAP_NUMBER stub will do the right thing. |
+ if ((x->IsNumber() && y->IsUndefined()) || |
+ (y->IsNumber() && x->IsUndefined())) { |
+ return HEAP_NUMBERS; |
+ } |
+ } |
if (!Token::IsEqualityOp(op_)) return GENERIC; |
if (x->IsSymbol() && y->IsSymbol()) return SYMBOLS; |
if (x->IsString() && y->IsString()) return STRINGS; |