Hi,
Most likely there would need to be some type inference inferring that one
of the inputs is a string, like an operation with known string result, e.g.
function add2(a, b) {
let x = a + "string";
return x + b; // This would become JSAdd(x, JSToString(b))
}
Hope that helps,
Leszek
On Tue, Oct 10, 2023 at 12:52 PM [email protected] <[email protected]>
wrote:
> Hi,
>
> https://chromium.googlesource.com/v8/v8.git/+/refs/tags/12.0.52/src/compiler/js-typed-lowering.cc#565
> How to enter this optimaization path: JSAdd(x:string, y) => JSAdd(x,
> JSToString(y)) or
> JSAdd(x, y:string) => JSAdd(JSToString(x), y) ? The code below cannot
> enter this optimazation path, for input type is unknow.
>
> function add2(a, b) {
> return a + b;
> }
> // should create feedback vector at first, or type info can not collect.
> %PrepareFunctionForOptimization(add2);
> console.log(add2(1, "hello"));
> %OptimizeFunctionOnNextCall(add2);
> console.log(add2(2, "world"));
>
> --
> --
> 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/ba5e9972-14ce-414b-95c3-55e915b508b9n%40googlegroups.com
> <https://groups.google.com/d/msgid/v8-dev/ba5e9972-14ce-414b-95c3-55e915b508b9n%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/CAGRskv-s1EdUbsZv8W50BmUhzW__eov1tkjrxYVRnb6bW47doQ%40mail.gmail.com.