diff --git a/js/src/jit-test/tests/basic/expression-autopsy.js b/js/src/jit-test/tests/basic/expression-autopsy.js index 51d925852209..86d03394f45f 100644 --- a/js/src/jit-test/tests/basic/expression-autopsy.js +++ b/js/src/jit-test/tests/basic/expression-autopsy.js @@ -77,7 +77,7 @@ check("o[268435455]"); check("o['1.1']"); check("o[4 + 'h']", "o['4h']"); check("ieval(undef)", "ieval(...)"); -check("ieval.call()", "ieval.call(...)"); +check("ieval.call()", "ieval.call()"); check("ieval(...[])", "ieval(...)"); check("ieval(...[undef])", "ieval(...)"); check("ieval(...[undef, undef])", "ieval(...)"); @@ -105,7 +105,7 @@ check("o[(- (o + 1))]"); check_one("6", (function () { 6() }), " is not a function"); check_one("4", (function() { (4||eval)(); }), " is not a function"); check_one("0", (function () { Array.prototype.reverse.call('123'); }), " is read-only"); -check_one("[...][Symbol.iterator](...).next(...).value", +check_one("[...][Symbol.iterator]().next().value", function () { ieval("{ let x; var [a, b, [c0, c1]] = [x, x, x]; }") }, " is undefined"); check_one("(void 1)", function() { (void 1)(); }, " is not a function"); check_one("(void o[1])", function() { var o = []; (void o[1])() }, " is not a function"); @@ -129,11 +129,11 @@ check_one("(delete obj[y])", function() { "use strict"; var obj = {}, y = {}; (delete obj[y])(); }, " is not a function"); -check_one("foo.apply(...)", +check_one("foo.apply()", function() { function foo() {} foo.apply()(); }, " is not a function"); -check_one("super(...)", +check_one("super()", function() { class X extends Object { constructor() { @@ -179,7 +179,7 @@ check_one("super[a]", }, " is not a function"); -check_one("super.a(...)", +check_one("super.a()", function() { class Y { a() { @@ -198,7 +198,7 @@ check_one("super.a(...)", }, " is not a function"); -check_one("super[a](...)", +check_one("super[a]()", function() { class Y { a() { @@ -242,13 +242,13 @@ check_one("eval(...)", function() { "use strict"; eval(...[""])(); }, " is not a function"); -check_one("(new foo(...))", +check_one("(new foo())", function() { function foo() {}; new foo()(); }, " is not a function"); check_one("(new foo(...))", function() { function foo() {}; new foo(...[])(); }, " is not a function"); -check_one("(new foo.x(...))", +check_one("(new foo.x())", function() { var foo = { x: function() {} }; new foo.x()(); }, " is not a function"); check_one("(new foo.x(...))", @@ -262,9 +262,9 @@ check_one("[...].foo", function() { [undefined, ...[]].foo(); }, " is not a function"); -check_one("[...][Symbol.iterator](...).next(...).value", +check_one("[...][Symbol.iterator]().next().value", function () { var [{x}] = [null, {}]; }, " is null"); -check_one("[...][Symbol.iterator](...).next(...).value", +check_one("[...][Symbol.iterator]().next().value", function () { var [{x}] = [void 0, {}]; }, " is undefined"); try { diff --git a/js/src/jit-test/tests/debug/Debugger-setInstrumentation-04.js b/js/src/jit-test/tests/debug/Debugger-setInstrumentation-04.js index 2bd3e6c691e8..0e86eb90969c 100644 --- a/js/src/jit-test/tests/debug/Debugger-setInstrumentation-04.js +++ b/js/src/jit-test/tests/debug/Debugger-setInstrumentation-04.js @@ -29,6 +29,6 @@ try { g.foo({ f: () => { return { g: 0 } } }); } catch (e) { gotException = true; - assertEq(e.toString().includes("v.f(...).g is not a function"), true); + assertEq(e.toString().includes("v.f().g is not a function"), true); } assertEq(gotException, true); diff --git a/js/src/tests/non262/regress/regress-469625-03.js b/js/src/tests/non262/regress/regress-469625-03.js index 66aad82b7ef4..28dc11c5d411 100644 --- a/js/src/tests/non262/regress/regress-469625-03.js +++ b/js/src/tests/non262/regress/regress-469625-03.js @@ -24,7 +24,7 @@ function test() var [a, b, [c0, c1]] = [x, x, x]; } - expect = /TypeError: .*\[\.\.\.\]\[Symbol.iterator\]\(\.\.\.\)\.next\(\.\.\.\)\.value is null/; + expect = /TypeError: .*\[\.\.\.\]\[Symbol.iterator\]\(\)\.next\(\)\.value is null/; actual = 'No Error'; try { diff --git a/js/src/vm/BytecodeUtil.cpp b/js/src/vm/BytecodeUtil.cpp index ae5fe22f3eaa..541f5843196b 100644 --- a/js/src/vm/BytecodeUtil.cpp +++ b/js/src/vm/BytecodeUtil.cpp @@ -1890,9 +1890,11 @@ bool ExpressionDecompiler::decompilePC(jsbytecode* pc, uint8_t defIndex) { case JSOp::CallIgnoresRv: case JSOp::CallIter: case JSOp::FunCall: - case JSOp::FunApply: - return decompilePCForStackOperand(pc, -int32_t(GET_ARGC(pc) + 2)) && - write("(...)"); + case JSOp::FunApply: { + uint16_t argc = GET_ARGC(pc); + return decompilePCForStackOperand(pc, -int32_t(argc + 2)) && + write(argc ? "(...)" : "()"); + } case JSOp::SpreadCall: return decompilePCForStackOperand(pc, -3) && write("(...)"); case JSOp::NewArray: @@ -1940,6 +1942,10 @@ bool ExpressionDecompiler::decompilePC(jsbytecode* pc, uint8_t defIndex) { write(")"); case JSOp::SuperCall: + if (GET_ARGC(pc) == 0) { + return write("super()"); + } + [[fallthrough]]; case JSOp::SpreadSuperCall: return write("super(...)"); case JSOp::SuperFun: @@ -1951,10 +1957,12 @@ bool ExpressionDecompiler::decompilePC(jsbytecode* pc, uint8_t defIndex) { case JSOp::StrictSpreadEval: return write("eval(...)"); - case JSOp::New: + case JSOp::New: { + uint16_t argc = GET_ARGC(pc); return write("(new ") && - decompilePCForStackOperand(pc, -int32_t(GET_ARGC(pc) + 3)) && - write("(...))"); + decompilePCForStackOperand(pc, -int32_t(argc + 3)) && + write(argc ? "(...))" : "())"); + } case JSOp::SpreadNew: return write("(new ") && decompilePCForStackOperand(pc, -4) &&