Title: [106170] trunk/Source/_javascript_Core
- Revision
- 106170
- Author
- commit-qu...@webkit.org
- Date
- 2012-01-27 17:06:17 -0800 (Fri, 27 Jan 2012)
Log Message
Unreviewed, rolling out r106167.
http://trac.webkit.org/changeset/106167
https://bugs.webkit.org/show_bug.cgi?id=77264
broke LayoutTests/fast/js/string-capitalization.html
(Requested by msaboff on #webkit).
Patch by Sheriff Bot <webkit.review....@gmail.com> on 2012-01-27
* runtime/StringPrototype.cpp:
(JSC::stringProtoFuncToLowerCase):
(JSC::stringProtoFuncToUpperCase):
* wtf/text/StringImpl.cpp:
(WTF::StringImpl::upper):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (106169 => 106170)
--- trunk/Source/_javascript_Core/ChangeLog 2012-01-28 00:54:06 UTC (rev 106169)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-01-28 01:06:17 UTC (rev 106170)
@@ -1,3 +1,18 @@
+2012-01-27 Sheriff Bot <webkit.review....@gmail.com>
+
+ Unreviewed, rolling out r106167.
+ http://trac.webkit.org/changeset/106167
+ https://bugs.webkit.org/show_bug.cgi?id=77264
+
+ broke LayoutTests/fast/js/string-capitalization.html
+ (Requested by msaboff on #webkit).
+
+ * runtime/StringPrototype.cpp:
+ (JSC::stringProtoFuncToLowerCase):
+ (JSC::stringProtoFuncToUpperCase):
+ * wtf/text/StringImpl.cpp:
+ (WTF::StringImpl::upper):
+
2012-01-27 Filip Pizlo <fpi...@apple.com>
Build fix for interpreter platforms.
Modified: trunk/Source/_javascript_Core/runtime/StringPrototype.cpp (106169 => 106170)
--- trunk/Source/_javascript_Core/runtime/StringPrototype.cpp 2012-01-28 00:54:06 UTC (rev 106169)
+++ trunk/Source/_javascript_Core/runtime/StringPrototype.cpp 2012-01-28 01:06:17 UTC (rev 106170)
@@ -1180,7 +1180,7 @@
if (!sSize)
return JSValue::encode(sVal);
- StringImpl* ourImpl = s.impl();
+ StringImpl* ourImpl = s.impl();
RefPtr<StringImpl> lower = ourImpl->lower();
if (ourImpl == lower.get())
return JSValue::encode(sVal);
@@ -1199,11 +1199,32 @@
if (!sSize)
return JSValue::encode(sVal);
- StringImpl* ourImpl = s.impl();
- RefPtr<StringImpl> upper = ourImpl->upper();
- if (ourImpl == upper.get())
- return JSValue::encode(sVal);
- return JSValue::encode(jsString(exec, UString(upper.release())));
+ const UChar* sData = s.characters();
+ Vector<UChar> buffer(sSize);
+
+ UChar ored = 0;
+ for (int i = 0; i < sSize; i++) {
+ UChar c = sData[i];
+ ored |= c;
+ buffer[i] = toASCIIUpper(c);
+ }
+ if (!(ored & ~0x7f))
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
+
+ bool error;
+ int length = Unicode::toUpper(buffer.data(), sSize, sData, sSize, &error);
+ if (error) {
+ buffer.resize(length);
+ length = Unicode::toUpper(buffer.data(), length, sData, sSize, &error);
+ if (error)
+ return JSValue::encode(sVal);
+ }
+ if (length == sSize) {
+ if (memcmp(buffer.data(), sData, length * sizeof(UChar)) == 0)
+ return JSValue::encode(sVal);
+ } else
+ buffer.resize(length);
+ return JSValue::encode(jsString(exec, UString::adopt(buffer)));
}
EncodedJSValue JSC_HOST_CALL stringProtoFuncLocaleCompare(ExecState* exec)
Modified: trunk/Source/_javascript_Core/wtf/text/StringImpl.cpp (106169 => 106170)
--- trunk/Source/_javascript_Core/wtf/text/StringImpl.cpp 2012-01-28 00:54:06 UTC (rev 106169)
+++ trunk/Source/_javascript_Core/wtf/text/StringImpl.cpp 2012-01-28 01:06:17 UTC (rev 106170)
@@ -363,8 +363,6 @@
CRASH();
int32_t length = m_length;
- const UChar* source16;
-
if (is8Bit()) {
LChar* data8;
RefPtr<StringImpl> newImpl = createUninitialized(m_length, data8);
@@ -380,30 +378,19 @@
return newImpl.release();
// Do a slower implementation for cases that include non-ASCII Latin-1 characters.
- for (int32_t i = 0; i < length; i++) {
- UChar upper = Unicode::toUpper(m_data8[i]);
- if (UNLIKELY(upper > 0xff)) {
- // Have a character that is 16bit when converted to uppercase.
- source16 = characters();
- goto upconvert;
- }
-
- data8[i] = static_cast<LChar>(upper);
- }
+ for (int32_t i = 0; i < length; i++)
+ data8[i] = static_cast<LChar>(Unicode::toUpper(m_data8[i]));
return newImpl.release();
}
- source16 = m_data16;
-
-upconvert:
UChar* data16;
RefPtr<StringImpl> newImpl = createUninitialized(m_length, data16);
// Do a faster loop for the case where all the characters are ASCII.
UChar ored = 0;
for (int i = 0; i < length; i++) {
- UChar c = source16[i];
+ UChar c = m_data16[i];
ored |= c;
data16[i] = toASCIIUpper(c);
}
@@ -413,11 +400,11 @@
// Do a slower implementation for cases that include non-ASCII characters.
bool error;
newImpl = createUninitialized(m_length, data16);
- int32_t realLength = Unicode::toUpper(data16, length, source16, m_length, &error);
+ int32_t realLength = Unicode::toUpper(data16, length, m_data16, m_length, &error);
if (!error && realLength == length)
return newImpl;
newImpl = createUninitialized(realLength, data16);
- Unicode::toUpper(data16, realLength, source16, m_length, &error);
+ Unicode::toUpper(data16, realLength, m_data16, m_length, &error);
if (error)
return this;
return newImpl.release();
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes