Closed
Bug 513063
Opened 16 years ago
Closed 16 years ago
Avoid bit twiddling on double values
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
FIXED
| Tracking | Status | |
|---|---|---|
| status1.9.2 | --- | beta1-fixed |
People
(Reporter: gal, Assigned: gal)
Details
(Whiteboard: fixed-in-tracemonkey)
Attachments
(2 files)
|
7.95 KB,
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
|
866 bytes,
patch
|
jorendorff
:
review+
|
Details | Diff | Splinter Review |
The attached patch performs DOUBLE_IS_INT and friends directly on floating point registers using compiler intrinsics to determine whether a number is nan or finite, instead of forcing it into memory and meddle with the bit representation.
| Assignee | ||
Comment 1•16 years ago
|
||
Assignee: general → gal
| Assignee | ||
Updated•16 years ago
|
Attachment #397094 -
Flags: review?(brendan)
Comment 2•16 years ago
|
||
Comment on attachment 397094 [details] [diff] [review]
patch
> static JSDHashNumber
> HashDouble(JSDHashTable *table, const void *key)
> {
>- jsdouble d;
>-
> JS_ASSERT(IS_DOUBLE_TABLE(table));
>- d = *(jsdouble *)key;
>- return JSDOUBLE_HI32(d) ^ JSDOUBLE_LO32(d);
>+ return JS_HASH_INT64(key);
Is JS_HASH_INT64 strict-aliasing safe?
>-#ifdef HPUX
>- /*
>- * Negation of a zero doesn't produce a negative
>- * zero on HPUX. Perform the operation by bit
>- * twiddling.
>- */
>- JSDOUBLE_HI32(d) ^= JSDOUBLE_HI32_SIGNBIT;
>-#else
> d = -d;
>-#endif
There are three such old HPUX ifdefs:
$ grep HPUX *.cpp
jsnum.cpp:#ifdef HPUX
jsnum.cpp: * here on HPUX. Force a negative zero instead.
jsops.cpp:#ifdef HPUX
jsops.cpp: * zero on HPUX. Perform the operation by bit
jsparse.cpp:#ifdef HPUX
jsparse.cpp: * zero on HPUX. Perform the operation by bit
Remove them all, or leave them all -- no 1/3rd measures :-P.
r=me with these addressed.
/be
Attachment #397094 -
Flags: review?(brendan) → review+
| Assignee | ||
Comment 3•16 years ago
|
||
void* should be exempt from alias analysis since its not a proper type. On top of that, HashDouble is called via a virtual dispatch. So if there is an alias problem here, its the double going into the void* pointer. Whether we convert the void* on the other side of the virtual call into a double* doesn't really matter. It would be too late (if this was a problem, which it isn't).
I will remove the other HPUX stuff too. Thanks.
| Assignee | ||
Comment 4•16 years ago
|
||
After some additional discussion with jimb we decided to not rely on the virtual dispatch as knowledge boundary. I will add a proper union conversion.
| Assignee | ||
Comment 5•16 years ago
|
||
Whiteboard: fixed-in-tracemonkey
Comment 6•16 years ago
|
||
Win32 tinderboxes break on the patch as-landed. Attached patch fixes them.
Attachment #397134 -
Flags: review?
Updated•16 years ago
|
Attachment #397134 -
Flags: review? → review?(jorendorff)
Updated•16 years ago
|
Attachment #397134 -
Flags: review?(jorendorff) → review+
Comment 7•16 years ago
|
||
Comment on attachment 397134 [details] [diff] [review]
fix windows breakage
OK, looks good, and anything to stop the fires.
Comment 9•16 years ago
|
||
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Comment 10•16 years ago
|
||
Comment 11•16 years ago
|
||
status1.9.2:
--- → beta1-fixed
Updated•16 years ago
|
Flags: wanted1.9.2+
You need to log in
before you can comment on or make changes to this bug.
Description
•