Closed Bug 848319 Opened 11 years ago Closed 11 years ago

IonMonkey: Use MRegExp::UseSource instead of MRegExp::UseClone

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla22

People

(Reporter: h4writer, Assigned: h4writer)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

A MRegExp cannot get moved, unless it is flagged not being cloned, i.e. UseSource. It is actually very simple to enable moving, without doing something wrong. We only need to make sure re.lastIndex is correct. Therefore adding a MStoreFixedSlot to set lastIndex to 0 is enough. MRegExp can get hoisted, as long as the MStoreFixedSlot isn't.
Like we discussed. Setting lastIndex to 0 on the place the MRegExp would be created. This yields only a 1% increase on v8-regexp, though. But it's very simple change.
Assignee: general → hv1989
Attachment #721681 - Flags: review?(sstangl)
Blocks: 806646
Comment on attachment 721681 [details] [diff] [review]
Enable hoisting MRegExp

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

::: js/src/ion/IonBuilder.cpp
@@ +6890,5 @@
>      current->push(ins);
>  
> +    // MRegExp::UseSource makes the regexp moveable.
> +    // That would be incorrect for global/sticky, because lastIndex could be wrong.
> +    // Therefore setting the lastIndex to 0. That is faster than using MRegExp::UseClone.

Previously, the only used option was UseClone, but now the only option is UseSource. Since nothing even bothers checking these options, could we just remove the parameter?
Attachment #721681 - Flags: review?(sstangl) → review+
https://hg.mozilla.org/mozilla-central/rev/738733ab166d
Status: NEW → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla22
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: