Closed Bug 809390 Opened 12 years ago Closed 12 years ago

IonMonkey: improve range analysis of bitand

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla19

People

(Reporter: h4writer, Assigned: h4writer)

References

Details

Attachments

(1 file, 2 obsolete files)

In a bitand the upper range is only as big as the minimum of both upper ranges.
(We compute it by taking the maximum of both)
Attached patch Patch (obsolete) — Splinter Review
Assignee: general → hv1989
Attachment #679100 - Flags: review?(mrosenberg)
Comment on attachment 679100 [details] [diff] [review]
Patch

Jandem pointed me to #799793. I'll create a better patch ;)
Attachment #679100 - Flags: review?(mrosenberg) → review-
Attached patch Patch (obsolete) — Splinter Review
This should do it. Now we compute the range of x & 5 being between 0 and 5 correctly. But still do the right thing for x & -1.
Attachment #679100 - Attachment is obsolete: true
Attachment #679113 - Flags: review?(mrosenberg)
Attached patch PatchSplinter Review
Sorry, part of another patch was included. Now only the right stuff.
Attachment #679113 - Attachment is obsolete: true
Attachment #679113 - Flags: review?(mrosenberg)
Attachment #679114 - Flags: review?(mrosenberg)
Comment on attachment 679114 [details] [diff] [review]
Patch

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

::: js/src/ion/RangeAnalysis.cpp
@@ +407,5 @@
> +    // EXCEPT when upper bound of non negative number is max value,
> +    // because negative value can return the whole max value.
> +    // -1 & 5 = 5
> +    if (lhs->lower_ < 0)
> +       upper = rhs->upper_;

this and the next one should probably be Max(upper, rhs->upper_).
Attachment #679114 - Flags: review?(mrosenberg) → review+
(In reply to Marty Rosenberg [:mjrosenb] from comment #5)
> Comment on attachment 679114 [details] [diff] [review]
> Patch
> 
> Review of attachment 679114 [details] [diff] [review]:
> -----------------------------------------------------------------
> 
> ::: js/src/ion/RangeAnalysis.cpp
> @@ +407,5 @@
> > +    // EXCEPT when upper bound of non negative number is max value,
> > +    // because negative value can return the whole max value.
> > +    // -1 & 5 = 5
> > +    if (lhs->lower_ < 0)
> > +       upper = rhs->upper_;
> 
> this and the next one should probably be Max(upper, rhs->upper_).

Yes, but simplified that is "upper = rhs->upper_" ;).
https://hg.mozilla.org/mozilla-central/rev/7fa5f6815e08

Should this have a test?
Status: NEW → RESOLVED
Closed: 12 years ago
Flags: in-testsuite?
Resolution: --- → FIXED
Target Milestone: --- → mozilla19
(In reply to Ryan VanderMeulen from comment #8)
> https://hg.mozilla.org/mozilla-central/rev/7fa5f6815e08
> 
> Should this have a test?

No, this wasn't actually wrong. We now calculate better bounds for the range. I've updated the title to reflect the patch.
Summary: IonMonkey: range analysis computes range of bitand wrong → IonMonkey: improve range analysis of bitand
Flags: in-testsuite? → in-testsuite-
Blocks: 768572
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: