summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/warp/store-element-hole-sparse-element.js
blob: 2012404f518f2fece700cb06139e1b16230fcd06 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
function test() {
  Object.defineProperty(Array.prototype, 10_000 * 50, {
    set() {
      throw new Error("shouldn't get here");
    }
  });

  // A bunch of indices which grow the array.
  var indices = [];
  for (var i = 0; i < 10_000; ++i) indices.push(i);

  // And finally an index for a sparse property.
  indices.push(10_000 * 50);

  // Plain data properties use DefineDataProperty.
  var desc = {value: 0, writable: true, enumerable: true, configurable: true};

  var a = [];
  for (var i = 0; i < indices.length; ++i) {
    Object.defineProperty(a, indices[i], desc);
  }
}

test();