megamorphic-null-and-undefined.js (274B)
1 let objs = []; 2 3 for (let i = 0; i < 100; i++) { 4 let obj = {}; 5 obj["x" + i] = 1; 6 obj[undefined] = 2; 7 obj[null] = 3; 8 objs.push(obj); 9 } 10 11 function foo(obj) { 12 assertEq(obj[undefined], 2); 13 assertEq(obj[null], 3); 14 } 15 16 for (let i = 0; i < 100; i++) { 17 foo(objs[i]); 18 }