Closed Bug 974350 Opened 6 years ago Closed 6 years ago

Optimize CreateRegExpMatchResult

Categories

(Core :: JavaScript Engine, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla30

People

(Reporter: jandem, Assigned: jandem)

References

(Blocks 1 open bug)

Details

Attachments

(3 files)

Attached patch PatchSplinter Review
CreateRegExpMatchResult uses an AutoValueVector. It can store up to 8 values inline, but Octane-regexp often stores up to 12 values, so we have to malloc/free external elements.

We could templatize AutoValueVector and bump the number of inline elements to 12, but this patch just gets rid of the AutoValueVector completely and fills the array directly.

This is a small win on Octane-regexp and is also simpler I think.
Attachment #8378234 - Flags: review?(hv1989)
Summary: Rewrite CreateRegExpMatchResult to not use an AutoValueVector → Optimize CreateRegExpMatchResult
There's some code in CreateRegExpMatchResult to deal with input == nullptr. In that case we allocate a string from chars + length.

It looks like ExecuteRegExpLegacy is the only caller that can pass a nullptr input, so we can move this check there and eliminate some code/args from the hot path.

Patch also removes some unnecessary roots.
Attachment #8378273 - Flags: review?(hv1989)
Profile shows 0.4% or so under getOrCreateMatchResultTemplateObject called from CreateRegExpMatchResult.

With this patch we inline the common matchResultTemplateObject_ != nullptr case. It's a puny win but simple to do.
Attachment #8378282 - Flags: review?(hv1989)
Attachment #8378234 - Flags: review?(hv1989) → review+
Attachment #8378273 - Flags: review?(hv1989) → review+
Attachment #8378282 - Flags: review?(hv1989) → review+
GGC octane-regexp appears to be 10% faster according to AWFY.
Some improvement in GGC splay also.
Blocks: 806646
You need to log in before you can comment on or make changes to this bug.