summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/basic/testArrayDensityChange.js
blob: b9dfabad1e7fe19ca4cb698f36278e0b44f1cf31 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
function testArrayDensityChange() {
  var x = [];
  var count = 0;
  for (var i=0; i < 100; ++i) {
    x[i] = "asdf";
  }
  for (var i=0; i < x.length; ++i) {
      if (i == 51)
      {
        x[199] = "asdf";
      }
      if (x[i])
        count += x[i].length;
  }
  return count;
}
assertEq(testArrayDensityChange(), 404);