diff options
author | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
---|---|---|
committer | Matt A. Tobin <mattatobin@localhost.localdomain> | 2018-02-02 04:16:08 -0500 |
commit | 5f8de423f190bbb79a62f804151bc24824fa32d8 (patch) | |
tree | 10027f336435511475e392454359edea8e25895d /js/src/jit-test/tests/basic/bug1078871.js | |
parent | 49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff) | |
download | UXP-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/basic/bug1078871.js')
-rw-r--r-- | js/src/jit-test/tests/basic/bug1078871.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/basic/bug1078871.js b/js/src/jit-test/tests/basic/bug1078871.js new file mode 100644 index 000000000..b055fa365 --- /dev/null +++ b/js/src/jit-test/tests/basic/bug1078871.js @@ -0,0 +1,44 @@ + +// Robert Jenkins' 32 bit integer hash function +var seed = 100; +Math.random = function() { + seed = (seed + 0x7ed55d16) + (seed<<12); + seed = (seed ^ 0xc761c23c) ^ (seed>>19); + seed = (seed + 0x165667b1) + (seed<<5); + seed = (seed + 0xd3a2646c) ^ (seed<<9); + seed = (seed + 0xfd7046c5) + (seed<<3); + seed = (seed ^ 0xb55a4f09) ^ (seed>>16); + seed = Math.abs(seed | 0); + return seed / 0xffffffff * 2; +} + +function tangle(n, m) { + function rand(n) { + return Math.floor(Math.random() * n); + } + + var arr = []; + for (var i = 0; i < n; i++) + arr[i] = String.fromCharCode(65 + rand(26)); + for (var i = 0; i < m; i++) { + var j = rand(n); + switch (rand(2)) { + case 0: { + var s = arr[rand(n)]; + var b = rand(s.length); + var e = b + rand(s.length - b); + if (e - b > 1) + arr[j] = s.substring(b, e); + } + break; + case 1: { + arr[j] = arr[rand(n)] + arr[rand(n)]; + } + } + uneval(arr[j]); + } + + return arr; +} + +tangle(10, 500); |