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-u32-from-struct-array-in-struct.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-u32-from-struct-array-in-struct.js')
-rw-r--r-- | js/src/jit-test/tests/TypedObject/jit-read-u32-from-struct-array-in-struct.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/TypedObject/jit-read-u32-from-struct-array-in-struct.js b/js/src/jit-test/tests/TypedObject/jit-read-u32-from-struct-array-in-struct.js new file mode 100644 index 000000000..07d25e034 --- /dev/null +++ b/js/src/jit-test/tests/TypedObject/jit-read-u32-from-struct-array-in-struct.js @@ -0,0 +1,45 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommons.org/licenses/publicdomain/ + */ + +if (!this.hasOwnProperty("TypedObject")) + quit(); + +var PointType = new TypedObject.StructType({x: TypedObject.uint32, + y: TypedObject.uint32, + z: TypedObject.uint32}); + +var VecPointType = PointType.array(3); + +var PairVecType = new TypedObject.StructType({fst: VecPointType, + snd: VecPointType}); + +function foo() { + for (var i = 0; i < 5000; i += 9) { + var p = new PairVecType({fst: [{x: i, y: i+1, z:i+2}, + {x: i+3, y: i+4, z:i+5}, + {x: i+6, y: i+7, z:i+8}], + snd: [{x: i+9, y:i+10, z:i+11}, + {x: i+12, y:i+13, z:i+14}, + {x: i+15, y:i+16, z:i+17}] + }); + var sum; + + sum = p.fst[0].x + p.fst[0].y + p.fst[0].z; + assertEq(sum, 3*i + 3); + sum = p.fst[1].x + p.fst[1].y + p.fst[1].z; + assertEq(sum, 3*i + 12); + sum = p.fst[2].x + p.fst[2].y + p.fst[2].z; + assertEq(sum, 3*i + 21); + + sum = p.snd[0].x + p.snd[0].y + p.snd[0].z; + assertEq(sum, 3*i + 30); + sum = p.snd[1].x + p.snd[1].y + p.snd[1].z; + assertEq(sum, 3*i + 39); + sum = p.snd[2].x + p.snd[2].y + p.snd[2].z; + assertEq(sum, 3*i + 48); + } +} + +foo(); |