From 2aa4a82499d4becd2284cdb482213d541b8804dd Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 28 Apr 2024 16:29:10 +0200 Subject: Adding upstream version 86.0.1. Signed-off-by: Daniel Baumann --- .../jit-test/tests/jaeger/testSetElem-Indexed.js | 36 ++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 js/src/jit-test/tests/jaeger/testSetElem-Indexed.js (limited to 'js/src/jit-test/tests/jaeger/testSetElem-Indexed.js') diff --git a/js/src/jit-test/tests/jaeger/testSetElem-Indexed.js b/js/src/jit-test/tests/jaeger/testSetElem-Indexed.js new file mode 100644 index 0000000000..01b42bd6b3 --- /dev/null +++ b/js/src/jit-test/tests/jaeger/testSetElem-Indexed.js @@ -0,0 +1,36 @@ +// vim: set ts=8 sts=4 et sw=4 tw=99: + +function f() { + return [[], [], [], []]; +} + +function setelem(obj, key, val) { + obj[key] = val; +} + +// Generate IC +setelem([], 0, "hi"); +setelem([], 0, "hi"); + +// Get some arrays pre-indexing. +var arrays = f(); + +// Do bad stuff. +Object.defineProperty(Object.prototype, "1", { set: function (v) { this.kettle = v; } }); + +var k = arrays[0]; +setelem(k, 1, 13); +assertEq(k.kettle, 13); +assertEq(k.hasOwnProperty("1"), false); + +Object.defineProperty(Array.prototype, "2", { set: function (v) { this.pot = v; } }); +k = arrays[1]; +setelem(k, 2, "yam"); +assertEq(k.pot, "yam"); + +gc(); + +// make sure this reset okay. +setelem([], 0, "hi"); +setelem([], 0, "hi"); + -- cgit v1.2.3