Closed Bug 889825 Opened 11 years ago Closed 11 years ago

IonMonkey: Eliminate more redundant bounds checks

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla25

People

(Reporter: jandem, Assigned: jandem)

Details

Attachments

(1 file)

Attached patch PatchSplinter Review
When we have something like this:

    x[a] = x[a] + 3;

And we add an MConvertElementsToDouble instruction for the GETELEM, we're unable to eliminate the redundant bounds check for the SETELEM, because the MIR looks like this:

GETELEM: BoundsCheck 1 -> InitializedLength 1 -> ConvertElementsToDouble -> Elements
SETELEM: BoundsCheck 2 -> InitializedLength 2 -> Elements

GVN does not know it can eliminate the second InitializedLength + BoundsCheck.

The patch changes the GETELEM InitializedLength to have Elements as operand instead of ConvertElementsToDouble. This is safe because ConvertElementsToDouble will not change the initialized length.

This wins about 15% on Kraken imaging-desaturate and 5% on audio-fft (where I noticed this).
Attachment #770798 - Flags: review?(hv1989)
Comment on attachment 770798 [details] [diff] [review]
Patch

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

Nice find!

Not entirely related, but I think I also saw gvn failing to merge the following (deltablue):

Block 0
MTest "block 1", "block 2"

Block 1
LoadFixedSlot 0
LoadFixedSlot 1

Block 2
LoadFixedSlot 1
LoadFixedSlot 0

So loading from the same elements but in different order. Nothing in between though.
Attachment #770798 - Flags: review?(hv1989) → review+
https://hg.mozilla.org/integration/mozilla-inbound/rev/55497c1e7391

(In reply to Hannes Verschore [:h4writer] from comment #1)

GVN will only do something if block 1 dominates block 2, it won't move these loads to block 0.
https://hg.mozilla.org/mozilla-central/rev/55497c1e7391
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla25
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: