JSString resolution of substrings should use StringImpl sharing optimization.
<https://webkit.org/b/154068>
<rdar://problem/24629358>
Reviewed by Antti Koivisto.
When resolving a JSString that's actually a substring of another JSString,
use the StringImpl sharing optimization to create a new string pointing into
the parent one, instead of copying out the bytes of the string.
This dramatically reduces peak memory usage on Gerrit diff viewer pages.
Another approach to this would be to induce GC far more frequently due to
the added cost of copying out these substrings. It would reduce the risk
of prolonging the life of strings only kept alive by substrings.
This patch chooses to trade that risk for less GC and lower peak memory.
* runtime/JSString.cpp:
(JSC::JSRopeString::resolveRope):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@196761 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2 files changed