Support unaligned accesses in irregexp

RESOLVED FIXED in mozilla32

Status

()

Core
JavaScript Engine: JIT
RESOLVED FIXED
3 years ago
3 years ago

People

(Reporter: bhackett, Assigned: bhackett)

Tracking

unspecified
mozilla32
x86
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

3 years ago
Created attachment 8423610 [details] [diff] [review]
patch

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+
(Assignee)

Updated

3 years ago
Duplicate of this bug: 1006799
(Assignee)

Comment 3

3 years ago
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
Last Resolved: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla32
You need to log in before you can comment on or make changes to this bug.