|
| 1 | +// |jit-test| error: TypeError |
| 2 | +// Don't crash. |
| 3 | +gczeal(2); |
| 4 | +evaluate("\ |
| 5 | +function assertAlmostEq(v1, v2) {\ |
| 6 | + print(\"v2 = \" + v2);\ |
| 7 | + print(\"% diff = \" + percent);\ |
| 8 | +function assertStructuralEq(e1, e2) {}\ |
| 9 | +function assertEqParallelArrayArray(a, b) {\ |
| 10 | + try {} catch (e) {\ |
| 11 | + print(\"...in index \", i, \" of \", l);\ |
| 12 | + }\ |
| 13 | +}\ |
| 14 | + function assertEqArray(a, b) {\ |
| 15 | + try {} catch (e) {}\ |
| 16 | +}\ |
| 17 | +function assertEqParallelArray(a, b) {\ |
| 18 | + var shape = a.shape;\ |
| 19 | + function bump(indices) {\ |
| 20 | + var iv = shape.map(function () { return 0; });\ |
| 21 | + print(\"...in indices \", iv, \" of \", shape);\ |
| 22 | + }\ |
| 23 | + } while (bump(iv));\ |
| 24 | +}\ |
| 25 | +function assertParallelArrayModesEq(modes, acc, opFunction, cmpFunction) {\ |
| 26 | + modes.forEach(function (mode) {\ |
| 27 | + var result = opFunction({ mode: mode, expect: \"success\" });\ |
| 28 | + cmpFunction(acc, result);\ |
| 29 | + });\ |
| 30 | +function assertParallelArrayModesCommute(modes, opFunction) {\ |
| 31 | + var acc = opFunction({ mode: modes[0], expect: \"success\" });\ |
| 32 | +}\ |
| 33 | +function comparePerformance(opts) {\ |
| 34 | + print(\"Option \" + opts[i].name + \" took \" + diff + \"ms\");\ |
| 35 | + print(\"Option \" + opts[i].name + \" relative to option \" +\ |
| 36 | + opts[0].name + \": \" + (rel|0) + \"%\");\ |
| 37 | + }\ |
| 38 | +}\ |
| 39 | +function compareAgainstArray(jsarray, opname, func, cmpFunction) {\ |
| 40 | + var expected = jsarray[opname].apply(jsarray, [func]);\ |
| 41 | + var parray = new ParallelArray(jsarray);\ |
| 42 | + assertParallelArrayModesEq([\"seq\", \"par\", \"par\"], expected, function(m) {\ |
| 43 | + var result = parray[opname].apply(parray, [func, m]);\ |
| 44 | + }, cmpFunction);\ |
| 45 | +}\ |
| 46 | +function testFilter(jsarray, func, cmpFunction) {}\ |
| 47 | +", { noScriptRval : true }); |
| 48 | + compareAgainstArray([ |
| 49 | + "a", |
| 50 | + "b", |
| 51 | + ('captures: 1,1; RegExp.leftContext: ""; RegExp.rightContext: "123456"'), |
| 52 | + "d", "e", |
| 53 | + "f", "g", "h", |
| 54 | + "i", "j", "k", "l", |
| 55 | + "m", "n", "o", "p", |
| 56 | + "q", "r", "s", "t", |
| 57 | + (.6 ), "v", "w", "x", "y", "z" |
| 58 | + ], "map", function(e) { |
| 59 | + return e != "u" |
| 60 | + && |
| 61 | + (function b ( ) { |
| 62 | + } ) |
| 63 | + != "x"; |
| 64 | + }); |
0 commit comments