Fix the uses of String::operator+=() for Mac

https://bugs.webkit.org/show_bug.cgi?id=95818

Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-09-05
Reviewed by Dan Bernstein.

Source/JavaScriptCore:

* jsc.cpp:
(functionJSCStack): Use StringBuilder to create the stack dump, it is faster
and avoid String::operator+=().

* parser/Parser.h:
(JSC::Parser::updateErrorMessageSpecialCase):
(JSC::Parser::updateErrorMessage):
(JSC::Parser::updateErrorWithNameAndMessage):
Use the String operators (and makeString) to concatenate the strings.

Source/WebCore:

* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::JSCSSStyleDeclaration::putDelegate):
This is a legitimate use of String::append(), it is the only
concatenation in this function.

* loader/appcache/ManifestParser.cpp:
(WebCore::parseManifest): Ditto.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127574 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent b05165b3
2012-09-05 Benjamin Poulain <bpoulain@apple.com>
Fix the uses of String::operator+=() for Mac
https://bugs.webkit.org/show_bug.cgi?id=95818
Reviewed by Dan Bernstein.
* jsc.cpp:
(functionJSCStack): Use StringBuilder to create the stack dump, it is faster
and avoid String::operator+=().
* parser/Parser.h:
(JSC::Parser::updateErrorMessageSpecialCase):
(JSC::Parser::updateErrorMessage):
(JSC::Parser::updateErrorWithNameAndMessage):
Use the String operators (and makeString) to concatenate the strings.
2012-09-05 Gabor Rapcsanyi <rgabor@webkit.org>
DFG JIT doesn't work properly on ARM hardfp
......
......@@ -24,7 +24,6 @@
#include "BytecodeGenerator.h"
#include "Completion.h"
#include <wtf/CurrentTime.h>
#include "ExceptionHelpers.h"
#include "InitializeThreading.h"
#include "Interpreter.h"
......@@ -33,12 +32,14 @@
#include "JSFunction.h"
#include "JSLock.h"
#include "JSString.h"
#include <wtf/MainThread.h>
#include "SamplingTool.h"
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <wtf/CurrentTime.h>
#include <wtf/MainThread.h>
#include <wtf/text/StringBuilder.h>
#if !OS(WINDOWS)
#include <unistd.h>
......@@ -308,17 +309,19 @@ EncodedJSValue JSC_HOST_CALL functionDescribe(ExecState* exec)
EncodedJSValue JSC_HOST_CALL functionJSCStack(ExecState* exec)
{
String trace = "--> Stack trace:\n";
StringBuilder trace;
trace.appendLiteral("--> Stack trace:\n");
Vector<StackFrame> stackTrace;
Interpreter::getStackTrace(&exec->globalData(), stackTrace);
int i = 0;
for (Vector<StackFrame>::iterator iter = stackTrace.begin(); iter < stackTrace.end(); iter++) {
StackFrame level = *iter;
trace += String::format(" %i %s\n", i, level.toString(exec).utf8().data());
trace.append(String::format(" %i %s\n", i, level.toString(exec).utf8().data()));
i++;
}
fprintf(stderr, "%s", trace.utf8().data());
fprintf(stderr, "%s", trace.toString().utf8().data());
return JSValue::encode(jsUndefined());
}
......
......@@ -735,52 +735,34 @@ private:
ALWAYS_INLINE void updateErrorMessageSpecialCase(JSTokenType expectedToken)
{
String errorMessage;
switch (expectedToken) {
case RESERVED_IF_STRICT:
errorMessage = "Use of reserved word '";
errorMessage += getToken().impl();
errorMessage += "' in strict mode";
m_errorMessage = errorMessage.impl();
m_errorMessage = "Use of reserved word '" + getToken() + "' in strict mode";
return;
case RESERVED:
errorMessage = "Use of reserved word '";
errorMessage += getToken().impl();
errorMessage += "'";
m_errorMessage = errorMessage.impl();
m_errorMessage = "Use of reserved word '" + getToken() + '\'';
return;
case NUMBER:
errorMessage = "Unexpected number '";
errorMessage += getToken().impl();
errorMessage += "'";
m_errorMessage = errorMessage.impl();
m_errorMessage = "Unexpected number '" + getToken() + '\'';
return;
case IDENT:
errorMessage = "Expected an identifier but found '";
errorMessage += getToken().impl();
errorMessage += "' instead";
m_errorMessage = errorMessage.impl();
m_errorMessage = "Expected an identifier but found '" + getToken() + "' instead";
return;
case STRING:
errorMessage = "Unexpected string ";
errorMessage += getToken().impl();
m_errorMessage = errorMessage.impl();
m_errorMessage = "Unexpected string " + getToken();
return;
case ERRORTOK:
errorMessage = "Unrecognized token '";
errorMessage += getToken().impl();
errorMessage += "'";
m_errorMessage = errorMessage.impl();
m_errorMessage = "Unrecognized token '" + getToken() + '\'';
return;
case EOFTOK:
m_errorMessage = "Unexpected EOF";
m_errorMessage = ASCIILiteral("Unexpected EOF");
return;
case RETURN:
m_errorMessage = "Return statements are only valid inside functions";
m_errorMessage = ASCIILiteral("Return statements are only valid inside functions");
return;
default:
ASSERT_NOT_REACHED();
m_errorMessage = "internal error";
m_errorMessage = ASCIILiteral("internal error");
return;
}
}
......@@ -806,22 +788,16 @@ private:
updateErrorMessageSpecialCase(m_token.m_type);
else
updateErrorMessageSpecialCase(expectedToken);
}
}
}
NEVER_INLINE void updateErrorWithNameAndMessage(const char* beforeMsg, String name, const char* afterMsg)
{
m_error = true;
String prefix(beforeMsg);
String postfix(afterMsg);
prefix += " '";
prefix += name.impl();
prefix += "' ";
prefix += postfix;
m_errorMessage = prefix.impl();
m_errorMessage = makeString(beforeMsg, " '", name, "' ", afterMsg);
}
NEVER_INLINE void updateErrorMessage(const char* msg)
NEVER_INLINE void updateErrorMessage(const char* msg)
{
m_error = true;
m_errorMessage = String(msg);
......
2012-09-05 Benjamin Poulain <bpoulain@apple.com>
Fix the uses of String::operator+=() for Mac
https://bugs.webkit.org/show_bug.cgi?id=95818
Reviewed by Dan Bernstein.
* bindings/js/JSCSSStyleDeclarationCustom.cpp:
(WebCore::JSCSSStyleDeclaration::putDelegate):
This is a legitimate use of String::append(), it is the only
concatenation in this function.
* loader/appcache/ManifestParser.cpp:
(WebCore::parseManifest): Ditto.
2012-09-05 Kenneth Rohde Christiansen <kenneth@webkit.org>
[EFL] Fuzzy load the Edje theme for HTML forms
......@@ -358,7 +358,7 @@ bool JSCSSStyleDeclaration::putDelegate(ExecState* exec, PropertyName propertyNa
String propValue = valueToStringWithNullCheck(exec, value);
if (propertyInfo.hadPixelOrPosPrefix)
propValue += "px";
propValue.append("px");
bool important = false;
if (Settings::shouldRespectPriorityInCSSAttributeSetters()) {
......
......@@ -47,7 +47,7 @@ bool parseManifest(const KURL& manifestURL, const char* data, int length, Manife
RefPtr<TextResourceDecoder> decoder = TextResourceDecoder::create("text/cache-manifest", "UTF-8");
String s = decoder->decode(data, length);
s += decoder->flush();
s.append(decoder->flush());
// Look for the magic signature: "^\xFEFF?CACHE MANIFEST[ \t]?" (the BOM is removed by TextResourceDecoder).
// Example: "CACHE MANIFEST #comment" is a valid signature.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment