Shortcut strncmp in string to number conversion path (513434, r=sayrer).
authorAndreas Gal <gal@mozilla.com>
Sat, 29 Aug 2009 02:28:00 -0700
changeset 32609 5b8743e0f4a9f1d10d4488cd3e2ae02fbd91b24d
parent 32608 972e53ee1a5ff5f16621f0d8f7c0be1870fc3215
child 32610 d8a9a1803ea509b20b6e3bccf82b837954dc3dec
push idunknown
push userunknown
push dateunknown
reviewerssayrer
bugs513434
milestone1.9.3a1pre
Shortcut strncmp in string to number conversion path (513434, r=sayrer).
js/src/jsnum.cpp
--- a/js/src/jsnum.cpp
+++ b/js/src/jsnum.cpp
@@ -1169,17 +1169,17 @@ js_strtod(JSContext *cx, const jschar *s
             break;
         cstr[i] = (char)s1[i];
     }
     cstr[i] = 0;
 
     istr = cstr;
     if ((negative = (*istr == '-')) != 0 || *istr == '+')
         istr++;
-    if (!strncmp(istr, js_Infinity_str, sizeof js_Infinity_str - 1)) {
+    if (*istr == 'I' && !strncmp(istr, js_Infinity_str, sizeof js_Infinity_str - 1)) {
         d = *(negative ? cx->runtime->jsNegativeInfinity : cx->runtime->jsPositiveInfinity);
         estr = istr + 8;
     } else {
         int err;
         d = JS_strtod(cstr, &estr, &err);
         if (d == HUGE_VAL)
             d = *cx->runtime->jsPositiveInfinity;
         else if (d == -HUGE_VAL)