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
This commit is contained in:
parent
9ff5f9daed
commit
f0b00d7f02
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user