Closed Bug 2000328 Opened 1 year ago Closed 11 months ago

Add macroassembler support for WeakMap lookup

Categories

(Core :: JavaScript Engine, enhancement, P1)

enhancement

Tracking

()

RESOLVED FIXED
147 Branch
Tracking Status
firefox147 --- fixed

People

(Reporter: iain, Assigned: iain)

References

(Blocks 1 open bug)

Details

Attachments

(8 external files)

One of the biggest remaining opportunities for speeding up WeakMap lookup is to inline it into jitcode. This is somewhat tricky because WeakMaps are implemented using MFBT hashtables, which don't currently have any JIT support, but that's fixable with enough elbow grease.

I have a mostly working prototype, which reduces the time per lookup in the benchmark attached to bug 1821107 from 20ns/lookup to 13ns/lookup, bringing us to parity with V8.

This should also open up the opportunity to inline hashtable lookup in other cases in the future.

We need to load the hash shift from JIT code, which requires a known offset. Explicit shifting is more reliable than bitfields.

Testing on godbolt (https://godbolt.org/z/srvaqfoPb), it looks like this will generally produce very slightly nicer code than before. Previously, the hashShift bitfield was being stored at the most-significant end of the word. To load mGen, we therefore had to mask off the hash shift with a large 64-bit constant. Now we can just do a shift, which is the same number of instructions but a smaller encoding.

Bug 1740745 removed the last use of this argument.

Driveby: remove unnecessary arch-specific code

This is used in the next patch.

I added the new tests in weakmapset-get-has.js because my first version of this patch was checking for a null pointer when the hash map didn't exist, instead of undefined, and the only testcase that seemed to catch it was a non262 test marked slow.

Blocks: 2002881
Pushed by nfay@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/c4efb2b73d8e https://hg.mozilla.org/integration/autoland/rev/a19a69729816 Revert "Bug 2000328: apply code formatting via Lando" for causing SM Bustages on CodeGenerator.cpp

Backed out for causing SM Bustages on CodeGenerator.cpp

Backout link

Push with failures

Failure log

Flags: needinfo?(iireland)

Oops, turned out I accidentally landed the second-last patch in the stack, which would have been fine except that it contained a syntax error that was fixed in the last patch. Relanding the whole stack now.

Flags: needinfo?(iireland)
QA Whiteboard: [qa-triage-done-c148/b147]
Regressions: 2034837
Regressions: 2045307
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: