Fix registers getting clobbered when storing to Float32Arrays (bug 750588, r=sstangl).
authorDavid Anderson <danderson@mozilla.com>
Tue, 01 May 2012 14:04:03 -0700
changeset 112439 374ab9121017e6a1141d7feaaa6057c60c317893
parent 112438 395864a65f2bdf96970145ac758041d741bdf94b
child 112440 04590b9cde4e7904b70f98182f4ef69c5710a59d
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssstangl
bugs750588
milestone15.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
Fix registers getting clobbered when storing to Float32Arrays (bug 750588, r=sstangl).
js/src/ion/IonMacroAssembler.h
js/src/jit-test/tests/ion/bug750588.js
--- a/js/src/ion/IonMacroAssembler.h
+++ b/js/src/ion/IonMacroAssembler.h
@@ -373,18 +373,18 @@ class MacroAssembler : public MacroAssem
             break;
         }
     }
 
     template<typename S, typename T>
     void storeToTypedFloatArray(int arrayType, const S &value, const T &dest) {
         switch (arrayType) {
           case TypedArray::TYPE_FLOAT32:
-            convertDoubleToFloat(value, value);
-            storeFloat(value, dest);
+            convertDoubleToFloat(value, ScratchFloatReg);
+            storeFloat(ScratchFloatReg, dest);
             break;
           case TypedArray::TYPE_FLOAT64:
             storeDouble(value, dest);
             break;
           default:
             JS_NOT_REACHED("Invalid typed array type");
             break;
         }
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug750588.js
@@ -0,0 +1,13 @@
+// vim: set ts=4 sw=4 tw=99 et:
+
+function S() {
+  var t = new Float32Array(1);
+  var k = 0;
+  var xx = 19;
+  var gridRes = 64;
+  for (var i = 0; i < 100; i++) {
+      t[k] = -1 + 2 * xx / gridRes;
+  }
+  return t[0];
+}
+assertEq(S(), -0.40625);