This change doesn't include the String.prototype.matchAll modifications, because
those are already part of the main spec.
- The inlining is more conservative than
inlineIsRegExpObject, because it's not
clear at this point we need the extra features from
- The self-hosted part is slightly different than the current spec text, because
it combines the match and replace loops. The non-functional replace part is
implemented in C++, so we can reuse the existing C++ matcher functions.
- Added some extra assertions to
AppendDollarReplacement and also had to change
infallibleAppend call into a normal
append call, because when called
replaceAll, we may not have reserved enough space in the StringBuffer.
replaceAll has a specialised implementation when the pattern is the empty
string, because in that case the pattern is interleaved in-between each
character, so we don't need to find the next match and can also directly reserve
the correct string length (when no '$' characters are present in the replacement
string). This should allow users to update from the previous
str.split("").join(r) pattern to
str.replaceAll("", r) without loss of
- When the pattern isn't the empty string, we reuse the existing
AppendDollarReplacement functions to match and replace the pattern.
This feature is still restricted to Nightly, because no test262 tests are