Bug 1033962 - Fix Math.hypot crash on MIPS. r=jorendorff
authorHeiher <r@hev.cc>
Thu, 03 Jul 2014 01:29:00 -0400
changeset 251964 38d39b4c3023a79e6bc47982a4e7ff38304bc9b7
parent 251963 48409acb6e9847f9f007e95d112b08bbe1914d8a
child 251965 0028312fac1d39e82f93ab63f0e3848a629766fe
push id4610
push userjlund@mozilla.com
push dateMon, 30 Mar 2015 18:32:55 +0000
treeherdermozilla-beta@4df54044d9ef [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjorendorff
bugs1033962
milestone38.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1033962 - Fix Math.hypot crash on MIPS. r=jorendorff
js/src/jsmath.cpp
--- a/js/src/jsmath.cpp
+++ b/js/src/jsmath.cpp
@@ -1410,16 +1410,18 @@ js::math_hypot_handle(JSContext *cx, Han
 
     for (unsigned i = 0; i < args.length(); i++) {
         double x;
         if (!ToNumber(cx, args[i], &x))
             return false;
 
         isInfinite |= mozilla::IsInfinite(x);
         isNaN |= mozilla::IsNaN(x);
+        if (isInfinite || isNaN)
+            continue;
 
         double xabs = mozilla::Abs(x);
 
         if (scale < xabs) {
             sumsq = 1 + sumsq * (scale / xabs) * (scale / xabs);
             scale = xabs;
         } else if (scale != 0) {
             sumsq += (xabs / scale) * (xabs / scale);