testStringFromCodePoint.js (759B)
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 calls to fromCodePoint in 7 // case the input argument is not a valid code point. 8 if (i === 0) { 9 r(); 10 } 11 String.fromCodePoint(v); 12 String.fromCodePoint(v); 13 String.fromCodePoint(v); 14 } 15 } 16 17 var result = []; 18 function r() { 19 result.push("ok"); 20 } 21 22 do { 23 result.length = 0; 24 try { 25 f(0, r); 26 f(0, r); 27 f(0x10ffff + 1, r); 28 } catch (e) {} 29 assertEq(result.length, 3); 30 } while (!inIon()); 31 } 32 testBailout();