Diff
Modified: trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.cpp (204393 => 204394)
--- trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/_javascript_Core/API/tests/ExecutionTimeLimitTest.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -142,9 +142,9 @@
unsigned timeAfterWatchdogShouldHaveFired = 300 + tierAdjustmentMillis;
StringBuilder scriptBuilder;
- scriptBuilder.append("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
+ scriptBuilder.appendLiteral("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
- scriptBuilder.append(") break; } } foo();");
+ scriptBuilder.appendLiteral(") break; } } foo();");
JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
exception = nullptr;
@@ -178,16 +178,16 @@
unsigned timeAfterWatchdogShouldHaveFired = 300 + tierAdjustmentMillis;
StringBuilder scriptBuilder;
- scriptBuilder.append("var startTime = currentCPUTime();"
+ scriptBuilder.appendLiteral("var startTime = currentCPUTime();"
"function recurse(i) {"
"'use strict';"
"if (i % 1000 === 0) {"
"if (currentCPUTime() - startTime >");
scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
- scriptBuilder.append(" ) { return; }");
- scriptBuilder.append(" }");
- scriptBuilder.append(" return recurse(i + 1); }");
- scriptBuilder.append("recurse(0);");
+ scriptBuilder.appendLiteral(" ) { return; }");
+ scriptBuilder.appendLiteral(" }");
+ scriptBuilder.appendLiteral(" return recurse(i + 1); }");
+ scriptBuilder.appendLiteral("recurse(0);");
JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
exception = nullptr;
@@ -221,9 +221,9 @@
unsigned timeAfterWatchdogShouldHaveFired = 300 + tierAdjustmentMillis;
StringBuilder scriptBuilder;
- scriptBuilder.append("function foo() { var startTime = currentCPUTime(); try { while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
+ scriptBuilder.appendLiteral("function foo() { var startTime = currentCPUTime(); try { while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
- scriptBuilder.append(") break; } } catch(e) { } } foo();");
+ scriptBuilder.appendLiteral(") break; } } catch(e) { } } foo();");
JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
exception = nullptr;
@@ -258,9 +258,9 @@
unsigned timeAfterWatchdogShouldHaveFired = 300 + tierAdjustmentMillis;
StringBuilder scriptBuilder;
- scriptBuilder.append("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
+ scriptBuilder.appendLiteral("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
- scriptBuilder.append(") break; } } foo();");
+ scriptBuilder.appendLiteral(") break; } } foo();");
JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
exception = nullptr;
@@ -295,9 +295,9 @@
unsigned timeAfterWatchdogShouldHaveFired = 300 + tierAdjustmentMillis;
StringBuilder scriptBuilder;
- scriptBuilder.append("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
+ scriptBuilder.appendLiteral("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
scriptBuilder.appendNumber(timeAfterWatchdogShouldHaveFired / 1000.0);
- scriptBuilder.append(") break; } } foo();");
+ scriptBuilder.appendLiteral(") break; } } foo();");
JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
exception = nullptr;
@@ -332,9 +332,9 @@
unsigned maxBusyLoopTime = 750 + tierAdjustmentMillis;
StringBuilder scriptBuilder;
- scriptBuilder.append("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
+ scriptBuilder.appendLiteral("function foo() { var startTime = currentCPUTime(); while (true) { for (var i = 0; i < 1000; i++); if (currentCPUTime() - startTime > ");
scriptBuilder.appendNumber(maxBusyLoopTime / 1000.0); // in seconds.
- scriptBuilder.append(") break; } } foo();");
+ scriptBuilder.appendLiteral(") break; } } foo();");
JSStringRef script = JSStringCreateWithUTF8CString(scriptBuilder.toString().utf8().data());
exception = nullptr;
Modified: trunk/Source/_javascript_Core/API/tests/PingPongStackOverflowTest.cpp (204393 => 204394)
--- trunk/Source/_javascript_Core/API/tests/PingPongStackOverflowTest.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/_javascript_Core/API/tests/PingPongStackOverflowTest.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -56,13 +56,13 @@
result = JSObjectCallAsFunction(context, function, constructor, 1, &possibleValue, exception);
} else {
StringBuilder builder;
- builder.append("dummy.valueOf([0]");
+ builder.appendLiteral("dummy.valueOf([0]");
for (int i = 1; i < 35000; i++) {
- builder.append(", [");
+ builder.appendLiteral(", [");
builder.appendNumber(i);
- builder.append("]");
+ builder.appendLiteral("]");
}
- builder.append(");");
+ builder.appendLiteral(");");
JSStringRef script = JSStringCreateWithUTF8CString(builder.toString().utf8().data());
result = JSEvaluateScript(context, script, NULL, NULL, 1, exception);
Modified: trunk/Source/_javascript_Core/ChangeLog (204393 => 204394)
--- trunk/Source/_javascript_Core/ChangeLog 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/_javascript_Core/ChangeLog 2016-08-12 00:33:47 UTC (rev 204394)
@@ -1,3 +1,22 @@
+2016-08-11 Alex Christensen <[email protected]>
+
+ Use StringBuilder::appendLiteral when possible don't append result of makeString
+ https://bugs.webkit.org/show_bug.cgi?id=160772
+
+ Reviewed by Sam Weinig.
+
+ * API/tests/ExecutionTimeLimitTest.cpp:
+ (testExecutionTimeLimit):
+ * API/tests/PingPongStackOverflowTest.cpp:
+ (PingPongStackOverflowObject_hasInstance):
+ * bytecompiler/NodesCodegen.cpp:
+ (JSC::ArrayPatternNode::toString):
+ (JSC::RestParameterNode::toString):
+ * runtime/ErrorInstance.cpp:
+ (JSC::ErrorInstance::sanitizedToString):
+ * runtime/Options.cpp:
+ (JSC::Options::dumpOption):
+
2016-08-11 Benjamin Poulain <[email protected]>
[JSC] Revert most of r203808
Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (204393 => 204394)
--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -3747,7 +3747,7 @@
break;
case BindingType::RestElement:
- builder.append("...");
+ builder.appendLiteral("...");
target.pattern->toString(builder);
break;
}
@@ -3928,7 +3928,7 @@
void RestParameterNode::toString(StringBuilder& builder) const
{
- builder.append("...");
+ builder.appendLiteral("...");
m_pattern->toString(builder);
}
Modified: trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp (204393 => 204394)
--- trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/_javascript_Core/runtime/ErrorInstance.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -212,7 +212,7 @@
StringBuilder builder;
builder.append(nameString);
- builder.append(": ");
+ builder.appendLiteral(": ");
builder.append(messageString);
return builder.toString();
}
Modified: trunk/Source/_javascript_Core/runtime/Options.cpp (204393 => 204394)
--- trunk/Source/_javascript_Core/runtime/Options.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/_javascript_Core/runtime/Options.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -730,13 +730,13 @@
option.dump(builder);
if (wasOverridden && (dumpDefaultsOption == DumpDefaults)) {
- builder.append(" (default: ");
+ builder.appendLiteral(" (default: ");
option.defaultOption().dump(builder);
- builder.append(")");
+ builder.appendLiteral(")");
}
if (needsDescription) {
- builder.append(" ... ");
+ builder.appendLiteral(" ... ");
builder.append(option.description());
}
Modified: trunk/Source/WebCore/ChangeLog (204393 => 204394)
--- trunk/Source/WebCore/ChangeLog 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebCore/ChangeLog 2016-08-12 00:33:47 UTC (rev 204394)
@@ -1,3 +1,41 @@
+2016-08-11 Alex Christensen <[email protected]>
+
+ Use StringBuilder::appendLiteral when possible don't append result of makeString
+ https://bugs.webkit.org/show_bug.cgi?id=160772
+
+ Reviewed by Sam Weinig.
+
+ StringBuilder::append does an unnecessary strlen call.
+ append(makeString(...)) always does unnecessary allocations and copies.
+ It's currently only used in debug logging, but we shouldn't have this pattern in WebKit.
+
+ * Modules/indexeddb/server/IndexValueStore.cpp:
+ (WebCore::IDBServer::IndexValueStore::loggingString):
+ * Modules/indexeddb/shared/IDBDatabaseInfo.cpp:
+ (WebCore::IDBDatabaseInfo::loggingString):
+ * Modules/indexeddb/shared/IDBObjectStoreInfo.cpp:
+ (WebCore::IDBObjectStoreInfo::loggingString):
+ * contentextensions/CombinedURLFilters.cpp:
+ (WebCore::ContentExtensions::prefixTreeVertexToString):
+ (WebCore::ContentExtensions::recursivePrint):
+ * html/HTMLMediaElement.cpp:
+ (WebCore::actionName):
+ * html/MediaElementSession.cpp:
+ (WebCore::restrictionName):
+ * loader/ResourceLoadStatistics.cpp:
+ (WebCore::appendBoolean):
+ (WebCore::appendHashCountedSet):
+ (WebCore::ResourceLoadStatistics::toString):
+ * platform/PODInterval.h:
+ (WebCore::PODInterval::toString):
+ * platform/URL.cpp:
+ (WebCore::URL::setHost):
+ (WebCore::URL::setHostAndPort):
+ (WebCore::URL::serialize):
+ * testing/Internals.cpp:
+ (WebCore::appendOffsets):
+ (WebCore::Internals::scrollSnapOffsets):
+
2016-08-11 Chris Dumez <[email protected]>
Align Range.surroundContents() with the latest DOM specification
Modified: trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp (204393 => 204394)
--- trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebCore/Modules/indexeddb/server/IndexValueStore.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -32,6 +32,7 @@
#include "IDBKeyRangeData.h"
#include "Logging.h"
#include "MemoryIndex.h"
+#include <wtf/text/StringBuilder.h>
namespace WebCore {
namespace IDBServer {
@@ -387,12 +388,15 @@
#if !LOG_DISABLED
String IndexValueStore::loggingString() const
{
- String result;
+ StringBuilder builder;
for (auto& key : m_orderedKeys) {
- result.append(makeString("Key: ", key.loggingString()));
- result.append(makeString(" Entry has ", String::number(m_records.get(key)->getCount()), " entries"));
+ builder.appendLiteral("Key: ");
+ builder.append(key.loggingString());
+ builder.appendLiteral(" Entry has ");
+ builder.appendNumber(m_records.get(key)->getCount());
+ builder.appendLiteral(" entries");
}
- return result;
+ return builder.toString();
}
#endif
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp (204393 => 204394)
--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBDatabaseInfo.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -26,6 +26,8 @@
#include "config.h"
#include "IDBDatabaseInfo.h"
+#include <wtf/text/StringBuilder.h>
+
#if ENABLE(INDEXED_DATABASE)
namespace WebCore {
@@ -147,11 +149,18 @@
#if !LOG_DISABLED
String IDBDatabaseInfo::loggingString() const
{
- String top = makeString("Database: ", m_name, " version ", String::number(m_version), "\n");
- for (auto objectStore : m_objectStoreMap.values())
- top.append(makeString(objectStore.loggingString(1), "\n"));
+ StringBuilder builder;
+ builder.appendLiteral("Database:");
+ builder.append(m_name);
+ builder.appendLiteral(" version ");
+ builder.appendNumber(m_version);
+ builder.append('\n');
+ for (auto objectStore : m_objectStoreMap.values()) {
+ builder.append(objectStore.loggingString(1));
+ builder.append('\n');
+ }
- return top;
+ return builder.toString();
}
#endif
Modified: trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp (204393 => 204394)
--- trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebCore/Modules/indexeddb/shared/IDBObjectStoreInfo.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -25,6 +25,7 @@
#include "config.h"
#include "IDBObjectStoreInfo.h"
+#include <wtf/text/StringBuilder.h>
#if ENABLE(INDEXED_DATABASE)
@@ -126,15 +127,19 @@
#if !LOG_DISABLED
String IDBObjectStoreInfo::loggingString(int indent) const
{
- String indentString;
+ StringBuilder builder;
for (int i = 0; i < indent; ++i)
- indentString.append(" ");
+ builder.append(' ');
- String top = makeString(indentString, "Object store: ", m_name, String::format(" (%" PRIu64 ") \n", m_identifier));
- for (auto index : m_indexMap.values())
- top.append(makeString(index.loggingString(indent + 1), "\n"));
+ builder.appendLiteral("Object store: ");
+ builder.append(m_name);
+ builder.appendNumber(m_identifier);
+ for (auto index : m_indexMap.values()) {
+ builder.append(index.loggingString(indent + 1));
+ builder.append('\n');
+ }
- return top;
+ return builder.toString();
}
#endif
Modified: trunk/Source/WebCore/contentextensions/CombinedURLFilters.cpp (204393 => 204394)
--- trunk/Source/WebCore/contentextensions/CombinedURLFilters.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebCore/contentextensions/CombinedURLFilters.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -96,8 +96,8 @@
{
StringBuilder builder;
while (depth--)
- builder.append(" ");
- builder.append("vertex actions: ");
+ builder.appendLiteral(" ");
+ builder.appendLiteral("vertex actions: ");
auto actionsSlot = actions.find(&vertex);
if (actionsSlot != actions.end()) {
@@ -117,7 +117,7 @@
StringBuilder builder;
for (unsigned i = 0; i < depth * 2; ++i)
builder.append(' ');
- builder.append("vertex edge: ");
+ builder.appendLiteral("vertex edge: ");
builder.append(edge.term->toString());
builder.append('\n');
dataLogF("%s", builder.toString().utf8().data());
Modified: trunk/Source/WebCore/html/HTMLMediaElement.cpp (204393 => 204394)
--- trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebCore/html/HTMLMediaElement.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -195,7 +195,7 @@
#define ACTION(_actionType) \
if (action & (HTMLMediaElementEnums::_actionType)) { \
if (!actionBuilder.isEmpty()) \
- actionBuilder.append(", "); \
+ actionBuilder.appendLiteral(", "); \
actionBuilder.append(#_actionType); \
} \
Modified: trunk/Source/WebCore/html/MediaElementSession.cpp (204393 => 204394)
--- trunk/Source/WebCore/html/MediaElementSession.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebCore/html/MediaElementSession.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -68,7 +68,7 @@
#define CASE(restrictionType) \
if (restriction & MediaElementSession::restrictionType) { \
if (!restrictionBuilder.isEmpty()) \
- restrictionBuilder.append(", "); \
+ restrictionBuilder.appendLiteral(", "); \
restrictionBuilder.append(#restrictionType); \
} \
Modified: trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp (204393 => 204394)
--- trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebCore/loader/ResourceLoadStatistics.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -176,9 +176,9 @@
static void appendBoolean(StringBuilder& builder, const String& label, bool flag)
{
- builder.append(" ");
+ builder.appendLiteral(" ");
builder.append(label);
- builder.append(": ");
+ builder.appendLiteral(": ");
builder.append(flag ? "Yes" : "No");
}
@@ -187,14 +187,14 @@
if (hashCountedSet.isEmpty())
return;
- builder.append(" ");
+ builder.appendLiteral(" ");
builder.append(label);
- builder.append(":\n");
+ builder.appendLiteral(":\n");
for (auto& entry : hashCountedSet) {
- builder.append(" ");
+ builder.appendLiteral(" ");
builder.append(entry.key);
- builder.append(": ");
+ builder.appendLiteral(": ");
builder.appendNumber(entry.value);
builder.append('\n');
}
@@ -212,19 +212,19 @@
// Top frame stats
appendBoolean(builder, "topFrameHasBeenNavigatedToBefore", topFrameHasBeenNavigatedToBefore);
builder.append('\n');
- builder.append(" topFrameHasBeenRedirectedTo: ");
+ builder.appendLiteral(" topFrameHasBeenRedirectedTo: ");
builder.appendNumber(topFrameHasBeenRedirectedTo);
builder.append('\n');
- builder.append(" topFrameHasBeenRedirectedFrom: ");
+ builder.appendLiteral(" topFrameHasBeenRedirectedFrom: ");
builder.appendNumber(topFrameHasBeenRedirectedFrom);
builder.append('\n');
- builder.append(" topFrameInitialLoadCount: ");
+ builder.appendLiteral(" topFrameInitialLoadCount: ");
builder.appendNumber(topFrameInitialLoadCount);
builder.append('\n');
- builder.append(" topFrameHasBeenNavigatedTo: ");
+ builder.appendLiteral(" topFrameHasBeenNavigatedTo: ");
builder.appendNumber(topFrameHasBeenNavigatedTo);
builder.append('\n');
- builder.append(" topFrameHasBeenNavigatedFrom: ");
+ builder.appendLiteral(" topFrameHasBeenNavigatedFrom: ");
builder.appendNumber(topFrameHasBeenNavigatedFrom);
builder.append('\n');
@@ -231,35 +231,35 @@
// Subframe stats
appendBoolean(builder, "subframeHasBeenLoadedBefore", subframeHasBeenLoadedBefore);
builder.append('\n');
- builder.append(" subframeHasBeenRedirectedTo: ");
+ builder.appendLiteral(" subframeHasBeenRedirectedTo: ");
builder.appendNumber(subframeHasBeenRedirectedTo);
builder.append('\n');
- builder.append(" subframeHasBeenRedirectedFrom: ");
+ builder.appendLiteral(" subframeHasBeenRedirectedFrom: ");
builder.appendNumber(subframeHasBeenRedirectedFrom);
builder.append('\n');
- builder.append(" subframeSubResourceCount: ");
+ builder.appendLiteral(" subframeSubResourceCount: ");
builder.appendNumber(subframeSubResourceCount);
builder.append('\n');
appendHashCountedSet(builder, "subframeUnderTopFrameOrigins", subframeUnderTopFrameOrigins);
appendHashCountedSet(builder, "subframeUniqueRedirectsTo", subframeUniqueRedirectsTo);
- builder.append(" subframeHasBeenNavigatedTo: ");
+ builder.appendLiteral(" subframeHasBeenNavigatedTo: ");
builder.appendNumber(subframeHasBeenNavigatedTo);
builder.append('\n');
- builder.append(" subframeHasBeenNavigatedFrom: ");
+ builder.appendLiteral(" subframeHasBeenNavigatedFrom: ");
builder.appendNumber(subframeHasBeenNavigatedFrom);
builder.append('\n');
// Subresource stats
- builder.append(" subresourceHasBeenRedirectedFrom: ");
+ builder.appendLiteral(" subresourceHasBeenRedirectedFrom: ");
builder.appendNumber(subresourceHasBeenRedirectedFrom);
builder.append('\n');
- builder.append(" subresourceHasBeenRedirectedTo: ");
+ builder.appendLiteral(" subresourceHasBeenRedirectedTo: ");
builder.appendNumber(subresourceHasBeenRedirectedTo);
builder.append('\n');
- builder.append(" subresourceHasBeenSubresourceCount: ");
+ builder.appendLiteral(" subresourceHasBeenSubresourceCount: ");
builder.appendNumber(subresourceHasBeenSubresourceCount);
builder.append('\n');
- builder.append(" subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited: ");
+ builder.appendLiteral(" subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited: ");
builder.appendNumber(subresourceHasBeenSubresourceCountDividedByTotalNumberOfOriginsVisited);
builder.append('\n');
appendHashCountedSet(builder, "subresourceUnderTopFrameOrigins", subresourceUnderTopFrameOrigins);
Modified: trunk/Source/WebCore/platform/PODInterval.h (204393 => 204394)
--- trunk/Source/WebCore/platform/PODInterval.h 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebCore/platform/PODInterval.h 2016-08-12 00:33:47 UTC (rev 204394)
@@ -136,13 +136,13 @@
String toString() const
{
StringBuilder builder;
- builder.append("[PODInterval (");
+ builder.appendLiteral("[PODInterval (");
builder.append(ValueToString<T>::string(low()));
- builder.append(", ");
+ builder.appendLiteral(", ");
builder.append(ValueToString<T>::string(high()));
- builder.append("), data=""
+ builder.appendLiteral("), data=""
builder.append(ValueToString<UserData>::string(data()));
- builder.append(", maxHigh=");
+ builder.appendLiteral(", maxHigh=");
builder.append(ValueToString<T>::string(maxHigh()));
builder.append(']');
return builder.toString();
Modified: trunk/Source/WebCore/platform/URL.cpp (204393 => 204394)
--- trunk/Source/WebCore/platform/URL.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebCore/platform/URL.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -896,7 +896,7 @@
StringBuilder builder;
builder.append(m_string.left(hostStart()));
if (slashSlashNeeded)
- builder.append("//");
+ builder.appendLiteral("//");
builder.append(StringView(encodedHostName.data(), encodedHostName.size()));
builder.append(m_string.substring(m_hostEnd));
@@ -951,10 +951,10 @@
StringBuilder builder;
builder.append(m_string.left(hostStart()));
if (slashSlashNeeded)
- builder.append("//");
+ builder.appendLiteral("//");
builder.append(StringView(encodedHostName.data(), encodedHostName.size()));
if (!port.isEmpty()) {
- builder.append(":");
+ builder.appendLiteral(":");
builder.append(port);
}
builder.append(m_string.substring(m_portEnd));
@@ -1212,31 +1212,31 @@
StringBuilder urlBuilder;
urlBuilder.append(m_string, 0, m_schemeEnd);
- urlBuilder.append(":");
+ urlBuilder.appendLiteral(":");
unsigned start = hostStart();
if (start < m_hostEnd) {
- urlBuilder.append("//");
+ urlBuilder.appendLiteral("//");
if (hasUsername()) {
urlBuilder.append(m_string, m_userStart, m_userEnd - m_userStart);
unsigned passwordStart = m_userEnd + 1;
if (hasPassword()) {
- urlBuilder.append(":");
+ urlBuilder.appendLiteral(":");
urlBuilder.append(m_string, passwordStart, m_passwordEnd - passwordStart);
}
- urlBuilder.append("@");
+ urlBuilder.appendLiteral("@");
}
// FIXME: Serialize host according https://url.spec.whatwg.org/#concept-host-serializer for IPv4 and IPv6 addresses.
urlBuilder.append(m_string, start, m_hostEnd - start);
if (hasPort()) {
- urlBuilder.append(":");
+ urlBuilder.appendLiteral(":");
urlBuilder.appendNumber(port());
}
} else if (protocolIs("file"))
- urlBuilder.append("//");
+ urlBuilder.appendLiteral("//");
if (cannotBeABaseURL(*this))
urlBuilder.append(m_string, m_portEnd, m_pathEnd - m_portEnd);
else {
- urlBuilder.append("/");
+ urlBuilder.appendLiteral("/");
if (m_pathEnd > m_portEnd) {
unsigned pathStart = m_portEnd + 1;
urlBuilder.append(m_string, pathStart, m_pathEnd - pathStart);
@@ -1243,11 +1243,11 @@
}
}
if (hasQuery()) {
- urlBuilder.append("?");
+ urlBuilder.appendLiteral("?");
urlBuilder.append(m_string, m_pathEnd + 1, m_queryEnd - (m_pathEnd + 1));
}
if (!omitFragment && hasFragment()) {
- urlBuilder.append("#");
+ urlBuilder.appendLiteral("#");
urlBuilder.append(m_string, m_queryEnd + 1, m_fragmentEnd - (m_queryEnd + 1));
}
return urlBuilder.toString();
Modified: trunk/Source/WebCore/testing/Internals.cpp (204393 => 204394)
--- trunk/Source/WebCore/testing/Internals.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebCore/testing/Internals.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -3130,16 +3130,16 @@
{
bool justStarting = true;
- builder.append("{ ");
+ builder.appendLiteral("{ ");
for (auto& coordinate : snapOffsets) {
if (!justStarting)
- builder.append(", ");
+ builder.appendLiteral(", ");
else
justStarting = false;
builder.append(String::number(coordinate.toUnsigned()));
}
- builder.append(" }");
+ builder.appendLiteral(" }");
}
String Internals::scrollSnapOffsets(Element& element, ExceptionCode& ec)
Modified: trunk/Source/WebKit2/ChangeLog (204393 => 204394)
--- trunk/Source/WebKit2/ChangeLog 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebKit2/ChangeLog 2016-08-12 00:33:47 UTC (rev 204394)
@@ -1,3 +1,16 @@
+2016-08-11 Alex Christensen <[email protected]>
+
+ Use StringBuilder::appendLiteral when possible don't append result of makeString
+ https://bugs.webkit.org/show_bug.cgi?id=160772
+
+ Reviewed by Sam Weinig.
+
+ * Shared/Gamepad/GamepadData.cpp:
+ (WebKit::GamepadData::isNull):
+ (WebKit::GamepadData::loggingString):
+ * Shared/Gamepad/GamepadData.h:
+ * UIProcess/WebProcessPool.h:
+
2016-08-10 Alex Christensen <[email protected]>
Fix crash when changing cookie accept policy after r204327
Modified: trunk/Source/WebKit2/Shared/Gamepad/GamepadData.cpp (204393 => 204394)
--- trunk/Source/WebKit2/Shared/Gamepad/GamepadData.cpp 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebKit2/Shared/Gamepad/GamepadData.cpp 2016-08-12 00:33:47 UTC (rev 204394)
@@ -57,21 +57,34 @@
return !index && axisValues.isEmpty() && buttonValues.isEmpty();
}
+#if !LOG_DISABLED
String GamepadData::loggingString() const
{
StringBuilder builder;
- builder.append(makeString(String::number(axisValues.size()), " axes, ", String::number(buttonValues.size()), " buttons\n"));
+ builder.appendNumber(axisValues.size());
+ builder.appendLiteral(" axes, ");
+ builder.appendNumber(buttonValues.size());
+ builder.appendLiteral(" buttons\n");
- for (size_t i = 0; i < axisValues.size(); ++i)
- builder.append(makeString(" Axis ", String::number(i), ": ", String::number(axisValues[i])));
+ for (size_t i = 0; i < axisValues.size(); ++i) {
+ builder.appendLiteral(" Axis ");
+ builder.appendNumber(i);
+ builder.appendLiteral(": ");
+ builder.appendNumber(axisValues[i]);
+ }
- builder.append("\n");
- for (size_t i = 0; i < buttonValues.size(); ++i)
- builder.append(makeString(" Button ", String::number(i), ": ", String::number(buttonValues[i])));
+ builder.append('\n');
+ for (size_t i = 0; i < buttonValues.size(); ++i) {
+ builder.appendLiteral(" Button ");
+ builder.appendNumber(i);
+ builder.appendLiteral(": ");
+ builder.appendNumber(buttonValues[i]);
+ }
return builder.toString();
}
+#endif
} // namespace WebKit
Modified: trunk/Source/WebKit2/Shared/Gamepad/GamepadData.h (204393 => 204394)
--- trunk/Source/WebKit2/Shared/Gamepad/GamepadData.h 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebKit2/Shared/Gamepad/GamepadData.h 2016-08-12 00:33:47 UTC (rev 204394)
@@ -47,7 +47,9 @@
Vector<double> axisValues;
Vector<double> buttonValues;
+#if !LOG_DISABLED
String loggingString() const;
+#endif
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/UIProcess/WebProcessPool.h (204393 => 204394)
--- trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2016-08-12 00:22:20 UTC (rev 204393)
+++ trunk/Source/WebKit2/UIProcess/WebProcessPool.h 2016-08-12 00:33:47 UTC (rev 204394)
@@ -85,7 +85,6 @@
class WebIconDatabase;
class WebPageGroup;
class WebPageProxy;
-struct GamepadData;
struct NetworkProcessCreationParameters;
struct StatisticsData;
struct WebProcessCreationParameters;