Sometimes StringBuilder will keep the internal buffer used during building, and the returned "built" StringImpl will be a substring that retains the buffer. This way we keep two StringImpls around instead of one.
Created attachment 268134 [details]
Here's one way of making this better: adjusting the length field of the buffer and then returning it as the final string. This way we keep the slightly oversized buffer allocation, but don't allocate an extra StringImpl.
Comment on attachment 268134 [details]
Clearing flags on attachment: 268134
Committed r194510: <http://trac.webkit.org/changeset/194510>
All reviewed patches have been landed. Closing bug.
This broke the windows build:
C:\cygwin\home\buildbot\slave\win-debug\build\Source\WTF\wtf\text\StringBuilder.cpp(63): error C2248: 'WTF::StringImpl::m_length': cannot access private member declared in class 'WTF::StringImpl' [C:\cygwin\home\buildbot\slave\win-debug\build\WebKitBuild\Debug\Source\WTF\wtf\WTF.vcxproj]
It also broke two tests:
Tests that failed:
Reverted r194510 for reason:
Broke 2 API tests, no time to investigate right now
Committed r194519: <http://trac.webkit.org/changeset/194519>