Closed Bug 1282976 Opened 8 years ago Closed 2 years ago

Make new.target a real binding

Categories

(Core :: JavaScript Engine, defect, P3)

defect

Tracking

()

RESOLVED FIXED
101 Branch
Tracking Status
firefox101 --- fixed

People

(Reporter: shu, Assigned: anba)

References

Details

(Keywords: triage-deferred)

Attachments

(13 files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
After the bindings rewrite lands, we can make new.target a real binding and remove the need for arrows to be extended functions and make them syntax parseable.
Depends on: 1263355
Can or should we fix this now?
Keywords: triage-deferred
Priority: -- → P3

And reduce duplicated code when checking for the number of required arguments.

When creating the next patch of this series, I've noticed that we check for self-hosted
helper functions even when the call operation isn't JSOp::Call. This could lead to
silently doing the wrong thing when operation is for example JSOp::New. Interestingly
we already skipped this code path for spread calls. Anyway, to make this code more
robust, self-hosted helper functions are now only checked when op == JSOp::Call.

Assignee: nobody → andrebargull
Status: NEW → ASSIGNED

Needed for part 4.

This just moves the code to push new.target.

Depends on D142794

NewTargetNode is a ternary node to additionally hold the "new.target"
binding. Also see patch 5.

Depends on D142795

Only super() and new.target should be able to emit JSOp::NewTarget.

Depends on D142796

new.target is now a normal binding, similar to how the this binding works.

Depends on D142797

This just moves the code to declare the internal names.

Depends on D142798

The new.target slot for arrow functions is no longer read, so we can
simply initialise it to undefined.

The next patches will remove the slot and make further clean-ups.

Depends on D142800

The previous patch changed the "new.target" slot, so it always is set to null.
This patch changes all readers to directly return null resp. assert that the
code path isn't taken for arrow functions.

Depends on D142801

After the last patch, JSOp::Lambda and JSOp::LambdaArrow are both doing the
exact same thing, so we can just remove the latter.

Depends on D142802

Additionally assert that JSOp::NewTarget is only emitted for non-arrow function
scripts.

Depends on D142803

We no longer have to split emit_NewTarget, now that the only differences
between blinterp and baseline are just debug-only assertions.

Depends on D142804

EvalNewTarget is now also no longer needed.

Depends on D142805

Pushed by andre.bargull@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/a5258269f92a
Part 1: Ensure self-hosting helpers are only called as functions. r=jandem
https://hg.mozilla.org/integration/autoland/rev/9754fee0f38f
Part 2: Move single spread end-if and new.target handling out of CallOrNewEmitter::emitEnd(). r=jandem
https://hg.mozilla.org/integration/autoland/rev/da0564198265
Part 3: Add a separate parse node for "new.target". r=jandem
https://hg.mozilla.org/integration/autoland/rev/6c0d0d2c11e9
Part 4: Ensure emitNewTarget() can only be called from valid parse nodes. r=jandem
https://hg.mozilla.org/integration/autoland/rev/7edf3a4d9a70
Part 5: Declare new.target function binding. r=jandem
https://hg.mozilla.org/integration/autoland/rev/d676fb30e278
Part 6: Consistenly declare internal names before finishing the function lexical scope. r=jandem
https://hg.mozilla.org/integration/autoland/rev/639ebc18e9d1
Part 7: Stop storing new.target in arrow functions. r=jandem
https://hg.mozilla.org/integration/autoland/rev/a3066ae421e6
Part 8: Stop allocating arrow functions as extended functions. r=jandem
https://hg.mozilla.org/integration/autoland/rev/f9076fbfcec2
Part 9: Delete JSOp::LambdaArrow. r=jandem
https://hg.mozilla.org/integration/autoland/rev/b96299f00356
Part 10: Check JSOp::NewTarget is only used in non-arrow function scripts. r=jandem
https://hg.mozilla.org/integration/autoland/rev/3599669c384c
Part 11: Share emit_NewTarget() for baseline compilation. r=jandem
https://hg.mozilla.org/integration/autoland/rev/21175a7a8601
Part 12: Remove EvalNewTarget. r=jandem
https://hg.mozilla.org/integration/autoland/rev/0b35af3e37ea
Part 13: Remove new.target access from frame classes. r=jandem

Backed out 13 changesets (Bug 1282976) for causing build bustages on BytecodeEmitter.cpp.
Backout link
Push with failures
Failure Log

Flags: needinfo?(andrebargull)
Flags: needinfo?(andrebargull)
Pushed by andre.bargull@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/e5a646722d80
Part 1: Ensure self-hosting helpers are only called as functions. r=jandem
https://hg.mozilla.org/integration/autoland/rev/9e2976475f16
Part 2: Move single spread end-if and new.target handling out of CallOrNewEmitter::emitEnd(). r=jandem
https://hg.mozilla.org/integration/autoland/rev/468869caeead
Part 3: Add a separate parse node for "new.target". r=jandem
https://hg.mozilla.org/integration/autoland/rev/44d8fb5ba8d2
Part 4: Ensure emitNewTarget() can only be called from valid parse nodes. r=jandem
https://hg.mozilla.org/integration/autoland/rev/97011d13d382
Part 5: Declare new.target function binding. r=jandem
https://hg.mozilla.org/integration/autoland/rev/66b9be812531
Part 6: Consistenly declare internal names before finishing the function lexical scope. r=jandem
https://hg.mozilla.org/integration/autoland/rev/f040e1aaef57
Part 7: Stop storing new.target in arrow functions. r=jandem
https://hg.mozilla.org/integration/autoland/rev/96181ab3db66
Part 8: Stop allocating arrow functions as extended functions. r=jandem
https://hg.mozilla.org/integration/autoland/rev/b0b2e0a0563d
Part 9: Delete JSOp::LambdaArrow. r=jandem
https://hg.mozilla.org/integration/autoland/rev/f384f837450d
Part 10: Check JSOp::NewTarget is only used in non-arrow function scripts. r=jandem
https://hg.mozilla.org/integration/autoland/rev/256840e3ca1a
Part 11: Share emit_NewTarget() for baseline compilation. r=jandem
https://hg.mozilla.org/integration/autoland/rev/a0c51a971bb6
Part 12: Remove EvalNewTarget. r=jandem
https://hg.mozilla.org/integration/autoland/rev/14b23dd0871b
Part 13: Remove new.target access from frame classes. r=jandem
Regressions: 1763501
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: