bigint-mod-bailout.js (538B)
1 // |jit-test| --ion-warmup-threshold=20 2 3 function testBailout() { 4 function f(v, r) { 5 for (var i = 0; i < 50; ++i) { 6 // Ensure DCE and LICM don't eliminate modulus when the divisor is zero. 7 if (i === 0) { 8 r(); 9 } 10 1n % v; 11 1n % v; 12 1n % v; 13 } 14 } 15 16 var result = []; 17 function r() { 18 result.push("ok"); 19 } 20 21 do { 22 result.length = 0; 23 try { 24 f(1n, r); 25 f(1n, r); 26 f(0n, r); 27 } catch (e) {} 28 assertEq(result.length, 3); 29 } while (!inIon()); 30 } 31 testBailout();