Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1242)

Unified Diff: bleeding_edge/src/runtime.js

Issue 496008: Do a fast check for undefined values when comparing. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: bleeding_edge/src/runtime.js
===================================================================
--- bleeding_edge/src/runtime.js (revision 3458)
+++ bleeding_edge/src/runtime.js (working copy)
@@ -122,6 +122,12 @@
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);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698