diff options
Diffstat (limited to 'js/src/jit-test/tests/watchtower/megamorphic-long-proto-chain.js')
-rw-r--r-- | js/src/jit-test/tests/watchtower/megamorphic-long-proto-chain.js | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/js/src/jit-test/tests/watchtower/megamorphic-long-proto-chain.js b/js/src/jit-test/tests/watchtower/megamorphic-long-proto-chain.js new file mode 100644 index 0000000000..675f29333f --- /dev/null +++ b/js/src/jit-test/tests/watchtower/megamorphic-long-proto-chain.js @@ -0,0 +1,28 @@ +setJitCompilerOption("ic.force-megamorphic", 1); + +function objectWithHops(hops) { + var o = Object.create(null); + o.hops = hops; + for (var i = 0; i < hops; i++) { + o = Object.create(o); + } + return o; +} +function test() { + var objs = []; + for (var i = 0; i < 32; i++) { + objs.push(objectWithHops(230 + i)); + } + for (var i = 0; i < 130; i++) { + var o = objs[i % objs.length]; + assertEq(o.hops, 230 + (i % objs.length)); + assertEq("hops" in o, true); + assertEq(Object.hasOwnProperty.call(o, "hops"), false); + assertEq(o.missing, undefined); + assertEq("missing" in o, false); + assertEq(Object.hasOwnProperty.call(o, "missing"), false); + } +} +for (var i = 0; i < 10; i++) { + test(); +} |