[JSC] Implement Math.clz32(), remove Number.clz()
Created attachment 251664 [details] Patch
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.
(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.
Comment on attachment 251664 [details] Patch Clearing flags on attachment: 251664 Committed r183358: <http://trac.webkit.org/changeset/183358>
All reviewed patches have been landed. Closing bug.
(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.