summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/bug984018.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/ion/bug984018.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/tests/ion/bug984018.js')
-rw-r--r--js/src/jit-test/tests/ion/bug984018.js62
1 files changed, 62 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/ion/bug984018.js b/js/src/jit-test/tests/ion/bug984018.js
new file mode 100644
index 000000000..ef144a85d
--- /dev/null
+++ b/js/src/jit-test/tests/ion/bug984018.js
@@ -0,0 +1,62 @@
+var x = 0;
+function test() {
+ function sincos1(a, b) {
+ var sa = Math.sin(a);
+ var sb = Math.sin(b);
+ var ca = Math.cos(a);
+ var cb = Math.cos(b);
+ var ra = sa * sa + ca * ca;
+ var rb = sb * sb + cb * cb;
+ var dec = 100000;
+
+ assertEq(Math.round(ra * dec) / dec, Math.round(rb * dec) / dec);
+
+ ca = Math.cos(a);
+ cb = Math.cos(b);
+ sa = Math.sin(a);
+ sb = Math.sin(b);
+
+ var ra = sa * sa + ca * ca;
+ var rb = sb * sb + cb * cb;
+
+ assertEq(Math.round(ra * dec) / dec, Math.round(rb * dec) / dec);
+ return ra;
+ }
+
+ function sincos2(x) {
+ var s1 = Math.sin(x);
+ var c1 = Math.cos(x);
+
+ var c2 = Math.cos(x);
+ var s2 = Math.sin(x);
+
+ return (s1 * s1 + c1 * c1) - (s2 * s2 + c2 * c2);
+ }
+
+ function bailoutHere() { bailout(); }
+
+ function sincos3(x) {
+ var s = Math.sin(x);
+ bailoutHere();
+ var c = Math.cos(x);
+ assertEq(Math.round(s * s + c * c), 1);
+ return s;
+ }
+
+ function sincos4(x) {
+ if (x < 2500)
+ x = Math.sin(x);
+ else
+ x = Math.cos(x);
+ return x;
+ }
+
+ for (var i=0; i<5000; i++) {
+ x += sincos1(x, x + 1);
+ x += sincos2(x);
+ x += sincos3(x);
+ x += sincos4(i);
+ }
+}
+x += 1;
+test();