RESOLVED FIXED 144205
[JSC] Implement Math.clz32(), remove Number.clz()
https://bugs.webkit.org/show_bug.cgi?id=144205
Summary [JSC] Implement Math.clz32(), remove Number.clz()
Benjamin Poulain
Reported 2015-04-25 19:35:54 PDT
[JSC] Implement Math.clz32(), remove Number.clz()
Attachments
Patch (48.97 KB, patch)
2015-04-25 19:47 PDT, Benjamin Poulain
no flags
Benjamin Poulain
Comment 1 2015-04-25 19:47:49 PDT
Michael Saboff
Comment 2 2015-04-26 08:15:41 PDT
Comment on attachment 251664 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=251664&action=review r=me with one question. > Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h:194 > + xor32(TrustedImm32(0x1f), dst); Why is the xor needed? Since you protect for the zero case and bsr is spec'ed to return an unsigned value from 0..31, you shouldn't need this xor.
Benjamin Poulain
Comment 3 2015-04-26 11:15:58 PDT
(In reply to comment #2) > > Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h:194 > > + xor32(TrustedImm32(0x1f), dst); > > Why is the xor needed? Since you protect for the zero case and bsr is > spec'ed to return an unsigned value from 0..31, you shouldn't need this xor. BSR returns the position of the most significant bit, the opposite of what we need. The xor32 is there to inverse the result.
Benjamin Poulain
Comment 4 2015-04-26 12:56:28 PDT
Comment on attachment 251664 [details] Patch Clearing flags on attachment: 251664 Committed r183358: <http://trac.webkit.org/changeset/183358>
Benjamin Poulain
Comment 5 2015-04-26 12:56:31 PDT
All reviewed patches have been landed. Closing bug.
Michael Saboff
Comment 6 2015-04-26 22:04:16 PDT
(In reply to comment #3) > (In reply to comment #2) > > > Source/JavaScriptCore/assembler/MacroAssemblerX86Common.h:194 > > > + xor32(TrustedImm32(0x1f), dst); > > > > Why is the xor needed? Since you protect for the zero case and bsr is > > spec'ed to return an unsigned value from 0..31, you shouldn't need this xor. > > BSR returns the position of the most significant bit, the opposite of what > we need. > The xor32 is there to inverse the result. Got it.
Note You need to log in before you can comment on or make changes to this bug.