js/src/jit-test/tests/parallel/ic-getelement.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 load(libdir + "parallelarray-helpers.js");
michael@0 2
michael@0 3 function f(a) {
michael@0 4 assertArraySeqParResultsEq(
michael@0 5 range(0, minItemsTestingThreshold),
michael@0 6 "map",
michael@0 7 function(i) { return a[i]; });
michael@0 8 }
michael@0 9
michael@0 10 function g(a, x) {
michael@0 11 assertArraySeqParResultsEq(
michael@0 12 range(0, minItemsTestingThreshold),
michael@0 13 "map",
michael@0 14 function(i) { return a[x]; });
michael@0 15 }
michael@0 16
michael@0 17 function testICDenseElement() {
michael@0 18 var a1 = [];
michael@0 19 var a2 = [];
michael@0 20 var a3 = [];
michael@0 21 var a4 = [];
michael@0 22 var len = minItemsTestingThreshold;
michael@0 23 for (var i = 0; i < len; i++) {
michael@0 24 a1[i] = Math.random() * 100 | 0;
michael@0 25 a2[i] = Math.random() * 100 | 0;
michael@0 26 a3[i] = Math.random() * 100 | 0;
michael@0 27 a4[i] = Math.random() * 100 | 0;
michael@0 28 }
michael@0 29 f(a1); f({}); f(a2); f(a3); f(a4); f(a3); f(a1);
michael@0 30 }
michael@0 31
michael@0 32 function testICTypedArrayElement() {
michael@0 33 var specs = [Int8Array,
michael@0 34 Uint8Array,
michael@0 35 Int16Array,
michael@0 36 Uint16Array,
michael@0 37 Int32Array,
michael@0 38 Uint32Array,
michael@0 39 Float32Array,
michael@0 40 Float64Array,
michael@0 41 Uint8ClampedArray];
michael@0 42 var len = minItemsTestingThreshold;
michael@0 43 f({});
michael@0 44 for (var i = 0; i < specs.length; i++) {
michael@0 45 var ta = new specs[i](len);
michael@0 46 for (var j = 0; j < len; j++)
michael@0 47 ta[j] = Math.random() * 100;
michael@0 48 f(ta);
michael@0 49 }
michael@0 50 }
michael@0 51
michael@0 52 function testICSlotElement() {
michael@0 53 var o1 = { foo: 0 };
michael@0 54 var o2 = { foo: 0, bar: '' };
michael@0 55 var o3 = { foo: 0, bar: '', baz: function () { } };
michael@0 56 var o4 = { foo: { } };
michael@0 57 g(o1, "foo"); g(o2, "foo"); g(o3, "foo"); g(o2, "foo"); g(o1, "foo"); g(o4, "foo");
michael@0 58 }
michael@0 59
michael@0 60 if (getBuildConfiguration().parallelJS) {
michael@0 61 testICDenseElement();
michael@0 62 testICTypedArrayElement();
michael@0 63 testICSlotElement();
michael@0 64 }

mercurial