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/TypedObject/jit-read-many.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/TypedObject/jit-read-many.js')
-rw-r--r-- | js/src/jit-test/tests/TypedObject/jit-read-many.js | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/TypedObject/jit-read-many.js b/js/src/jit-test/tests/TypedObject/jit-read-many.js new file mode 100644 index 000000000..dc15916f3 --- /dev/null +++ b/js/src/jit-test/tests/TypedObject/jit-read-many.js @@ -0,0 +1,62 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +if (!this.hasOwnProperty("TypedObject")) + quit(); + +// Test a single function (`bar`) being used with arrays that are all +// of known length, but not the same length. + +setJitCompilerOption("ion.warmup.trigger", 30); + +var N0 = 50; +var N1 = 100; +var N2 = 150; +var T = TypedObject; +var Array0 = T.uint32.array(N0); +var Array1 = T.uint32.array(N1); +var Array2 = T.uint32.array(N2); + +function bar(array, i, v) { + assertEq(array[i], v); +} + +function foo() { + var array0 = new Array0(); + var array1 = new Array1(); + var array2 = new Array2(); + + for (var i = 0; i < N0; i++) + array0[i] = i + 0; + + for (var i = 0; i < N1; i++) + array1[i] = i + 1; + + for (var i = 0; i < N2; i++) + array2[i] = i + 2; + + // get it primed up.. + for (var i = 0; i < N0; i++) { + bar(array0, i, i); + bar(array1, i, i + 1); + bar(array2, i, i + 2); + } + + // ...do some OOB accesses... + for (var i = N0; i < N1; i++) { + bar(array0, i, undefined); + bar(array1, i, i + 1); + bar(array2, i, i + 2); + } + + // ...and some more. + for (var i = N1; i < N2; i++) { + bar(array0, i, undefined); + bar(array1, i, undefined); + bar(array2, i, i + 2); + } +} + +foo(); |