Closed Bug 1620853 Opened 5 years ago Closed 5 years ago

Use flags instead of JSScript::lazyScript to compute relazification conditions

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
mozilla76
Tracking Status
firefox76 --- fixed

People

(Reporter: tcampbell, Assigned: tcampbell)

References

Details

Attachments

(2 files)

The JSScript::lazyScript field will be removed soon, but it often served an indirect purpose of preventing relazification in complex edge cases.

This patch changes the NoNotRelazify flag into AllowRelazify and moves to more of a whitelist model.

When using the relazifyFunctions testing method, we mark live scripts on
stack as DoNotRelazify. Previously we would clear this flag after the
operation was done, but this may conflict with other uses of the flag, such
as the debugger. Only rare test-only code is affected.

Replace the DoNotRelazify flag with AllowRelazify. This flag is set during
delazification (self-hosted-cloning or normal) of a script if
isRelazifiable(). This avoids relying on if JSScript::lazyScript is non-null,
which is important because that field will be removed soon. We also inline
JSScript::canRelazify() into its caller.

Note that previous uses of the DoNotRelazify flag simply clear the new flag
and things work as expected, even if an associated LazyScript exists.

The XDR code is updated to rely on this AllowRelazify flag to decide if the
LazyScript should be transcoded. This gives more predictable behaviour
between the debugger and XDR.

Depends on D65904

Pushed by tcampbell@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/94cb6a1d0fe1 RelazifyFunctions testing function should preserve DoNotRelazify. r=jandem https://hg.mozilla.org/integration/autoland/rev/5ad850ffdb3f Add BaseScript::allowRelazify to control relazification. r=jandem
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla76

There is a 1kB js-content-base regression due to named self-hosted functions that are only used internally. Previously they would be relazified but after this patch they are not. See [1] for where the call to setAllowRelazify() is potentially missing. This probably can be fixed as well as allowing inner-functions from self-hosted to be cloned (a new feature).

[1] https://searchfox.org/mozilla-central/rev/070a000dd49aac4a26147e137efcd91a728d13b8/js/src/vm/SelfHosting.cpp#2963

Regressions: 1621158
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: