Closed Bug 465137 Opened 16 years ago Closed 16 years ago

TM: JIT thinks !NaN is false

Categories

(Core :: JavaScript Engine, defect, P1)

defect

Tracking

()

VERIFIED FIXED
mozilla1.9.1b2

People

(Reporter: jruderman, Assigned: Waldo)

References

Details

(Keywords: testcase, verified1.9.1)

Attachments

(1 file)

js> for (var i=0;i<5;++i) print("NaN is " + (!(NaN) ? "falsy" : "truthy"));
NaN is falsy
NaN is falsy
NaN is truthy
NaN is truthy
NaN is truthy
Assignee: general → jwalden+bmo
Attached patch PatchSplinter Review
I'm still stepping lightly through this code -- which later stage of processing converts these instructions to non-FP instructions?  Will this != check interfere with what appears to be described as "demotion" in jstracer.cpp?  Alternately, is it potentially faster to short-circuit the computation (but introduce branches) and avoid not evaluating the entire thing every time?

This was more trouble than it should have been because I forgot that not is not not.  (LIR_not is not !, that is.  :-) )
Attachment #348468 - Flags: review?(gal)
Comment on attachment 348468 [details] [diff] [review]
Patch

Yeah, always use LIR_f* for numbers in the frontend code generators. Filters do the rest.
Attachment #348468 - Flags: review?(gal) → review+
Additional comment: always try to avoid forking of new traces since that can be very costly (if you really take the other path and have to build a whole new trace). The basic guidance is:
- if the type changes, you need a new trace
- if the value is extremely unlikely to be hit, make it a mismatch exit (like out of memory conditions)
- if the type is the same, use or or conditional moves or whatever other magic you need. We should teach the backend to pickup these patterns and optimize them. x = !(a == x) for example is very inefficient atm and does first sete and setne instead of just setne.
This could get ugly for the beta. Look out for dups. Need to fix before final no matter what.

/be
Flags: blocking1.9.1?
OS: Mac OS X → All
Hardware: PC → All
(In reply to comment #3)
> - if the type is the same, use or or conditional moves or whatever other magic
> you need. We should teach the backend to pickup these patterns and optimize
> them. x = !(a == x) for example is very inefficient atm and does first sete and
> setne instead of just setne.

Bug on file?

/be
Fixed in TM.
Summary: TM: JIT thinks NaN is truthy → TM: JIT thinks !NaN is false
Blocks: arithfuzz
Severity: normal → critical
Status: NEW → RESOLVED
Closed: 16 years ago
Priority: -- → P1
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.1b2
reopening, marking blocking beta2, will close once landed on m-c.
Status: RESOLVED → REOPENED
Flags: blocking1.9.1? → blocking1.9.1+
Resolution: FIXED → ---
Fixed in the merge pushed by vlad on Nov 18 14:11:14 2008 -0800:
http://hg.mozilla.org/mozilla-central/rev/e8ed5d4bf531
Status: REOPENED → RESOLVED
Closed: 16 years ago16 years ago
Resolution: --- → FIXED
testLogicalNotNaN already in js1_8_1/trace/trace-test.js
Flags: in-testsuite+
Flags: in-litmus-
v 1.9.1, 1.9.2
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: