Hello,

As far as I know V8 does not rely on zero-extension. Typically there
would be `ChangeUint32ToUint64` node in the TurboFan graph, which can then
get eliminated away in the platform specific code, see e.g.
https://source.chromium.org/chromium/chromium/src/+/main:v8/src/compiler/backend/x64/instruction-selector-x64.cc;l=1536;drc=ae1eee10fab6ea738b8289f9dc4144e38425a463
.

That being said, sometimes such nodes are missing, which can lead to
security bugs. That's why there is lots of code checking for zero
extension, see e.g.
https://source.chromium.org/chromium/chromium/src/+/main:v8/src/compiler/backend/x64/code-generator-x64.cc;l=1898;drc=6bd44dfe57d8d9673c34eda1ae27d66a7f5ec637
.

It could be that we should actually delete these tests, maybe they are
out-dated. I have to check that.

Cheers, Andreas

On Mon, Jul 26, 2021 at 2:31 PM Zhao Jiazhong <[email protected]>
wrote:

> Hello everyone,
>
> AFAIK, MIPS64 and RV64 don't have 32-bit registers and according to
> their calling convention, they would sign-extend all 32-bit values when
> they are stored in 64-bit registers, both signed and unsigned, see: A
> related question in stackoverflow
> <https://stackoverflow.com/questions/52646216/zero-sign-extend-are-no-op-why-then-instructions-for-each-size-type>
> .
>
> But in v8 it seems the uint32 values are zero-extended? I tried to
> sign-extend uint32 values,  on mips64, which could elide some instructions,
> and only two more tests failed:
> - cctest/test-run-load-store/RunLoadStoreZeroExtend64
> - cctest/test-run-load-store/RunUnalignedLoadStoreZeroExtend64
> Just like their names suggest, they both may load some values and check
> whether they are zero-extended.
>
> So I wonder could uint32  values be sign-extended in v8 on MIPS64? Any
> suggestion would be appreciated, thanks!
>
> Thanks,
> Zhao Jiazhong
>
> --
> --
> v8-dev mailing list
> [email protected]
> http://groups.google.com/group/v8-dev
> ---
> You received this message because you are subscribed to the Google Groups
> "v8-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-dev/a9163642-7e38-410a-8476-8bb4a5c545d0n%40googlegroups.com
> <https://groups.google.com/d/msgid/v8-dev/a9163642-7e38-410a-8476-8bb4a5c545d0n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
-- 
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- 
You received this message because you are subscribed to the Google Groups 
"v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAELSTvfsuKnroiLwBoot4sjdXpH-ovb%3DLNZLPCgH99HzbV14Ug%40mail.gmail.com.

Reply via email to