dependent-string-chain.js (555B)
1 // |jit-test| --fast-warmup; --no-threads; skip-if: !('stringRepresentation' in this) 2 3 // substring shouldn't create chains of dependent strings. 4 5 function test() { 6 for (var i = 0; i < 100; i++) { 7 var s = "abcdefabcdefabcdefabcdefabcdefabcdef"; 8 for (var j = 0; j < 4; j++) { 9 s = s.substring(1); 10 } 11 var rep = JSON.parse(stringRepresentation(s)); 12 assertEq(rep.flags.includes("DEPENDENT_BIT"), true); 13 assertEq(rep.base.flags.includes("DEPENDENT_BIT"), false); 14 assertEq(s, "efabcdefabcdefabcdefabcdefabcdef"); 15 } 16 } 17 test();