Refactored String.prototype.replace
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Dec 2011 15:38:43 +0000 (15:38 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Dec 2011 15:38:43 +0000 (15:38 +0000)
commitd61c05dff4db52508c5fbbebda8ec8e089f8f49b
treed591b37dc7e60ccbca9e3c1505e04c4b6ecc36b6
parenta1be83a7c5792cdc2e26563bd8a71729e0bba0a4
Refactored String.prototype.replace
https://bugs.webkit.org/show_bug.cgi?id=75114

Reviewed by Darin Adler.

No performance difference.

I think this is a step toward removing -fomit-frame-pointer.

* runtime/JSString.cpp:
* runtime/JSString.h: Removed the test and special case for a single-character
search string because the standard path does this test and special case
for us. (As an aside, if we do come up with a unique single-character
replace optimization in future, it probably belongs in the replace function,
and not in JSString.)

* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncReplace): Split this mega-sized function into:
(JSC::replaceUsingStringSearch): - This reasonably sized function, and
(JSC::replaceUsingRegExpSearch): - This still mega-sized function.

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