Closed Bug 1981133 Opened 1 year ago Closed 1 year ago

Support baking in constant property values for the global object

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

RESOLVED FIXED
143 Branch
Tracking Status
firefox143 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

(Keywords: perf-alert, Whiteboard: [js-perf-next])

Attachments

(11 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

For bug 1972572 I want start with just the global object and GetNameIRGenerator support. This will add most of the code to also use this for other objects later though.

Severity: -- → N/A
Priority: -- → P3

This will be used by a later patch to get the slot number of the removed property.

This more clearly distinguishes it from the new ObjectFuse-based mechanism.

This will be used later to invalidate Ion code depending on this particular
property's value.

Baking in constant property values for the global object was causing test failures
with eager JIT compilation, because of new GC edges from IC stubs for those constants.

Bug 1977367 added nursery-values support so it should be possible to handle the
nursery case in the future if needed. What makes this a bit tricky is that we don't
know the Value type in that case in the transpiler so we'd either have to store
the type separately in the snapshot or in the ValueOrNurseryValueIndex, or load the
constant as an opaque boxed Value.

Watchtower only cares about JS property values, not reserved slots, so it doesn't
need to handle those slot changes.

Later patches will add JIT optimizations based on this.

For now this is only used to bake in constant property values for the global object,
but this could also be used for prototype objects in the future.

In GCHashTable.h, this changes map.sizeOfExcludingThis to map.shallowSizeOfExcludingThis
because the former doesn't compile (but is currently unused).

Depends on: 1981471
Keywords: leave-open
Keywords: leave-open

Improvements on JS2:
~0.5% overall
12.3% on mandreel
10% on richards
12% on crypto-sha1-sp
4% on delt-blue
Improvements on e-b and other crypto tests too.

Kraken
Atleast 1.5%-2% overall
8% on audio-oscillator
11% on imaginf-gaussian-blur

Octane (which is similar for corresponding tests on JS2/JS3)
3.7% on crypto
9% on e-b
13.3% on Mandreel
5.2% on mandreel-latency
4.4% on Richards

Regressions: 1981896

(In reply to Mayank Bansal from comment #15)

Kraken
[...]
11% on imaging-gaussian-blur

Ah yeah this optimization does well there. In this function now height, width, kernelSize, squidImageData, kernel, Math are all constants.

So for example for this loop:

for (var j = 1 - kernelSize; j < kernelSize; ++j) {

we now bake in kernelSize (= 7) so we can generate machine code that just loops from -6 to 6:

[Integer]
movl       $0xfffffffa, %r13d # -6
...
[CompareAndBranch:Lt]
cmpl       $0x7, %r13d
jge        .Lfrom764

Similar for the * width expressions, we can now multiply by a constant for that:

imull      $400, %r14d, %r14d

The only global we can't optimize is kernelSum because of how that one gets initialized but that's expected.

some improvements on six-speed
~10% on map-string-es5
~5% on arrow-args-es5
5% arrow-args-es6
~5% on destructuring
~5% for spread-generator

Blocks: 1982330
Whiteboard: [js-perf-next]

12% improvement on sync-fs only on Linux (and maybe slightly on OSX)

(In reply to Pulsebot from comment #13)

Pushed by jdemooij@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/2eba132fb701
https://hg.mozilla.org/integration/autoland/rev/785825832f94
part 7 - Add ObjectFuse and use it for the global object. r=iain
https://github.com/mozilla-firefox/firefox/commit/ca838a5a8c4c
https://hg.mozilla.org/integration/autoland/rev/a7b0a9940b39
part 8 - Add memory reporting for object fuses. r=iain
https://github.com/mozilla-firefox/firefox/commit/a24b05c4992f
https://hg.mozilla.org/integration/autoland/rev/2499e94d2177
part 9 - Add IC optimization for constant global object properties. r=iain
https://github.com/mozilla-firefox/firefox/commit/41375298f4c3
https://hg.mozilla.org/integration/autoland/rev/cee92ecf074b
part 10 - Support GuardObjectFuseProperty in Warp. r=iain
https://github.com/mozilla-firefox/firefox/commit/ed06997b0c38
https://hg.mozilla.org/integration/autoland/rev/8f373494031e
part 11 - Support optimizing SetProp for objects with an ObjectFuse. r=iain

Perfherder has detected a talos performance change from push 8f373494031ed192dd97c5019b5ffa7076b0548a.

If you have any questions, please reach out to a performance sheriff. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
2% kraken windows11-64-24h2-shippable e10s fission stylo webrender 474.08 -> 464.27

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a performance sheriff to do that for you.

You can run all of these tests on try with ./mach try perf --alert 46199

The following documentation link provides more information about this command.

Keywords: perf-alert

(In reply to Pulsebot from comment #13)

Pushed by jdemooij@mozilla.com:
https://github.com/mozilla-firefox/firefox/commit/2eba132fb701
https://hg.mozilla.org/integration/autoland/rev/785825832f94
part 7 - Add ObjectFuse and use it for the global object. r=iain
https://github.com/mozilla-firefox/firefox/commit/ca838a5a8c4c
https://hg.mozilla.org/integration/autoland/rev/a7b0a9940b39
part 8 - Add memory reporting for object fuses. r=iain
https://github.com/mozilla-firefox/firefox/commit/a24b05c4992f
https://hg.mozilla.org/integration/autoland/rev/2499e94d2177
part 9 - Add IC optimization for constant global object properties. r=iain
https://github.com/mozilla-firefox/firefox/commit/41375298f4c3
https://hg.mozilla.org/integration/autoland/rev/cee92ecf074b
part 10 - Support GuardObjectFuseProperty in Warp. r=iain
https://github.com/mozilla-firefox/firefox/commit/ed06997b0c38
https://hg.mozilla.org/integration/autoland/rev/8f373494031e
part 11 - Support optimizing SetProp for objects with an ObjectFuse. r=iain

Perfherder has detected a browsertime performance change from push 8f373494031ed192dd97c5019b5ffa7076b0548a.

If you have any questions, please reach out to a performance sheriff. Alternatively, you can find help on Slack by joining #perf-help, and on Matrix you can find help by joining #perftest.

Improvements:

Ratio Test Platform Options Absolute values (old vs new) Performance Profiles
9% speedometer3 React-Stockcharts-SVG/PanTheChart/Sync macosx1470-64-nightlyasrelease fission webrender 8.19 -> 7.46 Before/After
3% speedometer3 React-Stockcharts-SVG/total linux1804-64-shippable-qr fission webrender 215.23 -> 207.72 Before/After
3% speedometer3 React-Stockcharts-SVG/PanTheChart/Async linux1804-64-shippable-qr fission webrender 20.02 -> 19.41 Before/After

Details of the alert can be found in the alert summary, including links to graphs and comparisons for each of the affected tests.

If you need the profiling jobs you can trigger them yourself from treeherder job view or ask a performance sheriff to do that for you.

You can run all of these tests on try with ./mach try perf --alert 46246

The following documentation link provides more information about this command.

QA Whiteboard: [qa-triage-done-c144/b143]
Regressions: 1984268
Regressions: 2027993
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: