Closed Bug 1753709 Opened 3 years ago Closed 2 years ago

Add an about:config preference to toggle the various eager delazification strategies.

Categories

(Core :: JavaScript Engine, task, P1)

task

Tracking

()

RESOLVED FIXED
99 Branch
Tracking Status
firefox99 --- fixed

People

(Reporter: nbp, Assigned: nbp)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Eager delazification generates the bytecode of function off-thread while either waiting for other resources or executing the JavaScript code which is already delazified.

We have different strategies to order or skip functions for which we would be generating bytecode. We need to evaluate which order and filtering methods are the best for the web by being able to toggle between different strategies.

To toggle between different strategies, we need a flag which can easily be changed for A/B testing.

This patch changes the way we parse JavaScript coming from Necko while loading
web pages, by adding an about:config flag named
javascript.options.delazification.strategy which is used to select between:

0 - On Demand
1 - Concurrent Depth First
255 - Parse Everything Eagerly

Previously, we moved from On-demand delazification, to parsing everything
eagerly to improve responsiveness of the browser, but we knew that more room for
optimization exists.

This toogle is meant to explore the space of delazification strategies, such
that we can parse functions of JavaScript files on an helper thread, while the
JavaScript file is being executed on the main thread. The space of
delazification strategies goes from ordering the order in which functions are
processed, as well as filtering functions which are processed. Not all functions
have to be delazified, and if the main thread needs a function which is not
parsed yet, it will fallback to parsing it on-demand.

Pushed by npierron@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/13dbf5b806ec
Remove unused DelazificationOption. r=arai
https://hg.mozilla.org/integration/autoland/rev/9d41db9f2e17
JavaScript: Add a preference to switch between delazification strategies. r=arai
https://hg.mozilla.org/integration/autoland/rev/8d2f548f2b46
Add test case to verify delazification strategy is used. r=arai

Backed out 3 changesets (Bug 1753709) for causing build bustages on ScriptLoader.cpp.
Backout link
Push with failures
Failure Log

Flags: needinfo?(nicolas.b.pierron)
Pushed by npierron@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/891174ee20ee
Remove unused DelazificationOption. r=arai
https://hg.mozilla.org/integration/autoland/rev/193409767cf2
JavaScript: Add a preference to switch between delazification strategies. r=arai
https://hg.mozilla.org/integration/autoland/rev/eb7704e8a30c
Add test case to verify delazification strategy is used. r=arai
Flags: needinfo?(nicolas.b.pierron)

Backed out 3 changesets (Bug 1753709) for causing build bustages on ScriptLoader.cpp.
Backout link
Push with failures
Failure Log

Flags: needinfo?(nicolas.b.pierron)
Flags: needinfo?(nicolas.b.pierron)
Pushed by npierron@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/224f4cf66993
Remove unused DelazificationOption. r=arai
https://hg.mozilla.org/integration/autoland/rev/56a169a692b9
JavaScript: Add a preference to switch between delazification strategies. r=arai
https://hg.mozilla.org/integration/autoland/rev/b908fc38d2d3
Add test case to verify delazification strategy is used. r=arai

Backed out for causing mochitest failures on test_delazification_strategy.html

Flags: needinfo?(nicolas.b.pierron)
Pushed by npierron@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/1ba642f524eb
Remove unused DelazificationOption. r=arai
https://hg.mozilla.org/integration/autoland/rev/c4b3ea8cc850
JavaScript: Add a preference to switch between delazification strategies. r=arai
https://hg.mozilla.org/integration/autoland/rev/92c286a2adf9
Add test case to verify delazification strategy is used. r=arai

(In reply to Cristian Tuns from comment #9)

Backed out for causing mochitest failures on test_delazification_strategy.html

The problem was caused by a failure to capture the event sent to the script tag while loading the script.
Strangely, I do not know why this would fail on this test case and not on test_script_loader_js_cache.html, from which this test case was derived.

Mean while the solution taken, thanks to Arai, was to load the page without any script tag and dynamically add a script tag once the iframe is loaded, and event listeners are attached to the iframe window.

Flags: needinfo?(nicolas.b.pierron)
Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 99 Branch
Regressions: 1757699
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: