Add prepare hint to javascript example (#6016)

Without this additional line, v8 trunk produces no output, and v8 11.3
produces a bunch of assembly with no `imull` instruction.

I don't actually know much about v8 or javascript, but based on [this
mailing list
post](https://groups.google.com/g/v8-users/c/xlx22gScRNs/m/yE2-boWsBQAJ)
and testing on godbolt.org, this works.
This commit is contained in:
Charles Munger
2024-01-16 20:13:22 -08:00
committed by GitHub
parent 6c31805a94
commit c52a53b160

View File

@@ -3,6 +3,9 @@ function square(a) {
return result;
}
// Collect type information on next call of function
%PrepareFunctionForOptimization(square)
// Call function once to fill type information
square(23);