Open Bug 1859521 Opened 1 year ago Updated 1 year ago

Try to rewrite RegExp replace with non-callable replacer in C++

Categories

(Core :: JavaScript Engine, task, P3)

task

Tracking

()

ASSIGNED

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 3 open bugs)

Details

(Whiteboard: [sp3])

Now that the self-hosted code is using RegExpSearcher instead of RegExpMatcher, I think this is worth trying as next step. (RegExpMatcher benefits from the JIT trampoline for the object allocation, but we don't have that anymore with RegExpSearcher.)

Severity: -- → S3
Priority: -- → P3
Whiteboard: [sp3]

Last week I wrote some (hackish and incomplete) patches for this that reimplement RegExp.prototype[@@replace] with non-callable replacer in C++, and also a patch to do the same for String.prototype.replace with a fast path for the typical string/regexp cases.

https://hg.mozilla.org/try/rev/9e032861f9a2e46cd0b851b81659ecbf64594d69
https://hg.mozilla.org/try/rev/d13c53d1c87c0b6af67ec433b0a83988958de0d0

It's complete enough for Speedometer 3 and is faster than the Baseline version of the self-hosted code, but it's slower than these builtins running in Ion. A bit frustrating because the JIT warmup time is hurting us and I think this is a nicer approach, but I don't want to regress performance compared to the Ion version.

I also wrote some optimization patches on top of this that move the needle a bit but don't close the gap.

Blocks: 1866499
You need to log in before you can comment on or make changes to this bug.