Title: [133726] trunk/Source/WTF
- Revision
- 133726
- Author
- [email protected]
- Date
- 2012-11-06 23:13:20 -0800 (Tue, 06 Nov 2012)
Log Message
StringBuilder::append(UChar) with an 8 bit quantity shouldn't change the contents to 16 bits
https://bugs.webkit.org/show_bug.cgi?id=101421
Reviewed by Anders Carlsson.
If the string builder contains only 8 bit data, check if the character being appended contains
8 bit data. If so, append it to the 8 bit buffer instead of converting the buffer to 16 bits.
* wtf/text/StringBuilder.cpp:
(WTF::StringBuilder::append):
* wtf/text/StringBuilder.h:
(WTF::StringBuilder::append):
Modified Paths
Diff
Modified: trunk/Source/WTF/ChangeLog (133725 => 133726)
--- trunk/Source/WTF/ChangeLog 2012-11-07 06:46:04 UTC (rev 133725)
+++ trunk/Source/WTF/ChangeLog 2012-11-07 07:13:20 UTC (rev 133726)
@@ -1,3 +1,18 @@
+2012-11-06 Michael Saboff <[email protected]>
+
+ StringBuilder::append(UChar) with an 8 bit quantity shouldn't change the contents to 16 bits
+ https://bugs.webkit.org/show_bug.cgi?id=101421
+
+ Reviewed by Anders Carlsson.
+
+ If the string builder contains only 8 bit data, check if the character being appended contains
+ 8 bit data. If so, append it to the 8 bit buffer instead of converting the buffer to 16 bits.
+
+ * wtf/text/StringBuilder.cpp:
+ (WTF::StringBuilder::append):
+ * wtf/text/StringBuilder.h:
+ (WTF::StringBuilder::append):
+
2012-11-06 Benjamin Poulain <[email protected]>
Speed up TransformationMatrix::multiply() on modern ARM
Modified: trunk/Source/WTF/wtf/text/StringBuilder.cpp (133725 => 133726)
--- trunk/Source/WTF/wtf/text/StringBuilder.cpp 2012-11-07 06:46:04 UTC (rev 133725)
+++ trunk/Source/WTF/wtf/text/StringBuilder.cpp 2012-11-07 07:13:20 UTC (rev 133726)
@@ -243,6 +243,13 @@
ASSERT(characters);
if (m_is8Bit) {
+ if (length == 1 && !(*characters & ~0xff)) {
+ // Append as 8 bit character
+ LChar lChar = static_cast<LChar>(*characters);
+ append(&lChar, 1);
+ return;
+ }
+
// Calculate the new size of the builder after appending.
unsigned requiredLength = length + m_length;
if (requiredLength < length)
Modified: trunk/Source/WTF/wtf/text/StringBuilder.h (133725 => 133726)
--- trunk/Source/WTF/wtf/text/StringBuilder.h 2012-11-07 06:46:04 UTC (rev 133725)
+++ trunk/Source/WTF/wtf/text/StringBuilder.h 2012-11-07 07:13:20 UTC (rev 133726)
@@ -111,10 +111,18 @@
void append(UChar c)
{
- if (m_buffer && !m_is8Bit && m_length < m_buffer->length() && m_string.isNull())
- m_bufferCharacters16[m_length++] = c;
- else
- append(&c, 1);
+ if (m_buffer && m_length < m_buffer->length() && m_string.isNull()) {
+ if (!m_is8Bit) {
+ m_bufferCharacters16[m_length++] = c;
+ return;
+ }
+
+ if (!(c & ~0xff)) {
+ m_bufferCharacters8[m_length++] = static_cast<LChar>(c);
+ return;
+ }
+ }
+ append(&c, 1);
}
void append(LChar c)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes