The number of rooting mechanisms is TOO DAMN HIGH! We should just use Rooted instead of Anchor. Volunteers?
We aren't actually rooting things held by Rooted yet, so this won't work. However, it seems like JS::Anchor could just as easily be replaced by AutoObjectRooter or AutoStringRooter.
We use Anchor in situations where performance is absolutely critical. How does the performance of Anchor compare to AutoStringRooter?
Anchor means you need to store the anchored value somewhere -- stack, register, etc. -- for longer, increasing register pressure, memory traffic, or something. The Auto classes add to a linked list on construction, remove on destruction, which is likely more. Note that Anchor only makes sense in a conservative stack scanning world. In a moving-collector world, Anchor is meaningless, and it has to be replaced with something else. Handles and good use of Rooted probably suffice to give the same perf as Anchor now -- or perhaps better, because you don't have to tie up a stack slot or register for the anchroed value. So, if you're worried about perf, the right thing to do is probably to make the APIs you're interacting with handle-safe and see where you are perf-wise then.
> Note that Anchor only makes sense in a conservative stack scanning world. Yes, indeed. And I'd love to measure the Rooted stuff, but people keep telling me it doesn't have its final performance characteristics yet... :(
Yeah, I don't expect it will until all rooting is exact. I don't see a way to square that circle, other than to just do it and iterate after observing perf results.
Status: NEW → RESOLVED
Last Resolved: 6 years ago
Resolution: --- → DUPLICATE
Duplicate of bug: 795031
You need to log in before you can comment on or make changes to this bug.