Closed Bug 1608809 Opened 4 years ago Closed 4 years ago

Make super() throw after evaluating args

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
mozilla74
Tracking Status
firefox74 --- fixed

People

(Reporter: yulia, Assigned: anba)

Details

Attachments

(3 files)

As discussed at tc39:

https://github.com/tc39/notes/blob/master/meetings/2019-12/december-3.md#normative-make-super-throw-after-evaluating-args

Further details: https://github.com/tc39/ecma262/issues/1351

Extending null has a different behavior depending on if you use class syntax or setPrototypeOf.

we currently throw BEFORE evaluating args on super, we will need to throw AFTER evaluating args on super.

Priority: -- → P4
Priority: P4 → P3
Assignee: nobody → andrebargull
Status: NEW → ASSIGNED

Modify JSOp::SuperFun to only retrieve the prototype without any further checks.

Drive-by change:
Take advantage that the object whose prototype gets retrieved is guaranteed to
be a JSFunction, so we neither have to worry about proxy objects nor lazy
prototypes.

The [[HomeObject]] slot is guaranteed to either contain a JSFunction or a
PlainObject, so we can use safely use JSObject::staticPrototype() to retrieve
the prototype and can also remove the lazy-proto handling in the compilers.

Depends on D60678

Pushed by apavel@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/c79dd9a939fd
Part 1: Don't throw for non-constructors in JSOp::SuperFun. r=jandem
https://hg.mozilla.org/integration/autoland/rev/dc2a6717541a
Part 2: Remove unnecessary rooting in JSOp::InitHomeObject interpreter implementation. r=jandem
https://hg.mozilla.org/integration/autoland/rev/b77cdd2e0b00
Part 3: Remove lazy-proto code paths from JSOp::SuperBase implementations. r=jandem
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: