Closed Bug 1011366 Opened 10 years ago Closed 10 years ago

Support unaligned accesses in irregexp

Categories

(Core :: JavaScript Engine: JIT, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla32

People

(Reporter: bhackett1024, Assigned: bhackett1024)

References

Details

Attachments

(1 file)

Attached patch patchSplinter Review
In bug 976446 I forgot to test sunspider and regexp-dna ended up being regressed by nearly 100%.  Most of this is fixed by the attached patch, which allows unaligned accesses fetching multiple characters at once.  My main concern with this patch is how to handle ARM.  How do we know whether the current CPU supports unaligned accesses?  Is this the isJITRuntimeEnabled test in RegExpObject.h (currently relevant only to yarr)?

Anyways, I get 10ms on regexp-dna with yarr, 20ms before this patch and 13ms after the patch.  The remaining difference seems to be just inefficiencies in irregexp's generated code.  d8 gets 8ms, but that seems to be because the string is ASCII; if I add a unicode character to the dna string then d8's time goes up to 15ms.  irregexp supports loading and comparing up to four characters at a time in ASCII mode, so any work done to support ASCII strings in spidermonkey will definitely help irregexp.
Attachment #8423610 - Flags: review?(jdemooij)
Comment on attachment 8423610 [details] [diff] [review]
patch

Review of attachment 8423610 [details] [diff] [review]:
-----------------------------------------------------------------

IIRC unaligned loads are fine on all ARM CPUs we support, but I don't know how efficient they are, you should ask jbramley/mjrosenb/dougc. Does V8 emit unaligned loads on ARM?

(In reply to Brian Hackett (:bhackett) from comment #0)
> irregexp supports loading and comparing up to four
> characters at a time in ASCII mode, so any work done to support ASCII
> strings in spidermonkey will definitely help irregexp.

I'm working on it, between other stuff. It will take a while but hopefully not super long.
Attachment #8423610 - Flags: review?(jdemooij) → review+
V8 emits unaligned loads on ARM when the CPU supports it and when it isn't in slow_safe() mode (which is entered after the thread generates enough regexp code to go above some large threshold).

https://hg.mozilla.org/integration/mozilla-inbound/rev/713b0491788e
https://hg.mozilla.org/mozilla-central/rev/713b0491788e
Assignee: nobody → bhackett1024
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: