https://bugs.webkit.org/show_bug.cgi?id=50412
authorantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Dec 2010 11:11:08 +0000 (11:11 +0000)
committerantti@apple.com <antti@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 7 Dec 2010 11:11:08 +0000 (11:11 +0000)
commit6261f1f0ee860da14711942ac1b029aeac3b1a03
treecb02fe9a3a1de6444d0bc674e7aedb7e79b6feb0
parente256525901f2f2fd0238ce691a1c038f7df1d274
https://bugs.webkit.org/show_bug.cgi?id=50412
http://www.wunderground.com/US/CA/Hayward.html causes big memory spike during page loading

Reviewed by Gavin Barraclough.

Creating a substring caused the original string be flattened if it was in the rope form. This could use
significant amount of memory by reducing buffer sharing between strings.

Add a rope specific substring function that constructs the substring by reusing the rope fibers
instead of flattening the rope.

No change observed in SunSpider.

* runtime/JSString.cpp:
(JSC::JSString::substringFromRope):
* runtime/JSString.h:
(JSC::jsSubstring):
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncSubstr):
(JSC::stringProtoFuncSubstring):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73433 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JavaScriptCore/ChangeLog
JavaScriptCore/runtime/JSString.cpp
JavaScriptCore/runtime/JSString.h
JavaScriptCore/runtime/StringPrototype.cpp