michael@0: load(libdir + "parallelarray-helpers.js"); michael@0: michael@0: function f(a) { michael@0: assertArraySeqParResultsEq( michael@0: range(0, minItemsTestingThreshold), michael@0: "map", michael@0: function(i) { return a[i]; }); michael@0: } michael@0: michael@0: function g(a, x) { michael@0: assertArraySeqParResultsEq( michael@0: range(0, minItemsTestingThreshold), michael@0: "map", michael@0: function(i) { return a[x]; }); michael@0: } michael@0: michael@0: function testICDenseElement() { michael@0: var a1 = []; michael@0: var a2 = []; michael@0: var a3 = []; michael@0: var a4 = []; michael@0: var len = minItemsTestingThreshold; michael@0: for (var i = 0; i < len; i++) { michael@0: a1[i] = Math.random() * 100 | 0; michael@0: a2[i] = Math.random() * 100 | 0; michael@0: a3[i] = Math.random() * 100 | 0; michael@0: a4[i] = Math.random() * 100 | 0; michael@0: } michael@0: f(a1); f({}); f(a2); f(a3); f(a4); f(a3); f(a1); michael@0: } michael@0: michael@0: function testICTypedArrayElement() { michael@0: var specs = [Int8Array, michael@0: Uint8Array, michael@0: Int16Array, michael@0: Uint16Array, michael@0: Int32Array, michael@0: Uint32Array, michael@0: Float32Array, michael@0: Float64Array, michael@0: Uint8ClampedArray]; michael@0: var len = minItemsTestingThreshold; michael@0: f({}); michael@0: for (var i = 0; i < specs.length; i++) { michael@0: var ta = new specs[i](len); michael@0: for (var j = 0; j < len; j++) michael@0: ta[j] = Math.random() * 100; michael@0: f(ta); michael@0: } michael@0: } michael@0: michael@0: function testICSlotElement() { michael@0: var o1 = { foo: 0 }; michael@0: var o2 = { foo: 0, bar: '' }; michael@0: var o3 = { foo: 0, bar: '', baz: function () { } }; michael@0: var o4 = { foo: { } }; michael@0: g(o1, "foo"); g(o2, "foo"); g(o3, "foo"); g(o2, "foo"); g(o1, "foo"); g(o4, "foo"); michael@0: } michael@0: michael@0: if (getBuildConfiguration().parallelJS) { michael@0: testICDenseElement(); michael@0: testICTypedArrayElement(); michael@0: testICSlotElement(); michael@0: }