RESOLVED FIXED 210870
[JSC] branchIfBigInt32 can use BigInt32Mask and remove branchIfNumber filter
https://bugs.webkit.org/show_bug.cgi?id=210870
Summary [JSC] branchIfBigInt32 can use BigInt32Mask and remove branchIfNumber filter
Yusuke Suzuki
Reported 2020-04-22 12:12:03 PDT
[JSC] branchIfBigInt32 can use BigInt32Mask and remove branchIfNumber filter
Attachments
Patch (17.58 KB, patch)
2020-04-22 12:15 PDT, Yusuke Suzuki
no flags
Patch (17.58 KB, patch)
2020-04-22 12:38 PDT, Yusuke Suzuki
no flags
Patch (19.67 KB, patch)
2020-04-22 13:13 PDT, Yusuke Suzuki
no flags
Patch (20.93 KB, patch)
2020-04-22 13:56 PDT, Yusuke Suzuki
no flags
Patch (20.93 KB, patch)
2020-04-22 14:09 PDT, Yusuke Suzuki
no flags
Patch (21.11 KB, patch)
2020-04-22 15:07 PDT, Yusuke Suzuki
saam: review+
Yusuke Suzuki
Comment 1 2020-04-22 12:15:01 PDT
Robin Morisset
Comment 2 2020-04-22 12:36:20 PDT
Comment on attachment 397232 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397232&action=review > Source/JavaScriptCore/jit/AssemblyHelpers.h:938 > + and64(TrustedImm32(JSValue::BigInt32Mask), tempGPR); It cannot be TrustedImm32, since it is a 64 bit mask. It has to be materialized one way or another.
Yusuke Suzuki
Comment 3 2020-04-22 12:38:33 PDT
Yusuke Suzuki
Comment 4 2020-04-22 12:40:06 PDT
Comment on attachment 397232 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397232&action=review >> Source/JavaScriptCore/jit/AssemblyHelpers.h:938 >> + and64(TrustedImm32(JSValue::BigInt32Mask), tempGPR); > > It cannot be TrustedImm32, since it is a 64 bit mask. It has to be materialized one way or another. Fixed.
Yusuke Suzuki
Comment 5 2020-04-22 13:13:52 PDT
Yusuke Suzuki
Comment 6 2020-04-22 13:23:07 PDT
Comment on attachment 397244 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397244&action=review > Source/JavaScriptCore/jit/AssemblyHelpers.h:934 > + Jump branchIfBigInt32(GPRReg gpr, GPRReg tempGPR) I would extend it further by using number-tag-register later. if (mode == HaveTagRegisters) { move(GPRInfo::numberTagRegister, tempGPR); add64(TrustedImm32(JSValue::BigInt32Tag), tempGPR); and64(gpr, tempGPR); return branch64(Equal, tempGPR, TrustedImm32(JSValue::BigInt32Tag)); }
Yusuke Suzuki
Comment 7 2020-04-22 13:26:38 PDT
Comment on attachment 397244 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397244&action=review >> Source/JavaScriptCore/jit/AssemblyHelpers.h:934 >> + Jump branchIfBigInt32(GPRReg gpr, GPRReg tempGPR) > > I would extend it further by using number-tag-register later. > > if (mode == HaveTagRegisters) { > move(GPRInfo::numberTagRegister, tempGPR); > add64(TrustedImm32(JSValue::BigInt32Tag), tempGPR); > and64(gpr, tempGPR); > return branch64(Equal, tempGPR, TrustedImm32(JSValue::BigInt32Tag)); > } Or further, if (mode == HaveTagRegisters) { add64(TrustedImm32(JSValue::BigInt32Tag), GPRInfo::numberTagRegister, tempGPR); and64(gpr, tempGPR); return branch64(Equal, tempGPR, TrustedImm32(JSValue::BigInt32Tag)); }
Yusuke Suzuki
Comment 8 2020-04-22 13:27:35 PDT
Comment on attachment 397244 [details] Patch I'll do it.
Saam Barati
Comment 9 2020-04-22 13:31:29 PDT
Comment on attachment 397244 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=397244&action=review >>> Source/JavaScriptCore/jit/AssemblyHelpers.h:934 >>> + Jump branchIfBigInt32(GPRReg gpr, GPRReg tempGPR) >> >> I would extend it further by using number-tag-register later. >> >> if (mode == HaveTagRegisters) { >> move(GPRInfo::numberTagRegister, tempGPR); >> add64(TrustedImm32(JSValue::BigInt32Tag), tempGPR); >> and64(gpr, tempGPR); >> return branch64(Equal, tempGPR, TrustedImm32(JSValue::BigInt32Tag)); >> } > > Or further, > > if (mode == HaveTagRegisters) { > add64(TrustedImm32(JSValue::BigInt32Tag), GPRInfo::numberTagRegister, tempGPR); > and64(gpr, tempGPR); > return branch64(Equal, tempGPR, TrustedImm32(JSValue::BigInt32Tag)); > } Let's also static assert that this produce the same value in C++
Yusuke Suzuki
Comment 10 2020-04-22 13:56:56 PDT
Yusuke Suzuki
Comment 11 2020-04-22 14:09:32 PDT
Yusuke Suzuki
Comment 12 2020-04-22 15:07:24 PDT
Yusuke Suzuki
Comment 13 2020-04-22 20:11:08 PDT
Radar WebKit Bug Importer
Comment 14 2020-04-22 20:12:20 PDT
Note You need to log in before you can comment on or make changes to this bug.