From 36d22d82aa202bb199967e9512281e9a53db42c9 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sun, 7 Apr 2024 21:33:14 +0200 Subject: Adding upstream version 115.7.0esr. Signed-off-by: Daniel Baumann --- js/src/jit-test/tests/basic/shape-snapshots.js | 37 ++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 js/src/jit-test/tests/basic/shape-snapshots.js (limited to 'js/src/jit-test/tests/basic/shape-snapshots.js') diff --git a/js/src/jit-test/tests/basic/shape-snapshots.js b/js/src/jit-test/tests/basic/shape-snapshots.js new file mode 100644 index 0000000000..866298caeb --- /dev/null +++ b/js/src/jit-test/tests/basic/shape-snapshots.js @@ -0,0 +1,37 @@ +function test1() { + var o = {x: 1, y: 2}; + var snapshot = createShapeSnapshot(o); + checkShapeSnapshot(snapshot); + Object.defineProperty(o, "z", {get: function() {}}); + checkShapeSnapshot(snapshot); + + snapshot = createShapeSnapshot(o); + checkShapeSnapshot(snapshot); + o[12345678] = 1; + checkShapeSnapshot(snapshot); + + snapshot = createShapeSnapshot(o); + Object.defineProperty(o, "a", {configurable: true, set: function(){}}); + checkShapeSnapshot(snapshot); + + snapshot = createShapeSnapshot(o); + checkShapeSnapshot(snapshot); + delete o.a; + checkShapeSnapshot(snapshot); +} +test1(); + +function test2() { + var dictObject = {x: 1, y: 2, z: 3}; + delete dictObject.x; + var objects = [this, {}, {x: 1}, {x: 2}, dictObject, function() {}, [1, 2], + Object.prototype, new Proxy({}, {})]; + var snapshots = objects.map(o => createShapeSnapshot(o)); + gc(); + snapshots.forEach(function(snapshot) { + objects.forEach(function(obj) { + checkShapeSnapshot(snapshot, obj); + }); + }); +} +test2(); -- cgit v1.2.3