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

Unified Diff: src/runtime.js

Issue 344010: Add fast check for NaN in NumberCompare slow case. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 11 years, 2 months 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: src/runtime.js
===================================================================
--- src/runtime.js (revision 3152)
+++ src/runtime.js (working copy)
@@ -128,7 +128,10 @@
if (IS_STRING(a) && IS_STRING(b)) {
return %StringCompare(a, b);
} else {
- return %NumberCompare(%ToNumber(a), %ToNumber(b), ncr);
+ var a_number = %ToNumber(a);
+ var b_number = %ToNumber(b);
+ if (NUMBER_IS_NAN(a_number) || NUMBER_IS_NAN(b_number)) return ncr;
+ return %NumberCompare(a_number, b_number, ncr);
}
}
« 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