Hi Zhao, you can use Torque's @if and @ifnot annotations to make such distinctions (check @if(TAGGED_SIZE_8_BYTES) for an example). You then need to set this from the C++ side in torque-parser.cc <https://source.chromium.org/chromium/chromium/src/+/main:v8/src/torque/torque-parser.cc;l=46;drc=35bb990bac45ef15807c9eab4d60b8078b65f038> and for that you can use the usual `V8_TARGET_ARCH_XXX`. The places where you can use such annotations are a bit restricted if I remember correctly, but it should be enough to support your case (maybe see this <https://source.chromium.org/chromium/chromium/src/+/main:v8/src/builtins/promise-misc.tq;l=82;drc=7857eb34db42f339b337c6bdfb0d10deb14862f3> for an example). Hope that helps.
Cheers Nico On Wed, Aug 7, 2024 at 4:18 AM Zhao Jiazhong <[email protected]> wrote: > Hi all, > > I'm porting JSPI to loong64 port, and find an issue that in > JSToWasmWrapperHelper > <https://source.chromium.org/chromium/chromium/src/+/refs/tags/119.0.6045.214:v8/src/builtins/js-to-wasm.tq;l=559>, > a 32-bit value is converted to unsigned then converted to intptr, which > leading to a zero-extended value, but on LoongArch64, we need the 32-bit > value to be sign-extended in 64-bit registers. > > I don't want to change the behavior on other arches, but the builtin is > written in torque, I suppose I can't use `V8_TARGET_ARCH_XXX` macro in > it, so is there a way to distinguish v8 target arch in torque builtins? > Thanks! > > Yours, > 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/c2790cc7-513d-4296-8531-f620fe93e038n%40googlegroups.com > <https://groups.google.com/d/msgid/v8-dev/c2790cc7-513d-4296-8531-f620fe93e038n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Nico Hartmann | Software Engineer | [email protected] | Chrome - V8 -- -- 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/CAHNjccL5Ke3K6x-D4MO%2BR1M8ij-G0s%2BJ1sa0wZBSxpA5zgYvEA%40mail.gmail.com.
