[Webkit-unassigned] [Bug 85752] Truncating multiplication on integers should not OSR exit every time
bugzilla-daemon at webkit.org
bugzilla-daemon at webkit.org
Sun May 6 16:19:18 PDT 2012
https://bugs.webkit.org/show_bug.cgi?id=85752
Gavin Barraclough <barraclough at apple.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
Attachment #140441|review? |review-
Flag| |
--- Comment #2 from Gavin Barraclough <barraclough at apple.com> 2012-05-06 16:19:18 PST ---
(From update of attachment 140441)
View in context: https://bugs.webkit.org/attachment.cgi?id=140441&action=review
r-, because I really do think we need a comment here – but nice optimization, looks great otherwise.
> Source/JavaScriptCore/dfg/DFGGraph.h:512
> + int32_t twoToThe17 = 131072;
Why 2^17?
A number with an absolute value less than 2^17 is representable by 17 bits. The result of multiplying a value representable by 17 bits by 2^31 (the largest possible absolute value of a signed integer) is representable in a 48 bit mantissa (with additional representation for the sign). Doubles support 53 bits of mantissa precision. Put the other way around, for the result of a multiply to be constrained within a 53 bits mantissa, if I know that the absolute value of one operand is no more than 2^31 then the second operand may have a magnitude of +/- 2^22 (less than/greater than – exclusive!).
I think 2^22 is correct here, but either way this really needs a comment. :-)
Also, I'd suggest this would slightly nicer written ''int32_t twoToThe17 = 1 << 17;".
--
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
More information about the webkit-unassigned
mailing list