Debian Codegraph @

js/src/jit-test/tests/ion/iterator-indices-8.js

raw
1 // Tests megamorphic stores to fixed and dynamics slots, and dense elements
2 function test(obj) {
3 let index = 0;
4 for (var s in obj) {
5 obj[s] = index;
6 index++;
7 }
8 index = 0;
9 for (var s in obj) {
10 assertEq(obj[s], index);
11 index++;
12 }
13 }
14
15 var arr = [];
16 var elem_obj = [];
17 for (var i = 0; i < 20; i++) {
18 var obj = {};
19 for (var j = 0; j < i; j++) {
20 obj["x_" + i + "_" + j] = 1;
21 }
22 arr.push(obj);
23 elem_obj.push(1);
24 }
25 arr.push(elem_obj);
26
27 with ({}) {}
28 for (var i = 0; i < 2000; i++) {
29 var idx = i % arr.length;
30 test(arr[idx]);
31 }
32