Debian Codegraph @

js/src/jit-test/tests/warp/store-element-hole-negative-index.js

raw
1 function test() {
2 Object.defineProperty(Array.prototype, -1, {
3 set() {
4 throw new Error("shouldn't get here");
5 }
6 });
7
8 // A bunch of indices which grow the array.
9 var indices = [];
10 for (var i = 0; i < 10_000; ++i) indices.push(i);
11
12 // And finally a negative index.
13 indices.push(-1);
14
15 // Plain data properties use DefineDataProperty.
16 var desc = {value: 0, writable: true, enumerable: true, configurable: true};
17
18 var a = [];
19 for (var i = 0; i < indices.length; ++i) {
20 Object.defineProperty(a, indices[i], desc);
21 }
22 }
23
24 test();