Closed Bug 1329195 Opened 9 years ago Closed 9 years ago

CacheIR: Update old stubs instead of attaching a new stub when a DOM proxy's generation changes

Categories

(Core :: JavaScript Engine: JIT, defect, P1)

defect

Tracking

()

RESOLVED FIXED
mozilla53
Tracking Status
firefox53 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

To avoid attaching a lot of stubs and then deoptimizing.
Flags: needinfo?(jdemooij)
Attached patch PatchSplinter Review
This patch gives the generation stub field its own StubField::Type. Then in stubDataEquals (renamed to stubDataEqualsMaybeUpdate), it's easy to check whether the generation is the *only* thing that chanced and if so we update the old stub data instead of attaching a new stub. For this to work, I had to change the Ion codegen to read the generation from the IonICStub instead of baking it in in the code. I'll now attach a microbenchmark and post perf numbers.
Flags: needinfo?(jdemooij)
Attachment #8827394 - Flags: review?(evilpies)
(In reply to Jan de Mooij [:jandem] from comment #1) > whether the generation is the *only* thing that chanced Ugh, *changed*, obviously.
Attached file Microbenchmark
Here's a simple microbenchmark for this. It has a <form> element and adds input elements to that so the generation changes. Results (best of 5 runs): Before: 161 ms Before, no Ion: 168 ms After: 10 ms After, no Ion: 24 ms Note that we're also doing much better than Aurora: Aurora 52: 34 ms Aurora 52, no Ion: 387 ms This is because the old Baseline code only optimized the native-getter unshadowed case, and now we also handle plain data properties on the proto. Also, the old Ion IC code had to reset the stub chain and compile a new stub every time we attached an "unshadowed" stub and now we can just update the generation field. This avoids a lot of W^X toggling.
Comment on attachment 8827394 [details] [diff] [review] Patch Review of attachment 8827394 [details] [diff] [review]: ----------------------------------------------------------------- So without this we actually regressed performance quite a bit, correct? I think I remember a few other cases where we used to just update the stubs and these numbers have me a bit concerned. ::: js/src/jit/CacheIRCompiler.cpp @@ +858,5 @@ > continue; > } > > + if (field.asInt64() != *reinterpret_cast<const uint64_t*>(stubDataWords)) { > + if (field.type() != StubField::Type::DOMExpandoGeneration) Using a custom type for this is clever!
Attachment #8827394 - Flags: review?(evilpies) → review+
But otherwise the new numbers look very good +1
Thanks for the review! (In reply to Tom Schuster [:evilpie] from comment #4) > I think I remember a few other cases where we used to just update the stubs > and these numbers have me a bit concerned. That was for shape guards on the prototype in some cases. It was added for the BaselineInspector, but the inspector now checks whether the shape still matches the holder's current shape. The Ion ICs also never did anything like that. We should investigate these things at some point, but I don't think it's very urgent.
It may be worth checking the bugs that motivated the addition of that "update the stub" stuff to start with and checking how we do on those testcases.
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla53
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: