[JSC] Use table based approach for JSON.stringify's Quote
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Aug 2017 01:22:33 +0000 (01:22 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 30 Aug 2017 01:22:33 +0000 (01:22 +0000)
commit333899deb1dc02f373d75fb57c386946a3be87ae
treed3d7f021a75928cc8f221dcc966fdb1c4dabd467
parent35294948509aaecb2587a7dd528010f59f730f3b
[JSC] Use table based approach for JSON.stringify's Quote
https://bugs.webkit.org/show_bug.cgi?id=176044

Reviewed by Darin Adler.

We change escape operation of JSON Quote from branch-based to table-based.
This patch partially adopts SpiderMonkey's change to StringBuilderJSON.cpp
to optimize this escaping operation. We separate changes from StringBuilder.cpp
to apply MPL to StringBuilderJSON.cpp file. Since WebKit already adopts MPL in
some files (like, DateMath.h), it is acceptable.

Kraken json-stringify-tinderbox shows 7.2% improvement.

                                   baseline                  patched

json-stringify-tinderbox        40.429+-0.771      ^      37.693+-0.862         ^ definitely 1.0726x faster

* WTF.xcodeproj/project.pbxproj:
* wtf/CMakeLists.txt:
* wtf/text/StringBuilder.cpp:
(WTF::appendQuotedJSONStringInternalSlow): Deleted.
(WTF::appendQuotedJSONStringInternal): Deleted.
(WTF::StringBuilder::appendQuotedJSONString): Deleted.
* wtf/text/StringBuilderJSON.cpp: Added.
(WTF::appendQuotedJSONStringInternal):
(WTF::StringBuilder::appendQuotedJSONString):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221330 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/text/StringBuilder.cpp
Source/WTF/wtf/text/StringBuilderJSON.cpp [new file with mode: 0644]