[WTF] StringBuilder should set correct m_is8Bit flag when merging
authorysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Apr 2019 17:48:10 +0000 (17:48 +0000)
committerysuzuki@apple.com <ysuzuki@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 18 Apr 2019 17:48:10 +0000 (17:48 +0000)
commit785532096159653df792259a6c25c5df44aa12da
tree6cd65883b54804cb4671cdb3244341a189fbc54f
parentc539f72c45c46d00b29bfdd145438f855c40897f
[WTF] StringBuilder should set correct m_is8Bit flag when merging
https://bugs.webkit.org/show_bug.cgi?id=197053

Reviewed by Saam Barati.

JSTests:

* stress/merge-string-builder-in-dfg.js: Added.
(foo):

Source/WTF:

When appending StringBuilder to the other StringBuilder, we have a path that does not set m_is8Bit flag correctly.
This patch correctly sets this flag. And we also change 0 to nullptr when we are using 0 as a pointer.

* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::reserveCapacity):
(WTF::StringBuilder::appendUninitializedSlow):
(WTF::StringBuilder::append):
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::append):
(WTF::StringBuilder::characters8 const):
(WTF::StringBuilder::characters16 const):
(WTF::StringBuilder::clear):

Tools:

* TestWebKitAPI/Tests/WTF/StringBuilder.cpp:
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@244429 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JSTests/ChangeLog
JSTests/stress/merge-string-builder-in-dfg.js [new file with mode: 0644]
Source/WTF/ChangeLog
Source/WTF/wtf/text/StringBuilder.cpp
Source/WTF/wtf/text/StringBuilder.h
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp