Closed
Bug 1093356
Opened 9 years ago
Closed 9 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)
1.21 KB,
patch
|
h4writer
:
review+
nbp
:
review+
|
Details | Diff | Splinter Review |
2.35 KB,
patch
|
nbp
:
review+
h4writer
:
review+
|
Details | Diff | Splinter Review |
5.45 KB,
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•9 years ago
|
Attachment #8516315 -
Flags: review?(hv1989) → review+
Updated•9 years ago
|
Attachment #8516315 -
Flags: review?(nicolas.b.pierron) → review+
Assignee | ||
Comment 1•9 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•9 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•9 years ago
|
Attachment #8516793 -
Flags: review?(hv1989) → review+
Comment 3•9 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•9 years ago
|
||
The range-non-int32-constant.patch patch: https://hg.mozilla.org/integration/mozilla-inbound/rev/2e8c12e04a14
Keywords: leave-open
Assignee | ||
Comment 5•9 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•9 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•9 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•9 years ago
|
Attachment #8516793 -
Flags: review?(nicolas.b.pierron) → review+
Assignee | ||
Comment 9•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/ebd122ad6d59
Assignee | ||
Comment 11•9 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•9 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•9 years ago
|
Keywords: leave-open
Assignee | ||
Comment 13•9 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•9 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•9 years ago
|
Attachment #8521470 -
Flags: review?(nicolas.b.pierron) → review+
Assignee | ||
Comment 15•9 years ago
|
||
https://hg.mozilla.org/integration/mozilla-inbound/rev/a45cf456823d
Comment 16•9 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/a45cf456823d
Status: NEW → RESOLVED
Closed: 9 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
•