Hi Ji,

as the NaN pattern is not observable from the JS side, no specification
says anything about the bit representation of a Wasm NaN when converted to
a JS value. What other platforms do is to just keep the value as it is, and
store it in a HeapNumber. We don't *have to* do that, we could also use a
canonical NaN value on the JS side, but then we would have to explicitly
canonicalize on the boundary of Wasm and JS.

The failing cctest in https://crbug.com/v8/14269 tests that NaN values are
received in JS unmodified, so it tests what we do on other platforms.
That's not mandated by the Wasm specification though, so we could decide to
canonicalize NaN values and relax the test to allow for that.

Would it be easier for RISC-V to canonicalize on the boundary? Or does it
already do that, and that's why the tests are failing?

-Clemens


On Tue, Aug 15, 2023 at 6:16 PM Ji Qiu <qi...@iscas.ac.cn> wrote:

> RISC-V has not implemented generic js-to-wasm wrapper at the moment. So it
> still uses the stub function JSToWasmWrapper.
>
> The wasm value types are converted to smi or HeapNumbers
> (the call path is BuildCallAndReturn->ToJS).
>
> When a F32 value is returned in a wasm function, the wrapper may convert
> the F32 to a proper tagged value, if it can't convert to a smi value, it
> would be convert to a object containing double value and the tagged pointer
> of the object would be seen from JS side.(by BuildChangeFloat32ToNumber
> Node)
>
> My question is that when a NaN F32 is returned, is there any rule or
> specification for the propagation of NaN?
>
> Newbie for Wasm. Sorry If I missed any common documentation for this part
> :) Thx!
>
>
> Background: The bug for filed for RISCV (
> https://bugs.chromium.org/p/v8/issues/detail?id=14269 )
>
> --
> --
> v8-dev mailing list
> v8-dev@googlegroups.com
> 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 v8-dev+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/v8-dev/902db3ea-d56a-4629-ab29-940a381ab872n%40googlegroups.com
> <https://groups.google.com/d/msgid/v8-dev/902db3ea-d56a-4629-ab29-940a381ab872n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>


-- 

Clemens Backes

Software Engineer

cleme...@google.com

Google Germany GmbH

Erika-Mann-Straße 33

80636 München

Geschäftsführer: Paul Manicle, Liana Sebastian

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg

Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise erhalten
haben sollten, leiten Sie diese bitte nicht an jemand anderes weiter,
löschen Sie alle Kopien und Anhänge davon und lassen Sie mich bitte wissen,
dass die E-Mail an die falsche Person gesendet wurde.


This e-mail is confidential. If you received this communication by mistake,
please don't forward it to anyone else, please erase all copies and
attachments, and please let me know that it has gone to the wrong person.

-- 
-- 
v8-dev mailing list
v8-dev@googlegroups.com
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 v8-dev+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/v8-dev/CAGO%3DqhAbnsmPUT2H9p%2BOdtmRUOpQNV1mRgPa4aknmtfD%2BvkDUQ%40mail.gmail.com.

Reply via email to