js/src/jit-test/tests/parallel/binary-arith-numbers.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

michael@0 1 load(libdir + "parallelarray-helpers.js");
michael@0 2
michael@0 3 // Test that we are able to add numbers even if the typesets are not
michael@0 4 // "clean" because we have previously added strings and numbers. This
michael@0 5 // should cause fallible unboxing to occur.
michael@0 6
michael@0 7 function theTest() {
michael@0 8 var mixedArray = [1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9.9, 10.1,
michael@0 9 "1", "2", "3", "4", "5", "6", "7", "8", "9", "10"];
michael@0 10
michael@0 11 function op(e, i) {
michael@0 12 return mixedArray[e % mixedArray.length] + i;
michael@0 13 }
michael@0 14
michael@0 15 // run op once where it has to add doubles and strings,
michael@0 16 // just to pullute the typesets:
michael@0 17 var jsarray0 = range(0, 1024);
michael@0 18 jsarray0.map(op);
michael@0 19
michael@0 20 // this version will never actually touch the strings:
michael@0 21 assertArraySeqParResultsEq(range(0, 1024), "map", function (i) { return i % 10; });
michael@0 22
michael@0 23 // but if we try against the original we get bailouts:
michael@0 24 assertParallelExecWillBail(function (mode) {
michael@0 25 jsarray0.mapPar(op, mode);
michael@0 26 });
michael@0 27 }
michael@0 28
michael@0 29 if (getBuildConfiguration().parallelJS)
michael@0 30 theTest();

mercurial