Bug
1873042 - Part 8: Optimise single- and two-character strings for LSubstr. r=jandem
It's always a bit confusing when benchmarking `LSubstr` to see slow downs for
µ-benchmarks like:
```
for (let i = 0; i < N; ++i) {
r += xs[i&1].substring(0, 2).length;
}
```
because when the inlined allocation for `JSThinInlineString` fails because the
nursery is full, we fall back into the VM. The VM code prefers to use the shared
static two-elements strings, so there's no GC which can clear up the nursery. We
jump back into the generated JIT code and in the next loop iteration we again fall
back into the VM, because the nursery is still full, since no GC happened.
Adding support for two-element string lookups avoid this issue.
Differential Revision: https://phabricator.services.mozilla.com/
D197693