]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - tests/stress/float32-array-nan-inlined.js
JavaScriptCore-7600.1.4.9.tar.gz
[apple/javascriptcore.git] / tests / stress / float32-array-nan-inlined.js
diff --git a/tests/stress/float32-array-nan-inlined.js b/tests/stress/float32-array-nan-inlined.js
new file mode 100644 (file)
index 0000000..53ec2d1
--- /dev/null
@@ -0,0 +1,20 @@
+function foo(o) {
+    return o[0];
+}
+
+function test(a, x) {
+    var intArray = new Int32Array(1);
+    intArray[0] = a;
+    var floatArray = new Float32Array(intArray.buffer);
+    var element = foo(floatArray);
+    var result = element + 1;
+    if (("" + result) != ("" + x))
+        throw "Error: bad result for " + a + ": " + result + ", but expected: " + x + "; loaded " + element + " from the array";
+}
+
+noInline(test);
+
+for (var i = 0; i < 100000; ++i)
+    test(0, 1);
+
+test(0xFFFF0000, 0/0);