[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
barraclough at apple.com
barraclough at apple.com
Wed Dec 22 12:03:37 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 3158a38713bbccb6b785d7ed181554cea330f90e
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Aug 13 07:35:45 2010 +0000
Unify UString::UTF8String() & String::utf8() methods,
remove UString::cost() & make atArrayIndex a free function.
Reviewed by Sam Weinig
JavaScriptCore:
* JavaScriptCore.exp:
* bytecode/CodeBlock.cpp:
(JSC::constantName):
(JSC::idName):
(JSC::CodeBlock::registerName):
(JSC::regexpName):
(JSC::printGlobalResolveInfo):
(JSC::printStructureStubInfo):
(JSC::CodeBlock::printStructure):
(JSC::CodeBlock::printStructures):
* jsc.cpp:
(functionPrint):
(functionDebug):
(runInteractive):
(fillBufferWithContentsOfFile):
* pcre/pcre_exec.cpp:
(Histogram::~Histogram):
* profiler/CallIdentifier.h:
(JSC::CallIdentifier::c_str):
* profiler/Profile.cpp:
(JSC::Profile::debugPrintDataSampleStyle):
* profiler/ProfileGenerator.cpp:
(JSC::ProfileGenerator::willExecute):
(JSC::ProfileGenerator::didExecute):
* profiler/ProfileNode.cpp:
(JSC::ProfileNode::debugPrintData):
(JSC::ProfileNode::debugPrintDataSampleStyle):
* runtime/Arguments.cpp:
(JSC::Arguments::getOwnPropertySlot):
(JSC::Arguments::getOwnPropertyDescriptor):
(JSC::Arguments::put):
(JSC::Arguments::deleteProperty):
* runtime/DateConversion.cpp:
(JSC::parseDate):
* runtime/Identifier.h:
(JSC::Identifier::toStrictUInt32):
* runtime/JSArray.cpp:
(JSC::JSArray::getOwnPropertySlot):
(JSC::JSArray::getOwnPropertyDescriptor):
(JSC::JSArray::put):
(JSC::JSArray::deleteProperty):
* runtime/JSArray.h:
(JSC::toArrayIndex):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::encode):
(JSC::parseInt):
(JSC::globalFuncJSCPrint):
* runtime/JSString.h:
(JSC::RopeBuilder::JSString):
* runtime/UString.cpp:
(JSC::UString::toDouble):
(JSC::putUTF8Triple):
(JSC::UString::utf8):
* runtime/UString.h:
(JSC::UString::~UString):
(JSC::UString::isNull):
(JSC::UString::isEmpty):
(JSC::UString::impl):
* wtf/text/WTFString.cpp:
(WTF::String::utf8):
* wtf/text/WTFString.h:
(WTF::String::~String):
(WTF::String::swap):
(WTF::String::isNull):
(WTF::String::isEmpty):
(WTF::String::impl):
(WTF::String::length):
(WTF::String::String):
(WTF::String::isHashTableDeletedValue):
WebCore:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSDOMWindowCustom.cpp:
(WebCore::JSDOMWindow::getOwnPropertySlot):
(WebCore::JSDOMWindow::getOwnPropertyDescriptor):
* bridge/NP_jsobject.cpp:
(_NPN_Enumerate):
* bridge/c/c_utility.cpp:
(JSC::Bindings::convertValueToNPVariant):
* bridge/jni/JNIBridge.cpp:
(JavaParameter::JavaParameter):
(JavaMethod::JavaMethod):
(JavaMethod::signature):
(JavaMethod::methodID):
* bridge/jni/JNIBridge.h:
(JSC::Bindings::JavaString::utf8):
(JSC::Bindings::JavaParameter::type):
(JSC::Bindings::JavaMethod::returnType):
* bridge/jni/jni_jsobject.mm:
(JavaJSObject::call):
(JavaJSObject::eval):
(JavaJSObject::getMember):
(JavaJSObject::setMember):
(JavaJSObject::removeMember):
(JavaJSObject::convertJObjectToValue):
* bridge/jni/jsc/JNIBridgeJSC.cpp:
(JavaField::JavaField):
(JavaField::valueFromInstance):
(JavaField::setValueToInstance):
* bridge/jni/jsc/JNIBridgeJSC.h:
(JSC::Bindings::JavaField::type):
* bridge/jni/jsc/JavaInstanceJSC.cpp:
(JavaInstance::invokeMethod):
* bridge/jni/jsc/JavaStringJSC.h:
(JSC::Bindings::JavaStringImpl::utf8):
* bridge/runtime_array.cpp:
(JSC::RuntimeArray::getOwnPropertySlot):
(JSC::RuntimeArray::getOwnPropertyDescriptor):
(JSC::RuntimeArray::put):
WebKit/mac:
* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::enumerate):
WebKit/wx:
* WebFrame.cpp:
(wxWebFrame::RunScript):
WebKit2:
* WebProcess/Plugins/JSNPObject.cpp:
(WebKit::npIdentifierFromIdentifier):
* WebProcess/Plugins/NPJSObject.cpp:
(WebKit::NPJSObject::enumerate):
* WebProcess/Plugins/NPRuntimeObjectMap.cpp:
(WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@65305 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index fcce543..c83ba39 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,3 +1,80 @@
+2010-08-13 Gavin Barraclough <barraclough at apple.com>
+
+ Reviewed by Sam Weinig
+
+ Unify UString::UTF8String() & String::utf8() methods,
+ remove UString::cost() & make atArrayIndex a free function.
+
+ * JavaScriptCore.exp:
+ * bytecode/CodeBlock.cpp:
+ (JSC::constantName):
+ (JSC::idName):
+ (JSC::CodeBlock::registerName):
+ (JSC::regexpName):
+ (JSC::printGlobalResolveInfo):
+ (JSC::printStructureStubInfo):
+ (JSC::CodeBlock::printStructure):
+ (JSC::CodeBlock::printStructures):
+ * jsc.cpp:
+ (functionPrint):
+ (functionDebug):
+ (runInteractive):
+ (fillBufferWithContentsOfFile):
+ * pcre/pcre_exec.cpp:
+ (Histogram::~Histogram):
+ * profiler/CallIdentifier.h:
+ (JSC::CallIdentifier::c_str):
+ * profiler/Profile.cpp:
+ (JSC::Profile::debugPrintDataSampleStyle):
+ * profiler/ProfileGenerator.cpp:
+ (JSC::ProfileGenerator::willExecute):
+ (JSC::ProfileGenerator::didExecute):
+ * profiler/ProfileNode.cpp:
+ (JSC::ProfileNode::debugPrintData):
+ (JSC::ProfileNode::debugPrintDataSampleStyle):
+ * runtime/Arguments.cpp:
+ (JSC::Arguments::getOwnPropertySlot):
+ (JSC::Arguments::getOwnPropertyDescriptor):
+ (JSC::Arguments::put):
+ (JSC::Arguments::deleteProperty):
+ * runtime/DateConversion.cpp:
+ (JSC::parseDate):
+ * runtime/Identifier.h:
+ (JSC::Identifier::toStrictUInt32):
+ * runtime/JSArray.cpp:
+ (JSC::JSArray::getOwnPropertySlot):
+ (JSC::JSArray::getOwnPropertyDescriptor):
+ (JSC::JSArray::put):
+ (JSC::JSArray::deleteProperty):
+ * runtime/JSArray.h:
+ (JSC::toArrayIndex):
+ * runtime/JSGlobalObjectFunctions.cpp:
+ (JSC::encode):
+ (JSC::parseInt):
+ (JSC::globalFuncJSCPrint):
+ * runtime/JSString.h:
+ (JSC::RopeBuilder::JSString):
+ * runtime/UString.cpp:
+ (JSC::UString::toDouble):
+ (JSC::putUTF8Triple):
+ (JSC::UString::utf8):
+ * runtime/UString.h:
+ (JSC::UString::~UString):
+ (JSC::UString::isNull):
+ (JSC::UString::isEmpty):
+ (JSC::UString::impl):
+ * wtf/text/WTFString.cpp:
+ (WTF::String::utf8):
+ * wtf/text/WTFString.h:
+ (WTF::String::~String):
+ (WTF::String::swap):
+ (WTF::String::isNull):
+ (WTF::String::isEmpty):
+ (WTF::String::impl):
+ (WTF::String::length):
+ (WTF::String::String):
+ (WTF::String::isHashTableDeletedValue):
+
2010-08-12 Zoltan Herczeg <zherczeg at webkit.org>
Reviewed by Gavin Barraclough.
diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp
index 50ec307..712f8fb 100644
--- a/JavaScriptCore/JavaScriptCore.exp
+++ b/JavaScriptCore/JavaScriptCore.exp
@@ -513,8 +513,8 @@ __ZNK3JSC7JSValue16toObjectSlowCaseEPNS_9ExecStateE
__ZNK3JSC7JSValue19synthesizePrototypeEPNS_9ExecStateE
__ZNK3JSC7JSValue20toThisObjectSlowCaseEPNS_9ExecStateE
__ZNK3JSC7JSValue9toIntegerEPNS_9ExecStateE
-__ZNK3JSC7UString10UTF8StringEb
__ZNK3JSC7UString14toStrictUInt32EPb
+__ZNK3JSC7UString4utf8Eb
__ZNK3JSC7UString5asciiEv
__ZNK3JSC7UString6substrEjj
__ZNK3JSC7UString8toUInt32EPb
@@ -540,7 +540,7 @@ __ZNK3WTF6String16removeCharactersEPFbtE
__ZNK3WTF6String17crossThreadStringEv
__ZNK3WTF6String18simplifyWhiteSpaceEv
__ZNK3WTF6String19characterStartingAtEj
-__ZNK3WTF6String4utf8Ev
+__ZNK3WTF6String4utf8Eb
__ZNK3WTF6String5asciiEv
__ZNK3WTF6String5lowerEv
__ZNK3WTF6String5splitERKS0_bRNS_6VectorIS0_Lm0EEE
diff --git a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
index e59fc7a..511a7a0 100644
--- a/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
+++ b/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
@@ -2326,7 +2326,6 @@
isa = PBXProject;
buildConfigurationList = 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */;
compatibilityVersion = "Xcode 2.4";
- developmentRegion = English;
hasScannedForEncodings = 1;
knownRegions = (
English,
diff --git a/JavaScriptCore/bytecode/CodeBlock.cpp b/JavaScriptCore/bytecode/CodeBlock.cpp
index 7d846d9..266e682 100644
--- a/JavaScriptCore/bytecode/CodeBlock.cpp
+++ b/JavaScriptCore/bytecode/CodeBlock.cpp
@@ -71,12 +71,12 @@ static UString valueToSourceString(ExecState* exec, JSValue val)
static CString constantName(ExecState* exec, int k, JSValue value)
{
- return makeString(valueToSourceString(exec, value), "(@k", UString::number(k - FirstConstantRegisterIndex), ")").UTF8String();
+ return makeString(valueToSourceString(exec, value), "(@k", UString::number(k - FirstConstantRegisterIndex), ")").utf8();
}
static CString idName(int id0, const Identifier& ident)
{
- return makeString(ident.ustring(), "(@id", UString::number(id0), ")").UTF8String();
+ return makeString(ident.ustring(), "(@id", UString::number(id0), ")").utf8();
}
CString CodeBlock::registerName(ExecState* exec, int r) const
@@ -87,7 +87,7 @@ CString CodeBlock::registerName(ExecState* exec, int r) const
if (isConstantRegisterIndex(r))
return constantName(exec, r, getConstant(r));
- return makeString("r", UString::number(r)).UTF8String();
+ return makeString("r", UString::number(r)).utf8();
}
static UString regexpToSourceString(RegExp* regExp)
@@ -106,7 +106,7 @@ static UString regexpToSourceString(RegExp* regExp)
static CString regexpName(int re, RegExp* regexp)
{
- return makeString(regexpToSourceString(regexp), "(@re", UString::number(re), ")").UTF8String();
+ return makeString(regexpToSourceString(regexp), "(@re", UString::number(re), ")").utf8();
}
static UString pointerToSourceString(void* p)
@@ -224,32 +224,32 @@ static unsigned instructionOffsetForNth(ExecState* exec, const Vector<Instructio
static void printGlobalResolveInfo(const GlobalResolveInfo& resolveInfo, unsigned instructionOffset)
{
- printf(" [%4d] %s: %s\n", instructionOffset, "resolve_global", pointerToSourceString(resolveInfo.structure).UTF8String().data());
+ printf(" [%4d] %s: %s\n", instructionOffset, "resolve_global", pointerToSourceString(resolveInfo.structure).utf8().data());
}
static void printStructureStubInfo(const StructureStubInfo& stubInfo, unsigned instructionOffset)
{
switch (stubInfo.accessType) {
case access_get_by_id_self:
- printf(" [%4d] %s: %s\n", instructionOffset, "get_by_id_self", pointerToSourceString(stubInfo.u.getByIdSelf.baseObjectStructure).UTF8String().data());
+ printf(" [%4d] %s: %s\n", instructionOffset, "get_by_id_self", pointerToSourceString(stubInfo.u.getByIdSelf.baseObjectStructure).utf8().data());
return;
case access_get_by_id_proto:
- printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_proto", pointerToSourceString(stubInfo.u.getByIdProto.baseObjectStructure).UTF8String().data(), pointerToSourceString(stubInfo.u.getByIdProto.prototypeStructure).UTF8String().data());
+ printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_proto", pointerToSourceString(stubInfo.u.getByIdProto.baseObjectStructure).utf8().data(), pointerToSourceString(stubInfo.u.getByIdProto.prototypeStructure).utf8().data());
return;
case access_get_by_id_chain:
- printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_chain", pointerToSourceString(stubInfo.u.getByIdChain.baseObjectStructure).UTF8String().data(), pointerToSourceString(stubInfo.u.getByIdChain.chain).UTF8String().data());
+ printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_chain", pointerToSourceString(stubInfo.u.getByIdChain.baseObjectStructure).utf8().data(), pointerToSourceString(stubInfo.u.getByIdChain.chain).utf8().data());
return;
case access_get_by_id_self_list:
- printf(" [%4d] %s: %s (%d)\n", instructionOffset, "op_get_by_id_self_list", pointerToSourceString(stubInfo.u.getByIdSelfList.structureList).UTF8String().data(), stubInfo.u.getByIdSelfList.listSize);
+ printf(" [%4d] %s: %s (%d)\n", instructionOffset, "op_get_by_id_self_list", pointerToSourceString(stubInfo.u.getByIdSelfList.structureList).utf8().data(), stubInfo.u.getByIdSelfList.listSize);
return;
case access_get_by_id_proto_list:
- printf(" [%4d] %s: %s (%d)\n", instructionOffset, "op_get_by_id_proto_list", pointerToSourceString(stubInfo.u.getByIdProtoList.structureList).UTF8String().data(), stubInfo.u.getByIdProtoList.listSize);
+ printf(" [%4d] %s: %s (%d)\n", instructionOffset, "op_get_by_id_proto_list", pointerToSourceString(stubInfo.u.getByIdProtoList.structureList).utf8().data(), stubInfo.u.getByIdProtoList.listSize);
return;
case access_put_by_id_transition:
- printf(" [%4d] %s: %s, %s, %s\n", instructionOffset, "put_by_id_transition", pointerToSourceString(stubInfo.u.putByIdTransition.previousStructure).UTF8String().data(), pointerToSourceString(stubInfo.u.putByIdTransition.structure).UTF8String().data(), pointerToSourceString(stubInfo.u.putByIdTransition.chain).UTF8String().data());
+ printf(" [%4d] %s: %s, %s, %s\n", instructionOffset, "put_by_id_transition", pointerToSourceString(stubInfo.u.putByIdTransition.previousStructure).utf8().data(), pointerToSourceString(stubInfo.u.putByIdTransition.structure).utf8().data(), pointerToSourceString(stubInfo.u.putByIdTransition.chain).utf8().data());
return;
case access_put_by_id_replace:
- printf(" [%4d] %s: %s\n", instructionOffset, "put_by_id_replace", pointerToSourceString(stubInfo.u.putByIdReplace.baseObjectStructure).UTF8String().data());
+ printf(" [%4d] %s: %s\n", instructionOffset, "put_by_id_replace", pointerToSourceString(stubInfo.u.putByIdReplace.baseObjectStructure).utf8().data());
return;
case access_get_by_id:
printf(" [%4d] %s\n", instructionOffset, "get_by_id");
@@ -278,7 +278,7 @@ static void printStructureStubInfo(const StructureStubInfo& stubInfo, unsigned i
void CodeBlock::printStructure(const char* name, const Instruction* vPC, int operand) const
{
unsigned instructionOffset = vPC - m_instructions.begin();
- printf(" [%4d] %s: %s\n", instructionOffset, name, pointerToSourceString(vPC[operand].u.structure).UTF8String().data());
+ printf(" [%4d] %s: %s\n", instructionOffset, name, pointerToSourceString(vPC[operand].u.structure).utf8().data());
}
void CodeBlock::printStructures(const Instruction* vPC) const
@@ -295,15 +295,15 @@ void CodeBlock::printStructures(const Instruction* vPC) const
return;
}
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_proto)) {
- printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_proto", pointerToSourceString(vPC[4].u.structure).UTF8String().data(), pointerToSourceString(vPC[5].u.structure).UTF8String().data());
+ printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_proto", pointerToSourceString(vPC[4].u.structure).utf8().data(), pointerToSourceString(vPC[5].u.structure).utf8().data());
return;
}
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id_transition)) {
- printf(" [%4d] %s: %s, %s, %s\n", instructionOffset, "put_by_id_transition", pointerToSourceString(vPC[4].u.structure).UTF8String().data(), pointerToSourceString(vPC[5].u.structure).UTF8String().data(), pointerToSourceString(vPC[6].u.structureChain).UTF8String().data());
+ printf(" [%4d] %s: %s, %s, %s\n", instructionOffset, "put_by_id_transition", pointerToSourceString(vPC[4].u.structure).utf8().data(), pointerToSourceString(vPC[5].u.structure).utf8().data(), pointerToSourceString(vPC[6].u.structureChain).utf8().data());
return;
}
if (vPC[0].u.opcode == interpreter->getOpcode(op_get_by_id_chain)) {
- printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_chain", pointerToSourceString(vPC[4].u.structure).UTF8String().data(), pointerToSourceString(vPC[5].u.structureChain).UTF8String().data());
+ printf(" [%4d] %s: %s, %s\n", instructionOffset, "get_by_id_chain", pointerToSourceString(vPC[4].u.structure).utf8().data(), pointerToSourceString(vPC[5].u.structureChain).utf8().data());
return;
}
if (vPC[0].u.opcode == interpreter->getOpcode(op_put_by_id)) {
diff --git a/JavaScriptCore/jsc.cpp b/JavaScriptCore/jsc.cpp
index 03bc411..316f346 100644
--- a/JavaScriptCore/jsc.cpp
+++ b/JavaScriptCore/jsc.cpp
@@ -178,7 +178,7 @@ EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec)
if (i)
putchar(' ');
- printf("%s", exec->argument(i).toString(exec).UTF8String().data());
+ printf("%s", exec->argument(i).toString(exec).utf8().data());
}
putchar('\n');
@@ -188,7 +188,7 @@ EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec)
EncodedJSValue JSC_HOST_CALL functionDebug(ExecState* exec)
{
- fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec).UTF8String().data());
+ fprintf(stderr, "--> %s\n", exec->argument(0).toString(exec).utf8().data());
return JSValue::encode(jsUndefined());
}
@@ -442,7 +442,7 @@ static void runInteractive(GlobalObject* globalObject)
if (completion.complType() == Throw)
printf("Exception: %s\n", completion.value().toString(globalObject->globalExec()).ascii());
else
- printf("%s\n", completion.value().toString(globalObject->globalExec()).UTF8String().data());
+ printf("%s\n", completion.value().toString(globalObject->globalExec()).utf8().data());
globalObject->globalExec()->clearException();
}
@@ -532,9 +532,9 @@ int jscmain(int argc, char** argv, JSGlobalData* globalData)
static bool fillBufferWithContentsOfFile(const UString& fileName, Vector<char>& buffer)
{
- FILE* f = fopen(fileName.UTF8String().data(), "r");
+ FILE* f = fopen(fileName.utf8().data(), "r");
if (!f) {
- fprintf(stderr, "Could not open file: %s\n", fileName.UTF8String().data());
+ fprintf(stderr, "Could not open file: %s\n", fileName.utf8().data());
return false;
}
diff --git a/JavaScriptCore/pcre/pcre_exec.cpp b/JavaScriptCore/pcre/pcre_exec.cpp
index 098302b..f4899f2 100644
--- a/JavaScriptCore/pcre/pcre_exec.cpp
+++ b/JavaScriptCore/pcre/pcre_exec.cpp
@@ -2143,7 +2143,7 @@ Histogram::~Histogram()
size_t size = values.size();
printf("Regular Expressions, sorted by time spent evaluating them:\n");
for (size_t i = 0; i < size; ++i)
- printf(" %f - %s\n", values[size - i - 1].second, values[size - i - 1].first.UTF8String().c_str());
+ printf(" %f - %s\n", values[size - i - 1].second, values[size - i - 1].first.utf8().c_str());
}
void Histogram::add(const JSRegExp* re, double elapsedTime)
diff --git a/JavaScriptCore/profiler/CallIdentifier.h b/JavaScriptCore/profiler/CallIdentifier.h
index cfdef18..714b140 100644
--- a/JavaScriptCore/profiler/CallIdentifier.h
+++ b/JavaScriptCore/profiler/CallIdentifier.h
@@ -71,7 +71,7 @@ namespace JSC {
#ifndef NDEBUG
operator const char*() const { return c_str(); }
- const char* c_str() const { return m_name.UTF8String().data(); }
+ const char* c_str() const { return m_name.utf8().data(); }
#endif
};
diff --git a/JavaScriptCore/profiler/Profile.cpp b/JavaScriptCore/profiler/Profile.cpp
index 94b9fbc..bc239b3 100644
--- a/JavaScriptCore/profiler/Profile.cpp
+++ b/JavaScriptCore/profiler/Profile.cpp
@@ -127,7 +127,7 @@ void Profile::debugPrintDataSampleStyle() const
std::sort(sortedFunctions.begin(), sortedFunctions.end(), functionNameCountPairComparator);
for (NameCountPairVector::iterator it = sortedFunctions.begin(); it != sortedFunctions.end(); ++it)
- printf(" %-12d%s\n", (*it).second, UString((*it).first).UTF8String().data());
+ printf(" %-12d%s\n", (*it).second, UString((*it).first).utf8().data());
printf("\nSort by top of stack, same collapsed (when >= 5):\n");
}
diff --git a/JavaScriptCore/profiler/ProfileGenerator.cpp b/JavaScriptCore/profiler/ProfileGenerator.cpp
index bdfa27b..1d916ea 100644
--- a/JavaScriptCore/profiler/ProfileGenerator.cpp
+++ b/JavaScriptCore/profiler/ProfileGenerator.cpp
@@ -75,8 +75,8 @@ const UString& ProfileGenerator::title() const
void ProfileGenerator::willExecute(const CallIdentifier& callIdentifier)
{
if (JAVASCRIPTCORE_PROFILE_WILL_EXECUTE_ENABLED()) {
- CString name = callIdentifier.m_name.UTF8String();
- CString url = callIdentifier.m_url.UTF8String();
+ CString name = callIdentifier.m_name.utf8();
+ CString url = callIdentifier.m_url.utf8();
JAVASCRIPTCORE_PROFILE_WILL_EXECUTE(m_profileGroup, const_cast<char*>(name.data()), const_cast<char*>(url.data()), callIdentifier.m_lineNumber);
}
@@ -90,8 +90,8 @@ void ProfileGenerator::willExecute(const CallIdentifier& callIdentifier)
void ProfileGenerator::didExecute(const CallIdentifier& callIdentifier)
{
if (JAVASCRIPTCORE_PROFILE_DID_EXECUTE_ENABLED()) {
- CString name = callIdentifier.m_name.UTF8String();
- CString url = callIdentifier.m_url.UTF8String();
+ CString name = callIdentifier.m_name.utf8();
+ CString url = callIdentifier.m_url.utf8();
JAVASCRIPTCORE_PROFILE_DID_EXECUTE(m_profileGroup, const_cast<char*>(name.data()), const_cast<char*>(url.data()), callIdentifier.m_lineNumber);
}
diff --git a/JavaScriptCore/profiler/ProfileNode.cpp b/JavaScriptCore/profiler/ProfileNode.cpp
index 969cda8..bfcfcbe 100644
--- a/JavaScriptCore/profiler/ProfileNode.cpp
+++ b/JavaScriptCore/profiler/ProfileNode.cpp
@@ -294,11 +294,11 @@ void ProfileNode::debugPrintData(int indentLevel) const
printf(" ");
printf("Function Name %s %d SelfTime %.3fms/%.3f%% TotalTime %.3fms/%.3f%% VSelf %.3fms VTotal %.3fms Visible %s Next Sibling %s\n",
- functionName().UTF8String().data(),
+ functionName().utf8().data(),
m_numberOfCalls, m_actualSelfTime, selfPercent(), m_actualTotalTime, totalPercent(),
m_visibleSelfTime, m_visibleTotalTime,
(m_visible ? "True" : "False"),
- m_nextSibling ? m_nextSibling->functionName().UTF8String().data() : "");
+ m_nextSibling ? m_nextSibling->functionName().utf8().data() : "");
++indentLevel;
@@ -313,7 +313,7 @@ double ProfileNode::debugPrintDataSampleStyle(int indentLevel, FunctionCallHashC
printf(" ");
// Print function names
- const char* name = functionName().UTF8String().data();
+ const char* name = functionName().utf8().data();
double sampleCount = m_actualTotalTime * 1000;
if (indentLevel) {
for (int i = 0; i < indentLevel; ++i)
@@ -339,7 +339,7 @@ double ProfileNode::debugPrintDataSampleStyle(int indentLevel, FunctionCallHashC
while (indentLevel--)
printf(" ");
- printf("%.0f %s\n", sampleCount - sumOfChildrensCount, functionName().UTF8String().data());
+ printf("%.0f %s\n", sampleCount - sumOfChildrensCount, functionName().utf8().data());
}
return m_actualTotalTime;
diff --git a/JavaScriptCore/runtime/Arguments.cpp b/JavaScriptCore/runtime/Arguments.cpp
index 916aac3..4ca0328 100644
--- a/JavaScriptCore/runtime/Arguments.cpp
+++ b/JavaScriptCore/runtime/Arguments.cpp
@@ -157,7 +157,7 @@ bool Arguments::getOwnPropertySlot(ExecState* exec, unsigned i, PropertySlot& sl
bool Arguments::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot)
{
bool isArrayIndex;
- unsigned i = propertyName.toArrayIndex(&isArrayIndex);
+ unsigned i = toArrayIndex(propertyName.ustring(), &isArrayIndex);
if (isArrayIndex && i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
if (i < d->numParameters) {
slot.setRegisterSlot(&d->registers[d->firstParameterIndex + i]);
@@ -182,7 +182,7 @@ bool Arguments::getOwnPropertySlot(ExecState* exec, const Identifier& propertyNa
bool Arguments::getOwnPropertyDescriptor(ExecState* exec, const Identifier& propertyName, PropertyDescriptor& descriptor)
{
bool isArrayIndex;
- unsigned i = propertyName.toArrayIndex(&isArrayIndex);
+ unsigned i = toArrayIndex(propertyName.ustring(), &isArrayIndex);
if (isArrayIndex && i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
if (i < d->numParameters) {
descriptor.setDescriptor(d->registers[d->firstParameterIndex + i].jsValue(), DontEnum);
@@ -233,7 +233,7 @@ void Arguments::put(ExecState* exec, unsigned i, JSValue value, PutPropertySlot&
void Arguments::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
{
bool isArrayIndex;
- unsigned i = propertyName.toArrayIndex(&isArrayIndex);
+ unsigned i = toArrayIndex(propertyName.ustring(), &isArrayIndex);
if (isArrayIndex && i < d->numArguments && (!d->deletedArguments || !d->deletedArguments[i])) {
if (i < d->numParameters)
d->registers[d->firstParameterIndex + i] = JSValue(value);
@@ -276,7 +276,7 @@ bool Arguments::deleteProperty(ExecState* exec, unsigned i)
bool Arguments::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
bool isArrayIndex;
- unsigned i = propertyName.toArrayIndex(&isArrayIndex);
+ unsigned i = toArrayIndex(propertyName.ustring(), &isArrayIndex);
if (isArrayIndex && i < d->numArguments) {
if (!d->deletedArguments) {
d->deletedArguments.set(new bool[d->numArguments]);
diff --git a/JavaScriptCore/runtime/DateConversion.cpp b/JavaScriptCore/runtime/DateConversion.cpp
index 70dbaa0..b66b088 100644
--- a/JavaScriptCore/runtime/DateConversion.cpp
+++ b/JavaScriptCore/runtime/DateConversion.cpp
@@ -56,7 +56,7 @@ double parseDate(ExecState* exec, const UString &date)
{
if (date == exec->globalData().cachedDateString)
return exec->globalData().cachedDateStringValue;
- double value = parseDateFromNullTerminatedCharacters(exec, date.UTF8String().data());
+ double value = parseDateFromNullTerminatedCharacters(exec, date.utf8().data());
exec->globalData().cachedDateString = date;
exec->globalData().cachedDateStringValue = value;
return value;
diff --git a/JavaScriptCore/runtime/Identifier.h b/JavaScriptCore/runtime/Identifier.h
index 25535a4..e24f1b4 100644
--- a/JavaScriptCore/runtime/Identifier.h
+++ b/JavaScriptCore/runtime/Identifier.h
@@ -44,9 +44,6 @@ namespace JSC {
Identifier(JSGlobalData* globalData, StringImpl* rep) : m_string(add(globalData, rep)) { }
Identifier(JSGlobalData* globalData, const UString& s) : m_string(add(globalData, s.impl())) { }
- // Special constructor for cases where we overwrite an object in place.
- Identifier(PlacementNewAdoptType) : m_string(PlacementNewAdopt) { }
-
const UString& ustring() const { return m_string; }
StringImpl* impl() const { return m_string.impl(); }
@@ -68,7 +65,6 @@ namespace JSC {
uint32_t toUInt32(bool* ok) const { return m_string.toUInt32(ok); }
uint32_t toUInt32(bool* ok, bool tolerateEmptyString) const { return m_string.toUInt32(ok, tolerateEmptyString); };
uint32_t toStrictUInt32(bool* ok) const { return m_string.toStrictUInt32(ok); }
- unsigned toArrayIndex(bool* ok) const { return m_string.toArrayIndex(ok); }
double toDouble() const { return m_string.toDouble(); }
friend bool operator==(const Identifier&, const Identifier&);
diff --git a/JavaScriptCore/runtime/JSArray.cpp b/JavaScriptCore/runtime/JSArray.cpp
index 0db0a63..ffb8d9e 100644
--- a/JavaScriptCore/runtime/JSArray.cpp
+++ b/JavaScriptCore/runtime/JSArray.cpp
@@ -273,7 +273,7 @@ bool JSArray::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName
}
bool isArrayIndex;
- unsigned i = propertyName.toArrayIndex(&isArrayIndex);
+ unsigned i = toArrayIndex(propertyName.ustring(), &isArrayIndex);
if (isArrayIndex)
return JSArray::getOwnPropertySlot(exec, i, slot);
@@ -290,7 +290,7 @@ bool JSArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& proper
ArrayStorage* storage = m_storage;
bool isArrayIndex;
- unsigned i = propertyName.toArrayIndex(&isArrayIndex);
+ unsigned i = toArrayIndex(propertyName.ustring(), &isArrayIndex);
if (isArrayIndex) {
if (i >= storage->m_length)
return false;
@@ -317,7 +317,7 @@ bool JSArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& proper
void JSArray::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot)
{
bool isArrayIndex;
- unsigned i = propertyName.toArrayIndex(&isArrayIndex);
+ unsigned i = toArrayIndex(propertyName.ustring(), &isArrayIndex);
if (isArrayIndex) {
put(exec, i, value);
return;
@@ -475,7 +475,7 @@ NEVER_INLINE void JSArray::putSlowCase(ExecState* exec, unsigned i, JSValue valu
bool JSArray::deleteProperty(ExecState* exec, const Identifier& propertyName)
{
bool isArrayIndex;
- unsigned i = propertyName.toArrayIndex(&isArrayIndex);
+ unsigned i = toArrayIndex(propertyName.ustring(), &isArrayIndex);
if (isArrayIndex)
return deleteProperty(exec, i);
diff --git a/JavaScriptCore/runtime/JSArray.h b/JavaScriptCore/runtime/JSArray.h
index f8a7d81..b72a285 100644
--- a/JavaScriptCore/runtime/JSArray.h
+++ b/JavaScriptCore/runtime/JSArray.h
@@ -261,7 +261,17 @@ namespace JSC {
markChildren(m_values.removeLast());
}
}
-
+
+ // Rule from ECMA 15.2 about what an array index is.
+ // Must exactly match string form of an unsigned integer, and be less than 2^32 - 1.
+ inline unsigned toArrayIndex(const UString& string, bool* ok)
+ {
+ unsigned i = string.toStrictUInt32(ok);
+ if (ok && i >= 0xFFFFFFFFU)
+ *ok = false;
+ return i;
+ }
+
} // namespace JSC
#endif // JSArray_h
diff --git a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
index 5b111fa..e72d342 100644
--- a/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp
@@ -53,7 +53,7 @@ namespace JSC {
static JSValue encode(ExecState* exec, const char* doNotEscape)
{
UString str = exec->argument(0).toString(exec);
- CString cstr = str.UTF8String(true);
+ CString cstr = str.utf8(true);
if (!cstr.data())
return throwError(exec, createURIError(exec, "String contained an illegal UTF-16 sequence."));
@@ -265,9 +265,9 @@ static double parseInt(const UString& s, int radix)
if (number >= mantissaOverflowLowerBound) {
if (radix == 10)
- number = WTF::strtod(s.substr(firstDigitPosition, p - firstDigitPosition).UTF8String().data(), 0);
+ number = WTF::strtod(s.substr(firstDigitPosition, p - firstDigitPosition).utf8().data(), 0);
else if (radix == 2 || radix == 4 || radix == 8 || radix == 16 || radix == 32)
- number = parseIntOverflow(s.substr(firstDigitPosition, p - firstDigitPosition).UTF8String().data(), p - firstDigitPosition, radix);
+ number = parseIntOverflow(s.substr(firstDigitPosition, p - firstDigitPosition).utf8().data(), p - firstDigitPosition, radix);
}
if (!sawDigit)
@@ -453,7 +453,7 @@ EncodedJSValue JSC_HOST_CALL globalFuncUnescape(ExecState* exec)
#ifndef NDEBUG
EncodedJSValue JSC_HOST_CALL globalFuncJSCPrint(ExecState* exec)
{
- CString string = exec->argument(0).toString(exec).UTF8String();
+ CString string = exec->argument(0).toString(exec).utf8();
puts(string.data());
return JSValue::encode(jsUndefined());
}
diff --git a/JavaScriptCore/runtime/JSString.h b/JavaScriptCore/runtime/JSString.h
index 499da89..898201d 100644
--- a/JavaScriptCore/runtime/JSString.h
+++ b/JavaScriptCore/runtime/JSString.h
@@ -191,7 +191,7 @@ namespace JSC {
, m_fiberCount(0)
{
ASSERT(!m_value.isNull());
- Heap::heap(this)->reportExtraMemoryCost(value.cost());
+ Heap::heap(this)->reportExtraMemoryCost(value.impl()->cost());
}
enum HasOtherOwnerType { HasOtherOwner };
@@ -308,7 +308,7 @@ namespace JSC {
// nasty hack because we can't union non-POD types
m_other.m_finalizerCallback = finalizer;
m_other.m_finalizerContext = context;
- Heap::heap(this)->reportExtraMemoryCost(value.cost());
+ Heap::heap(this)->reportExtraMemoryCost(value.impl()->cost());
}
~JSString()
diff --git a/JavaScriptCore/runtime/UString.cpp b/JavaScriptCore/runtime/UString.cpp
index ee7e242..a06fd04 100644
--- a/JavaScriptCore/runtime/UString.cpp
+++ b/JavaScriptCore/runtime/UString.cpp
@@ -257,17 +257,6 @@ double UString::toDouble(bool tolerateTrailingJunk, bool tolerateEmptyString) co
return NaN;
}
- // FIXME: If tolerateTrailingJunk is true, then we want to tolerate junk
- // after the number, even if it contains invalid UTF-16 sequences. So we
- // shouldn't use the UTF8String function, which returns null when it
- // encounters invalid UTF-16. Further, we have no need to convert the
- // non-ASCII characters to UTF-8, so the UTF8String does quite a bit of
- // unnecessary work.
-
- // FIXME: The space skipping code below skips only ASCII spaces, but callers
- // need to skip all StrWhiteSpace. The isStrWhiteSpace function does the
- // right thing but requires UChar, not char, for its argument.
-
const UChar* data = this->characters();
const UChar* end = data + size;
@@ -594,20 +583,56 @@ bool operator>(const UString& s1, const UString& s2)
return (l1 > l2);
}
-CString UString::UTF8String(bool strict) const
+// Helper to write a three-byte UTF-8 code point to the buffer, caller must check room is available.
+static inline void putUTF8Triple(char*& buffer, UChar ch)
{
- // Allocate a buffer big enough to hold all the characters.
- const unsigned len = length();
- Vector<char, 1024> buffer(len * 3);
-
- // Convert to runs of 8-bit characters.
- char* p = buffer.data();
- const UChar* d = reinterpret_cast<const UChar*>(&characters()[0]);
- ConversionResult result = convertUTF16ToUTF8(&d, d + len, &p, p + buffer.size(), strict);
- if (result != conversionOK)
+ ASSERT(ch >= 0x0800);
+ *buffer++ = static_cast<char>(((ch >> 12) & 0x0F) | 0xE0);
+ *buffer++ = static_cast<char>(((ch >> 6) & 0x3F) | 0x80);
+ *buffer++ = static_cast<char>((ch & 0x3F) | 0x80);
+}
+
+CString UString::utf8(bool strict) const
+{
+ unsigned length = this->length();
+ const UChar* characters = this->characters();
+
+ // Allocate a buffer big enough to hold all the characters
+ // (an individual UTF-16 UChar can only expand to 3 UTF-8 bytes).
+ // Optimization ideas, if we find this function is hot:
+ // * We could speculatively create a CStringBuffer to contain 'length'
+ // characters, and resize if necessary (i.e. if the buffer contains
+ // non-ascii characters). (Alternatively, scan the buffer first for
+ // ascii characters, so we know this will be sufficient).
+ // * We could allocate a CStringBuffer with an appropriate size to
+ // have a good chance of being able to write the string into the
+ // buffer without reallocing (say, 1.5 x length).
+ Vector<char, 1024> bufferVector(length * 3);
+
+ char* buffer = bufferVector.data();
+ ConversionResult result = convertUTF16ToUTF8(&characters, characters + length, &buffer, buffer + bufferVector.size(), strict);
+ ASSERT(result != targetExhausted); // (length * 3) should be sufficient for any conversion
+
+ // Only produced from strict conversion.
+ if (result == sourceIllegal)
return CString();
- return CString(buffer.data(), p - buffer.data());
+ // Check for an unconverted high surrogate.
+ if (result == sourceExhausted) {
+ if (strict)
+ return CString();
+ // This should be one unpaired high surrogate. Treat it the same
+ // was as an unpaired high surrogate would have been handled in
+ // the middle of a string with non-strict conversion - which is
+ // to say, simply encode it to UTF-8.
+ ASSERT((characters + 1) == (this->characters() + length));
+ ASSERT((*characters >= 0xD800) && (*characters <= 0xDBFF));
+ // There should be room left, since one UChar hasn't been converted.
+ ASSERT((buffer + 3) <= (buffer + bufferVector.size()));
+ putUTF8Triple(buffer, *characters);
+ }
+
+ return CString(bufferVector.data(), buffer - bufferVector.data());
}
} // namespace JSC
diff --git a/JavaScriptCore/runtime/UString.h b/JavaScriptCore/runtime/UString.h
index 1b6c33e..8d1b5c2 100644
--- a/JavaScriptCore/runtime/UString.h
+++ b/JavaScriptCore/runtime/UString.h
@@ -38,9 +38,6 @@
namespace JSC {
-using WTF::PlacementNewAdoptType;
-using WTF::PlacementNewAdopt;
-
class UString {
public:
// Construct a null string, distinguishable from an empty string.
@@ -63,30 +60,18 @@ public:
UString(PassRefPtr<StringImpl> impl) : m_impl(impl) { }
UString(RefPtr<StringImpl> impl) : m_impl(impl) { }
+ // Inline the destructor.
+ ALWAYS_INLINE ~UString() { }
+
void swap(UString& o) { m_impl.swap(o.m_impl); }
template<size_t inlineCapacity>
static UString adopt(Vector<UChar, inlineCapacity>& vector) { return StringImpl::adopt(vector); }
- static UString number(int);
- static UString number(long long);
- static UString number(unsigned);
- static UString number(long);
- static UString number(double);
-
- // NOTE: This method should only be used for *debugging* purposes as it
- // is neither Unicode safe nor free from side effects nor thread-safe.
- char* ascii() const;
+ bool isNull() const { return !m_impl; }
+ bool isEmpty() const { return !m_impl || !m_impl->length(); }
- /**
- * Convert the string to UTF-8, assuming it is UTF-16 encoded.
- * In non-strict mode, this function is tolerant of badly formed UTF-16, it
- * can create UTF-8 strings that are invalid because they have characters in
- * the range U+D800-U+DDFF, U+FFFE, or U+FFFF, but the UTF-8 string is
- * guaranteed to be otherwise valid.
- * In strict mode, error is returned as null CString.
- */
- CString UTF8String(bool strict = false) const;
+ StringImpl* impl() const { return m_impl.get(); }
unsigned length() const
{
@@ -102,6 +87,8 @@ public:
return m_impl->characters();
}
+ CString utf8(bool strict = false) const;
+
UChar operator[](unsigned index) const
{
if (!m_impl || index >= m_impl->length())
@@ -109,6 +96,14 @@ public:
return m_impl->characters()[index];
}
+ static UString number(int);
+ static UString number(unsigned);
+ static UString number(long);
+ static UString number(long long);
+ static UString number(double);
+
+
+
double toDouble(bool tolerateTrailingJunk, bool tolerateEmptyString) const;
double toDouble(bool tolerateTrailingJunk) const;
double toDouble() const;
@@ -117,8 +112,6 @@ public:
uint32_t toUInt32(bool* ok, bool tolerateEmptyString) const;
uint32_t toStrictUInt32(bool* ok = 0) const;
- unsigned toArrayIndex(bool* ok = 0) const;
-
static const unsigned NotFound = 0xFFFFFFFFu;
unsigned find(const UString& f, unsigned pos = 0) const;
unsigned find(UChar, unsigned pos = 0) const;
@@ -127,19 +120,10 @@ public:
UString substr(unsigned pos = 0, unsigned len = 0xFFFFFFFF) const;
- bool isNull() const { return !m_impl; }
- bool isEmpty() const { return !m_impl || !m_impl->length(); }
-
- StringImpl* impl() const { return m_impl.get(); }
-
- size_t cost() const
- {
- if (!m_impl)
- return 0;
- return m_impl->cost();
- }
+ // NOTE: This method should only be used for *debugging* purposes as it
+ // is neither Unicode safe nor free from side effects nor thread-safe.
+ char* ascii() const;
- ALWAYS_INLINE ~UString() { }
private:
RefPtr<StringImpl> m_impl;
};
@@ -217,16 +201,6 @@ inline int codePointCompare(const UString& s1, const UString& s2)
return codePointCompare(s1.impl(), s2.impl());
}
-// Rule from ECMA 15.2 about what an array index is.
-// Must exactly match string form of an unsigned integer, and be less than 2^32 - 1.
-inline unsigned UString::toArrayIndex(bool* ok) const
-{
- unsigned i = toStrictUInt32(ok);
- if (ok && i >= 0xFFFFFFFFU)
- *ok = false;
- return i;
-}
-
// We'd rather not do shared substring append for small strings, since
// this runs too much risk of a tiny initial string holding down a
// huge buffer.
diff --git a/JavaScriptCore/wtf/text/WTFString.cpp b/JavaScriptCore/wtf/text/WTFString.cpp
index 901a121..94b95c5 100644
--- a/JavaScriptCore/wtf/text/WTFString.cpp
+++ b/JavaScriptCore/wtf/text/WTFString.cpp
@@ -654,7 +654,7 @@ static inline void putUTF8Triple(char*& buffer, UChar ch)
*buffer++ = static_cast<char>((ch & 0x3F) | 0x80);
}
-CString String::utf8() const
+CString String::utf8(bool strict) const
{
unsigned length = this->length();
const UChar* characters = this->characters();
@@ -672,15 +672,21 @@ CString String::utf8() const
Vector<char, 1024> bufferVector(length * 3);
char* buffer = bufferVector.data();
- ConversionResult result = convertUTF16ToUTF8(&characters, characters + length, &buffer, buffer + bufferVector.size(), false);
- ASSERT(result != sourceIllegal); // Only produced from strict conversion.
+ ConversionResult result = convertUTF16ToUTF8(&characters, characters + length, &buffer, buffer + bufferVector.size(), strict);
ASSERT(result != targetExhausted); // (length * 3) should be sufficient for any conversion
- // If a high surrogate is left unconverted, treat it the same was as an unpaired high surrogate
- // would have been handled in the middle of a string with non-strict conversion - which is to say,
- // simply encode it to UTF-8.
+ // Only produced from strict conversion.
+ if (result == sourceIllegal)
+ return CString();
+
+ // Check for an unconverted high surrogate.
if (result == sourceExhausted) {
- // This should be one unpaired high surrogate.
+ if (strict)
+ return CString();
+ // This should be one unpaired high surrogate. Treat it the same
+ // was as an unpaired high surrogate would have been handled in
+ // the middle of a string with non-strict conversion - which is
+ // to say, simply encode it to UTF-8.
ASSERT((characters + 1) == (this->characters() + length));
ASSERT((*characters >= 0xD800) && (*characters <= 0xDBFF));
// There should be room left, since one UChar hasn't been converted.
diff --git a/JavaScriptCore/wtf/text/WTFString.h b/JavaScriptCore/wtf/text/WTFString.h
index bd30eed..f79cc5d 100644
--- a/JavaScriptCore/wtf/text/WTFString.h
+++ b/JavaScriptCore/wtf/text/WTFString.h
@@ -97,18 +97,21 @@ public:
String(PassRefPtr<StringImpl> impl) : m_impl(impl) { }
String(RefPtr<StringImpl> impl) : m_impl(impl) { }
- void swap(String& o) { m_impl.swap(o.m_impl); }
+ // Inline the destructor.
+ ALWAYS_INLINE ~String() { }
- // Hash table deleted values, which are only constructed and never copied or destroyed.
- String(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue) { }
- bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue(); }
+ void swap(String& o) { m_impl.swap(o.m_impl); }
static String adopt(StringBuffer& buffer) { return StringImpl::adopt(buffer); }
template<size_t inlineCapacity>
static String adopt(Vector<UChar, inlineCapacity>& vector) { return StringImpl::adopt(vector); }
+ bool isNull() const { return !m_impl; }
+ bool isEmpty() const { return !m_impl || !m_impl->length(); }
+
+ StringImpl* impl() const { return m_impl.get(); }
- ALWAYS_INLINE unsigned length() const
+ unsigned length() const
{
if (!m_impl)
return 0;
@@ -122,14 +125,30 @@ public:
return m_impl->characters();
}
- const UChar* charactersWithNullTermination();
-
+ CString latin1() const;
+ CString utf8(bool strict = false) const;
+
UChar operator[](unsigned index) const
{
if (!m_impl || index >= m_impl->length())
return 0;
return m_impl->characters()[index];
}
+
+ static String number(short);
+ static String number(unsigned short);
+ static String number(int);
+ static String number(unsigned);
+ static String number(long);
+ static String number(unsigned long);
+ static String number(long long);
+ static String number(unsigned long long);
+ static String number(double);
+
+
+
+ const UChar* charactersWithNullTermination();
+
UChar32 characterStartingAt(unsigned) const; // Ditto.
bool contains(UChar c) const { return find(c) != -1; }
@@ -190,16 +209,6 @@ public:
// Return the string with case folded for case insensitive comparison.
String foldCase() const;
- static String number(short);
- static String number(unsigned short);
- static String number(int);
- static String number(unsigned);
- static String number(long);
- static String number(unsigned long);
- static String number(long long);
- static String number(unsigned long long);
- static String number(double);
-
#if !PLATFORM(QT)
static String format(const char *, ...) WTF_ATTRIBUTE_PRINTF(1, 2);
#else
@@ -240,11 +249,6 @@ public:
// to ever prefer copy() over plain old assignment.
String threadsafeCopy() const;
- bool isNull() const { return !m_impl; }
- ALWAYS_INLINE bool isEmpty() const { return !m_impl || !m_impl->length(); }
-
- StringImpl* impl() const { return m_impl.get(); }
-
#if PLATFORM(CF)
String(CFStringRef);
CFStringRef createCFString() const;
@@ -276,9 +280,6 @@ public:
Vector<char> ascii() const;
- CString latin1() const;
- CString utf8() const;
-
static String fromUTF8(const char*, size_t);
static String fromUTF8(const char*);
@@ -290,6 +291,10 @@ public:
bool containsOnlyASCII() const { return charactersAreAllASCII(characters(), length()); }
+ // Hash table deleted values, which are only constructed and never copied or destroyed.
+ String(WTF::HashTableDeletedValueType) : m_impl(WTF::HashTableDeletedValue) { }
+ bool isHashTableDeletedValue() const { return m_impl.isHashTableDeletedValue(); }
+
private:
RefPtr<StringImpl> m_impl;
};
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 6c27ce0..1047162 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,49 @@
+2010-08-13 Gavin Barraclough <barraclough at apple.com>
+
+ Reviewed by Sam Weinig
+
+ Unify UString::UTF8String() & String::utf8() methods,
+ remove UString::cost() & make atArrayIndex a free function.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::JSDOMWindow::getOwnPropertySlot):
+ (WebCore::JSDOMWindow::getOwnPropertyDescriptor):
+ * bridge/NP_jsobject.cpp:
+ (_NPN_Enumerate):
+ * bridge/c/c_utility.cpp:
+ (JSC::Bindings::convertValueToNPVariant):
+ * bridge/jni/JNIBridge.cpp:
+ (JavaParameter::JavaParameter):
+ (JavaMethod::JavaMethod):
+ (JavaMethod::signature):
+ (JavaMethod::methodID):
+ * bridge/jni/JNIBridge.h:
+ (JSC::Bindings::JavaString::utf8):
+ (JSC::Bindings::JavaParameter::type):
+ (JSC::Bindings::JavaMethod::returnType):
+ * bridge/jni/jni_jsobject.mm:
+ (JavaJSObject::call):
+ (JavaJSObject::eval):
+ (JavaJSObject::getMember):
+ (JavaJSObject::setMember):
+ (JavaJSObject::removeMember):
+ (JavaJSObject::convertJObjectToValue):
+ * bridge/jni/jsc/JNIBridgeJSC.cpp:
+ (JavaField::JavaField):
+ (JavaField::valueFromInstance):
+ (JavaField::setValueToInstance):
+ * bridge/jni/jsc/JNIBridgeJSC.h:
+ (JSC::Bindings::JavaField::type):
+ * bridge/jni/jsc/JavaInstanceJSC.cpp:
+ (JavaInstance::invokeMethod):
+ * bridge/jni/jsc/JavaStringJSC.h:
+ (JSC::Bindings::JavaStringImpl::utf8):
+ * bridge/runtime_array.cpp:
+ (JSC::RuntimeArray::getOwnPropertySlot):
+ (JSC::RuntimeArray::getOwnPropertyDescriptor):
+ (JSC::RuntimeArray::put):
+
2010-08-12 Yury Semikhatsky <yurys at chromium.org>
Reviewed by Pavel Feldman.
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index a67ad33..fc57f31 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -271,7 +271,7 @@ bool JSDOMWindow::getOwnPropertySlot(ExecState* exec, const Identifier& property
// allow window[1] or parent[1] etc. (#56983)
bool ok;
- unsigned i = propertyName.toArrayIndex(&ok);
+ unsigned i = toArrayIndex(propertyName.ustring(), &ok);
if (ok && i < impl()->frame()->tree()->childCount()) {
slot.setCustomIndex(this, i, indexGetter);
return true;
@@ -345,7 +345,7 @@ bool JSDOMWindow::getOwnPropertyDescriptor(ExecState* exec, const Identifier& pr
}
bool ok;
- unsigned i = propertyName.toArrayIndex(&ok);
+ unsigned i = toArrayIndex(propertyName.ustring(), &ok);
if (ok && i < impl()->frame()->tree()->childCount()) {
PropertySlot slot;
slot.setCustomIndex(this, i, indexGetter);
diff --git a/WebCore/bridge/NP_jsobject.cpp b/WebCore/bridge/NP_jsobject.cpp
index d454c74..17270eb 100644
--- a/WebCore/bridge/NP_jsobject.cpp
+++ b/WebCore/bridge/NP_jsobject.cpp
@@ -474,7 +474,7 @@ bool _NPN_Enumerate(NPP, NPObject* o, NPIdentifier** identifier, uint32_t* count
NPIdentifier* identifiers = static_cast<NPIdentifier*>(malloc(sizeof(NPIdentifier) * size));
for (unsigned i = 0; i < size; ++i)
- identifiers[i] = _NPN_GetStringIdentifier(propertyNames[i].ustring().UTF8String().data());
+ identifiers[i] = _NPN_GetStringIdentifier(propertyNames[i].ustring().utf8().data());
*identifier = identifiers;
*count = size;
diff --git a/WebCore/bridge/c/c_utility.cpp b/WebCore/bridge/c/c_utility.cpp
index 443ecca..b160f9f 100644
--- a/WebCore/bridge/c/c_utility.cpp
+++ b/WebCore/bridge/c/c_utility.cpp
@@ -74,7 +74,7 @@ void convertValueToNPVariant(ExecState* exec, JSValue value, NPVariant* result)
if (value.isString()) {
UString ustring = value.toString(exec);
- CString cstring = ustring.UTF8String();
+ CString cstring = ustring.utf8();
NPString string = { (const NPUTF8*)cstring.data(), static_cast<uint32_t>(cstring.length()) };
NPN_InitializeVariantWithStringCopy(result, &string);
} else if (value.isNumber()) {
diff --git a/WebCore/bridge/jni/JNIBridge.cpp b/WebCore/bridge/jni/JNIBridge.cpp
index 35a0d34..8fa2678 100644
--- a/WebCore/bridge/jni/JNIBridge.cpp
+++ b/WebCore/bridge/jni/JNIBridge.cpp
@@ -41,7 +41,7 @@ using namespace WebCore;
JavaParameter::JavaParameter(JNIEnv* env, jstring type)
{
m_type = JavaString(env, type);
- m_JNIType = JNITypeFromClassName(m_type.UTF8String());
+ m_JNIType = JNITypeFromClassName(m_type.utf8());
}
JavaMethod::JavaMethod(JNIEnv* env, jobject aMethod)
@@ -55,7 +55,7 @@ JavaMethod::JavaMethod(JNIEnv* env, jobject aMethod)
env->DeleteLocalRef(returnType);
}
m_returnType = JavaString(env, returnTypeName);
- m_JNIReturnType = JNITypeFromClassName(m_returnType.UTF8String());
+ m_JNIReturnType = JNITypeFromClassName(m_returnType.utf8());
env->DeleteLocalRef(returnTypeName);
// Get method name
@@ -148,7 +148,7 @@ const char* JavaMethod::signature() const
}
signatureBuilder.append(")");
- const char* returnType = m_returnType.UTF8String();
+ const char* returnType = m_returnType.utf8();
if (m_JNIReturnType == array_type)
appendClassName(signatureBuilder, returnType);
else {
@@ -174,7 +174,7 @@ JNIType JavaMethod::JNIReturnType() const
jmethodID JavaMethod::methodID(jobject obj) const
{
if (!m_methodID)
- m_methodID = getMethodID(obj, m_name.UTF8String(), signature());
+ m_methodID = getMethodID(obj, m_name.utf8(), signature());
return m_methodID;
}
diff --git a/WebCore/bridge/jni/JNIBridge.h b/WebCore/bridge/jni/JNIBridge.h
index 78202ae..4f5e6b7 100644
--- a/WebCore/bridge/jni/JNIBridge.h
+++ b/WebCore/bridge/jni/JNIBridge.h
@@ -61,7 +61,7 @@ public:
m_impl.init(getJNIEnv(), s);
}
- const char* UTF8String() const { return m_impl.UTF8String(); }
+ const char* utf8() const { return m_impl.utf8(); }
const jchar* uchars() const { return m_impl.uchars(); }
int length() const { return m_impl.length(); }
#if USE(JSC)
@@ -78,7 +78,7 @@ public:
JavaParameter(JNIEnv*, jstring type);
virtual ~JavaParameter() { }
- RuntimeType type() const { return m_type.UTF8String(); }
+ RuntimeType type() const { return m_type.utf8(); }
JNIType getJNIType() const { return m_JNIType; }
private:
@@ -92,7 +92,7 @@ public:
~JavaMethod();
const JavaString& name() const { return m_name; }
- RuntimeType returnType() const { return m_returnType.UTF8String(); }
+ RuntimeType returnType() const { return m_returnType.utf8(); }
JavaParameter* parameterAt(int i) const { return &m_parameters[i]; }
int numParameters() const { return m_numParameters; }
diff --git a/WebCore/bridge/jni/jni_jsobject.mm b/WebCore/bridge/jni/jni_jsobject.mm
index 4406c3c..d7d3a54 100644
--- a/WebCore/bridge/jni/jni_jsobject.mm
+++ b/WebCore/bridge/jni/jni_jsobject.mm
@@ -276,7 +276,7 @@ RootObject* JavaJSObject::rootObject() const
jobject JavaJSObject::call(jstring methodName, jobjectArray args) const
{
- LOG(LiveConnect, "JavaJSObject::call methodName = %s", JavaString(methodName).UTF8String());
+ LOG(LiveConnect, "JavaJSObject::call methodName = %s", JavaString(methodName).utf8());
RootObject* rootObject = this->rootObject();
if (!rootObject)
@@ -305,7 +305,7 @@ jobject JavaJSObject::call(jstring methodName, jobjectArray args) const
jobject JavaJSObject::eval(jstring script) const
{
- LOG(LiveConnect, "JavaJSObject::eval script = %s", JavaString(script).UTF8String());
+ LOG(LiveConnect, "JavaJSObject::eval script = %s", JavaString(script).utf8());
JSValue result;
@@ -332,7 +332,7 @@ jobject JavaJSObject::eval(jstring script) const
jobject JavaJSObject::getMember(jstring memberName) const
{
- LOG(LiveConnect, "JavaJSObject::getMember (%p) memberName = %s", _imp, JavaString(memberName).UTF8String());
+ LOG(LiveConnect, "JavaJSObject::getMember (%p) memberName = %s", _imp, JavaString(memberName).utf8());
RootObject* rootObject = this->rootObject();
if (!rootObject)
@@ -348,7 +348,7 @@ jobject JavaJSObject::getMember(jstring memberName) const
void JavaJSObject::setMember(jstring memberName, jobject value) const
{
- LOG(LiveConnect, "JavaJSObject::setMember memberName = %s, value = %p", JavaString(memberName).UTF8String(), value);
+ LOG(LiveConnect, "JavaJSObject::setMember memberName = %s, value = %p", JavaString(memberName).utf8(), value);
RootObject* rootObject = this->rootObject();
if (!rootObject)
@@ -364,7 +364,7 @@ void JavaJSObject::setMember(jstring memberName, jobject value) const
void JavaJSObject::removeMember(jstring memberName) const
{
- LOG(LiveConnect, "JavaJSObject::removeMember memberName = %s", JavaString(memberName).UTF8String());
+ LOG(LiveConnect, "JavaJSObject::removeMember memberName = %s", JavaString(memberName).utf8());
RootObject* rootObject = this->rootObject();
if (!rootObject)
@@ -572,7 +572,7 @@ JSValue JavaJSObject::convertJObjectToValue(ExecState* exec, jobject theObject)
// created above to wrap internal browser objects. The constructor of this class takes the native
// pointer and stores it in this object, so that it can be retrieved below.
jstring className = (jstring)callJNIMethod<jobject>(classOfInstance, "getName", "()Ljava/lang/String;");
- if (!className || (strcmp(JavaString(className).UTF8String(), "sun.plugin.javascript.webkit.JSObject") != 0)) {
+ if (!className || (strcmp(JavaString(className).utf8(), "sun.plugin.javascript.webkit.JSObject") != 0)) {
JSLock lock(SilenceAssertionsOnly);
return JavaInstance::create(theObject, _rootObject)->createRuntimeObject(exec);
}
diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp
index d5dc1cb..966d946 100644
--- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp
+++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.cpp
@@ -49,7 +49,7 @@ JavaField::JavaField(JNIEnv* env, jobject aField)
fieldTypeName = env->NewStringUTF("<Unknown>");
m_type = JavaString(env, fieldTypeName);
- m_JNIType = JNITypeFromClassName(m_type.UTF8String());
+ m_JNIType = JNITypeFromClassName(m_type.utf8());
// Get field name
jstring fieldName = static_cast<jstring>(callJNIMethod<jobject>(aField, "getName", "()Ljava/lang/String;"));
@@ -150,7 +150,7 @@ JSValue JavaField::valueFromInstance(ExecState* exec, const Instance* i) const
break;
}
- LOG(LiveConnect, "JavaField::valueFromInstance getting %s = %s", UString(name()).UTF8String().data(), jsresult.toString(exec).ascii());
+ LOG(LiveConnect, "JavaField::valueFromInstance getting %s = %s", UString(name()).utf8().data(), jsresult.toString(exec).ascii());
return jsresult;
}
@@ -186,7 +186,7 @@ void JavaField::setValueToInstance(ExecState* exec, const Instance* i, JSValue a
const JavaInstance* instance = static_cast<const JavaInstance*>(i);
jvalue javaValue = convertValueToJValue(exec, i->rootObject(), aValue, m_JNIType, type());
- LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name()).UTF8String().data(), aValue.toString(exec).ascii());
+ LOG(LiveConnect, "JavaField::setValueToInstance setting value %s to %s", UString(name()).utf8().data(), aValue.toString(exec).ascii());
switch (m_JNIType) {
case array_type:
diff --git a/WebCore/bridge/jni/jsc/JNIBridgeJSC.h b/WebCore/bridge/jni/jsc/JNIBridgeJSC.h
index dd65417..afb1bce 100644
--- a/WebCore/bridge/jni/jsc/JNIBridgeJSC.h
+++ b/WebCore/bridge/jni/jsc/JNIBridgeJSC.h
@@ -45,7 +45,7 @@ public:
virtual void setValueToInstance(ExecState*, const Instance*, JSValue) const;
const JavaString& name() const { return m_name; }
- virtual RuntimeType type() const { return m_type.UTF8String(); }
+ virtual RuntimeType type() const { return m_type.utf8(); }
JNIType getJNIType() const { return m_JNIType; }
diff --git a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
index 88186c5..699dd8e 100644
--- a/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
+++ b/WebCore/bridge/jni/jsc/JavaInstanceJSC.cpp
@@ -162,7 +162,7 @@ JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod
}
const JavaMethod* jMethod = static_cast<const JavaMethod*>(method);
- LOG(LiveConnect, "JavaInstance::invokeMethod call %s %s on %p", UString(jMethod->name()).UTF8String().data(), jMethod->signature(), m_instance->m_instance);
+ LOG(LiveConnect, "JavaInstance::invokeMethod call %s %s on %p", UString(jMethod->name()).utf8().data(), jMethod->signature(), m_instance->m_instance);
Vector<jvalue> jArgs(count);
@@ -253,7 +253,7 @@ JSValue JavaInstance::invokeMethod(ExecState* exec, RuntimeMethod* runtimeMethod
else {
jobject classOfInstance = callJNIMethod<jobject>(result.l, "getClass", "()Ljava/lang/Class;");
jstring className = static_cast<jstring>(callJNIMethod<jobject>(classOfInstance, "getName", "()Ljava/lang/String;"));
- if (!strcmp(JavaString(className).UTF8String(), "sun.plugin.javascript.webkit.JSObject")) {
+ if (!strcmp(JavaString(className).utf8(), "sun.plugin.javascript.webkit.JSObject")) {
// Pull the nativeJSObject value from the Java instance. This is a pointer to the JSObject.
JNIEnv* env = getJNIEnv();
jfieldID fieldID = env->GetFieldID(static_cast<jclass>(classOfInstance), "nativeJSObject", "J");
diff --git a/WebCore/bridge/jni/jsc/JavaStringJSC.h b/WebCore/bridge/jni/jsc/JavaStringJSC.h
index 290c81a..cf575b2 100644
--- a/WebCore/bridge/jni/jsc/JavaStringJSC.h
+++ b/WebCore/bridge/jni/jsc/JavaStringJSC.h
@@ -60,11 +60,11 @@ public:
releaseUCharactersForJStringInEnv(e, s, uc);
}
- const char* UTF8String() const
+ const char* utf8() const
{
if (!m_utf8String.data()) {
JSLock lock(SilenceAssertionsOnly);
- m_utf8String = UString(m_impl).UTF8String();
+ m_utf8String = UString(m_impl).utf8();
}
return m_utf8String.data();
}
diff --git a/WebCore/bridge/runtime_array.cpp b/WebCore/bridge/runtime_array.cpp
index 2cd7d66..41627b8 100644
--- a/WebCore/bridge/runtime_array.cpp
+++ b/WebCore/bridge/runtime_array.cpp
@@ -82,7 +82,7 @@ bool RuntimeArray::getOwnPropertySlot(ExecState* exec, const Identifier& propert
}
bool ok;
- unsigned index = propertyName.toArrayIndex(&ok);
+ unsigned index = toArrayIndex(propertyName.ustring(), &ok);
if (ok) {
if (index < getLength()) {
slot.setCustomIndex(this, index, indexGetter);
@@ -103,7 +103,7 @@ bool RuntimeArray::getOwnPropertyDescriptor(ExecState* exec, const Identifier& p
}
bool ok;
- unsigned index = propertyName.toArrayIndex(&ok);
+ unsigned index = toArrayIndex(propertyName.ustring(), &ok);
if (ok) {
if (index < getLength()) {
PropertySlot slot;
@@ -134,7 +134,7 @@ void RuntimeArray::put(ExecState* exec, const Identifier& propertyName, JSValue
}
bool ok;
- unsigned index = propertyName.toArrayIndex(&ok);
+ unsigned index = toArrayIndex(propertyName.ustring(), &ok);
if (ok) {
getConcreteArray()->setValueAt(exec, index, value);
return;
diff --git a/WebKit/mac/ChangeLog b/WebKit/mac/ChangeLog
index cf7fc0d..2d36a37 100644
--- a/WebKit/mac/ChangeLog
+++ b/WebKit/mac/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-13 Gavin Barraclough <barraclough at apple.com>
+
+ Reviewed by Sam Weinig
+
+ Unify UString::UTF8String() & String::utf8() methods,
+ remove UString::cost() & make atArrayIndex a free function.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::enumerate):
+
2010-08-12 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r65295.
diff --git a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
index 8354c06..cb1d958 100644
--- a/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
+++ b/WebKit/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
@@ -1238,7 +1238,7 @@ bool NetscapePluginInstanceProxy::enumerate(uint32_t objectID, data_t& resultDat
RetainPtr<NSMutableArray*> array(AdoptNS, [[NSMutableArray alloc] init]);
for (unsigned i = 0; i < propertyNames.size(); i++) {
- uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(propertyNames[i].ustring().UTF8String().data()));
+ uint64_t methodName = reinterpret_cast<uint64_t>(_NPN_GetStringIdentifier(propertyNames[i].ustring().utf8().data()));
[array.get() addObject:[NSNumber numberWithLongLong:methodName]];
}
diff --git a/WebKit/wx/ChangeLog b/WebKit/wx/ChangeLog
index 724af83..8454abb 100644
--- a/WebKit/wx/ChangeLog
+++ b/WebKit/wx/ChangeLog
@@ -1,3 +1,13 @@
+2010-08-13 Gavin Barraclough <barraclough at apple.com>
+
+ Reviewed by Sam Weinig
+
+ Unify UString::UTF8String() & String::utf8() methods,
+ remove UString::cost() & make atArrayIndex a free function.
+
+ * WebFrame.cpp:
+ (wxWebFrame::RunScript):
+
2010-08-12 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r65295.
diff --git a/WebKit/wx/WebFrame.cpp b/WebKit/wx/WebFrame.cpp
index 182004b..f9be56f 100644
--- a/WebKit/wx/WebFrame.cpp
+++ b/WebKit/wx/WebFrame.cpp
@@ -233,7 +233,7 @@ wxString wxWebFrame::RunScript(const wxString& javascript)
if (jsEnabled) {
JSC::JSValue result = controller->executeScript(javascript, true).jsValue();
if (result)
- returnValue = wxString(result.toString(m_impl->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()).UTF8String().data(), wxConvUTF8);
+ returnValue = wxString(result.toString(m_impl->frame->script()->globalObject(WebCore::mainThreadNormalWorld())->globalExec()).utf8().data(), wxConvUTF8);
}
}
}
diff --git a/WebKit2/ChangeLog b/WebKit2/ChangeLog
index ec087ac..80bda81 100644
--- a/WebKit2/ChangeLog
+++ b/WebKit2/ChangeLog
@@ -1,3 +1,17 @@
+2010-08-13 Gavin Barraclough <barraclough at apple.com>
+
+ Reviewed by Sam Weinig
+
+ Unify UString::UTF8String() & String::utf8() methods,
+ remove UString::cost() & make atArrayIndex a free function.
+
+ * WebProcess/Plugins/JSNPObject.cpp:
+ (WebKit::npIdentifierFromIdentifier):
+ * WebProcess/Plugins/NPJSObject.cpp:
+ (WebKit::NPJSObject::enumerate):
+ * WebProcess/Plugins/NPRuntimeObjectMap.cpp:
+ (WebKit::NPRuntimeObjectMap::convertJSValueToNPVariant):
+
2010-08-12 Sheriff Bot <webkit.review.bot at gmail.com>
Unreviewed, rolling out r65295.
diff --git a/WebKit2/WebProcess/Plugins/JSNPObject.cpp b/WebKit2/WebProcess/Plugins/JSNPObject.cpp
index bd89b2e..386ed93 100644
--- a/WebKit2/WebProcess/Plugins/JSNPObject.cpp
+++ b/WebKit2/WebProcess/Plugins/JSNPObject.cpp
@@ -43,7 +43,7 @@ namespace WebKit {
static NPIdentifier npIdentifierFromIdentifier(const Identifier& identifier)
{
- return static_cast<NPIdentifier>(IdentifierRep::get(identifier.ustring().UTF8String().data()));
+ return static_cast<NPIdentifier>(IdentifierRep::get(identifier.ustring().utf8().data()));
}
const ClassInfo JSNPObject::s_info = { "NPObject", 0, 0, 0 };
diff --git a/WebKit2/WebProcess/Plugins/NPJSObject.cpp b/WebKit2/WebProcess/Plugins/NPJSObject.cpp
index 2fbb225..fbc8454 100644
--- a/WebKit2/WebProcess/Plugins/NPJSObject.cpp
+++ b/WebKit2/WebProcess/Plugins/NPJSObject.cpp
@@ -242,7 +242,7 @@ bool NPJSObject::enumerate(NPIdentifier** identifiers, uint32_t* identifierCount
NPIdentifier* nameIdentifiers = static_cast<NPIdentifier*>(malloc(sizeof(NPIdentifier) * propertyNames.size()));
for (size_t i = 0; i < propertyNames.size(); ++i)
- nameIdentifiers[i] = static_cast<NPIdentifier>(IdentifierRep::get(propertyNames[i].ustring().UTF8String().data()));
+ nameIdentifiers[i] = static_cast<NPIdentifier>(IdentifierRep::get(propertyNames[i].ustring().utf8().data()));
*identifiers = nameIdentifiers;
*identifierCount = propertyNames.size();
diff --git a/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp b/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp
index bc09333..e0faa5b 100644
--- a/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp
+++ b/WebKit2/WebProcess/Plugins/NPRuntimeObjectMap.cpp
@@ -165,7 +165,7 @@ void NPRuntimeObjectMap::convertJSValueToNPVariant(ExecState* exec, JSValue valu
}
if (value.isString()) {
- CString utf8String = value.toString(exec).UTF8String();
+ CString utf8String = value.toString(exec).utf8();
// This should use NPN_MemAlloc, but we know that it uses malloc under the hood.
char* utf8Characters = static_cast<char*>(malloc(utf8String.length()));
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list