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/xdr/delazifications-nest.js | 70 +++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 js/src/jit-test/tests/xdr/delazifications-nest.js (limited to 'js/src/jit-test/tests/xdr/delazifications-nest.js') diff --git a/js/src/jit-test/tests/xdr/delazifications-nest.js b/js/src/jit-test/tests/xdr/delazifications-nest.js new file mode 100644 index 0000000000..0a8fc23a58 --- /dev/null +++ b/js/src/jit-test/tests/xdr/delazifications-nest.js @@ -0,0 +1,70 @@ +load(libdir + 'bytecode-cache.js'); + +let test = ` +// Put some unused atoms in the initial stencil, to verify that atoms are +// correctly mapped while merging stencils. +if (false) { + "unused text1"; + "unused text2"; + "unused text3"; + "unused text4"; + "unused text5"; +} + +var result = 0; + +function func() { + var anonFunc = function() { + // Method/accessor as inner-inner function. + var obj = { + method(name) { + // Test object literal. + var object = { + propA: 9, + propB: 10, + propC: 11, + }; + + // Test object property access. + return object["prop" + name]; + }, + get prop1() { + return 200; + }, + set prop2(value) { + result += value; + } + }; + result += obj.prop1; + obj.prop2 = 3000; + result += obj.method("B"); + }; + + function anotherFunc() { + return 40000; + } + + function unused() { + } + + class MyClass { + constructor() { + result += 500000; + } + } + + // Functions inside arrow parameters, that are parsed multiple times. + const arrow = (a = (b = c => { result += 6000000 }) => b) => a()(); + + // Delazify in the different order as definition. + new MyClass(); + anonFunc(); + result += anotherFunc(); + arrow(); +} +func(); + +result; +`; + +evalWithCache(test, { incremental: true, oassertEqResult : true }); -- cgit v1.2.3