Commit f0b00d7f authored by kasperl@chromium.org's avatar kasperl@chromium.org

Do a fast check for undefined values when comparing.

Review URL: http://codereview.chromium.org/496008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@3462 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 9ff5f9da
......@@ -122,6 +122,12 @@ function COMPARE(x, ncr) {
return %StringCompare(this, x);
}
// If one of the operands is undefined, it will convert to NaN and
// thus the result should be as if one of the operands was NaN.
if (IS_UNDEFINED(this) || IS_UNDEFINED(x)) {
return ncr;
}
// Default implementation.
var a = %ToPrimitive(this, NUMBER_HINT);
var b = %ToPrimitive(x, NUMBER_HINT);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment