Add macroassembler support for WeakMap lookup
Categories
(Core :: JavaScript Engine, enhancement, P1)
Tracking
()
| 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.
| Assignee | ||
Comment 1•11 months ago
|
||
| Assignee | ||
Comment 2•11 months ago
|
||
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.
| Assignee | ||
Comment 3•11 months ago
|
||
| Assignee | ||
Comment 4•11 months ago
|
||
| Assignee | ||
Comment 5•11 months ago
|
||
Bug 1740745 removed the last use of this argument.
Driveby: remove unnecessary arch-specific code
| Assignee | ||
Comment 6•11 months ago
|
||
This is used in the next patch.
| Assignee | ||
Comment 7•11 months ago
|
||
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.
| Assignee | ||
Comment 8•11 months ago
|
||
Comment 10•11 months ago
|
||
Comment 11•11 months ago
|
||
| Assignee | ||
Comment 12•11 months ago
|
||
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.
Comment 13•11 months ago
|
||
Comment 14•11 months ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/d06c70b12058
https://hg.mozilla.org/mozilla-central/rev/2af884f696e3
https://hg.mozilla.org/mozilla-central/rev/1d9b2325db58
https://hg.mozilla.org/mozilla-central/rev/f87d4af51d63
https://hg.mozilla.org/mozilla-central/rev/874197dbcfa1
https://hg.mozilla.org/mozilla-central/rev/4b3de371b2b9
https://hg.mozilla.org/mozilla-central/rev/7000426011bd
https://hg.mozilla.org/mozilla-central/rev/f97ed7c9f411
Updated•11 months ago
|
Description
•