Closed
Bug 1093356
Opened 10 years ago
Closed 10 years ago
Refine the range of constants outside the int32 range
Categories
(Core :: JavaScript Engine: JIT, enhancement)
Core
JavaScript Engine: JIT
Tracking
()
RESOLVED
FIXED
mozilla36
People
(Reporter: sunfish, Assigned: sunfish)
Details
Attachments
(3 files, 2 obsolete files)
(deleted),
patch
|
h4writer
:
review+
nbp
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
nbp
:
review+
h4writer
:
review+
|
Details | Diff | Splinter Review |
(deleted),
patch
|
nbp
:
review+
h4writer
:
review+
|
Details | Diff | Splinter Review |
While working on bug 1073928, I noticed that the range computed for constants greater than INT32_MAX or less than INT32_MIN was unnecessarily broad. The attached patch fixes it.
Attachment #8516315 -
Flags: review?(nicolas.b.pierron)
Attachment #8516315 -
Flags: review?(hv1989)
Updated•10 years ago
|
Attachment #8516315 -
Flags: review?(hv1989) → review+
Updated•10 years ago
|
Attachment #8516315 -
Flags: review?(nicolas.b.pierron) → review+
Assignee | ||
Comment 1•10 years ago
|
||
One more patch; I noticed that beta nodes for comparisons like |x < 0| would generate beta nodes that included negative zero on both sides. Negative zero is not actually equal to zero, so we can exclude it on the false side.
Attachment #8516793 -
Flags: review?(nicolas.b.pierron)
Attachment #8516793 -
Flags: review?(hv1989)
Assignee | ||
Comment 2•10 years ago
|
||
Oh, one more one more thing. We can support JSOP_STRICTEQ and JSOP_STRICTNE with beta nodes too.
Attachment #8516797 -
Flags: review?(nicolas.b.pierron)
Attachment #8516797 -
Flags: review?(hv1989)
Updated•10 years ago
|
Attachment #8516793 -
Flags: review?(hv1989) → review+
Comment 3•10 years ago
|
||
Comment on attachment 8516797 [details] [diff] [review]
range-strict-cmp.patch
Review of attachment 8516797 [details] [diff] [review]:
-----------------------------------------------------------------
::: js/src/jit/RangeAnalysis.cpp
@@ +251,4 @@
> case JSOP_EQ:
> comp.setDouble(bound, bound);
> break;
> + case JSOP_STRICTNE:
What about an object that overrides its "valueOf" to -0?
if (obj !== 0) {
assertEq (obj == -0, false); // Will assert. obj equals to -0.
}
Attachment #8516797 -
Flags: review?(hv1989)
Assignee | ||
Comment 4•10 years ago
|
||
The range-non-int32-constant.patch patch:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2e8c12e04a14
Keywords: leave-open
Assignee | ||
Comment 5•10 years ago
|
||
Comment on attachment 8516797 [details] [diff] [review]
range-strict-cmp.patch
(In reply to Hannes Verschore [:h4writer] from comment #3)
> What about an object that overrides its "valueOf" to -0?
> if (obj !== 0) {
> assertEq (obj == -0, false); // Will assert. obj equals to -0.
> }
JSOP_STRICTEQ can call valueOf while JSOP_EQ can't? In that case, I'll just drop this patch.
Attachment #8516797 -
Attachment is obsolete: true
Attachment #8516797 -
Flags: review?(nicolas.b.pierron)
Comment 6•10 years ago
|
||
(In reply to Dan Gohman [:sunfish] from comment #5)
> Comment on attachment 8516797 [details] [diff] [review]
> range-strict-cmp.patch
>
> (In reply to Hannes Verschore [:h4writer] from comment #3)
> > What about an object that overrides its "valueOf" to -0?
> > if (obj !== 0) {
> > assertEq (obj == -0, false); // Will assert. obj equals to -0.
> > }
>
> JSOP_STRICTEQ can call valueOf while JSOP_EQ can't? In that case, I'll just
> drop this patch.
The issue is that on STRICT compare "obj !== 0" is always true, since the types don't match. Even if ToNumber(obj) is 0 or -0.
Assignee | ||
Comment 7•10 years ago
|
||
(In reply to Hannes Verschore [:h4writer] from comment #6)
> The issue is that on STRICT compare "obj !== 0" is always true, since the
> types don't match. Even if ToNumber(obj) is 0 or -0.
Can we do a strict compare if the types of the operands are not MIRType_Object, or is there something else easy we can do? The patch eliminates a few instructions in stanford-crypto-sha256-iterative, for example, so it'd be neat if there were a way to fix it.
Updated•10 years ago
|
Attachment #8516793 -
Flags: review?(nicolas.b.pierron) → review+
Assignee | ||
Comment 9•10 years ago
|
||
Comment 10•10 years ago
|
||
Assignee | ||
Comment 11•10 years ago
|
||
Is this what you suggested earlier? It's possible I misunderstood, since I'm unfamiliar with the semantics of strict comparisons.
Attachment #8519096 -
Flags: feedback?(hv1989)
Comment 12•10 years ago
|
||
Comment on attachment 8519096 [details] [diff] [review]
range-strict-cmp.patch
Review of attachment 8519096 [details] [diff] [review]:
-----------------------------------------------------------------
That looks correct. You can even increase that list to:
> Compare_Int32,
> Compare_Int32MaybeCoerceBoth,
> Compare_Int32MaybeCoerceLHS,
> Compare_Int32MaybeCoerceRHS,
>
> Compare_Double,
>
> Compare_DoubleMaybeCoerceLHS,
> Compare_DoubleMaybeCoerceRHS,
>
> Compare_Float
Please add this test in a functions to MCompare ;) or a static function.
Also don't forget to add testcases that test this. E.g. for placeses where this would be incorrect.
Attachment #8519096 -
Flags: feedback?(hv1989) → feedback+
Assignee | ||
Updated•10 years ago
|
Keywords: leave-open
Assignee | ||
Comment 13•10 years ago
|
||
Cool. I've updated the patch accordingly.
Attachment #8519096 -
Attachment is obsolete: true
Attachment #8521470 -
Flags: review?(nicolas.b.pierron)
Attachment #8521470 -
Flags: review?(hv1989)
Comment 14•10 years ago
|
||
Comment on attachment 8521470 [details] [diff] [review]
range-strict-cmp.patch
Review of attachment 8521470 [details] [diff] [review]:
-----------------------------------------------------------------
Awesome, thanks!
Attachment #8521470 -
Flags: review?(hv1989) → review+
Updated•10 years ago
|
Attachment #8521470 -
Flags: review?(nicolas.b.pierron) → review+
Assignee | ||
Comment 15•10 years ago
|
||
Comment 16•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Flags: in-testsuite+
Resolution: --- → FIXED
Target Milestone: --- → mozilla36
You need to log in
before you can comment on or make changes to this bug.
Description
•