hasOwn-megamorphic.js (728B)
1 setJitCompilerOption("offthread-compilation.enable", 0); 2 setJitCompilerOption("baseline.warmup.trigger", 5); 3 setJitCompilerOption("ion.warmup.trigger", 5); 4 5 function Base() { 6 } 7 8 Base.prototype.foo = false; 9 10 // XXX: tried to do this with ic.force-megamorphic, but it didn't seem to want 11 // to work. Maybe something is being too clever for my simple test case if I 12 // don't put things into a megamorphic array? 13 let objs = [ 14 {a: true}, 15 {b: true}, 16 {c: true}, 17 {d: true}, 18 {e: true}, 19 {f: true}, 20 {g: true}, 21 new Base(), 22 ]; 23 24 function doTest(i) { 25 let o = objs[i % objs.length]; 26 assertEq(!o.foo, true); 27 assertEq(Object.hasOwn(o, "foo"), false); 28 } 29 30 for (var i = 0; i < 50; i++) { 31 doTest(i); 32 }