[csa][codegen] Optimize IsStrong/IsWeakOrCleared
The way to determine whether a MaybeObject is a strong or weak reference to the heap object is to check its lowest two bits. However, if the MaybeObject is known to not be a smi, that is, the lowest bit is known to be 1, we can check one bit instead. This allows Turbofan to select better instructions: x64: Before: movl r9,r11 andl r9,0x3 cmpb r9l,0x1 After: testb r11,0x2 arm64: Before: and w8, w7, #0x3 cmp w8, #0x1 (1) b.ne #+0x320 After: tbnz w7, #1, #+0x320 Change-Id: I03623183406ad7d920c96a752651e0116a22832e Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3861310Reviewed-by: Nico Hartmann <nicohartmann@chromium.org> Commit-Queue: Hao A Xu <hao.a.xu@intel.com> Reviewed-by: Igor Sheludko <ishell@chromium.org> Cr-Commit-Position: refs/heads/main@{#83153}
Showing
Please
register
or
sign in
to comment