⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 173120 in webkit


Ignore:
Timestamp:
Aug 29, 2014, 2:33:30 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

JavaScriptCore: Use ASCIILiteral where possible
​https://bugs.webkit.org/show_bug.cgi?id=136179

Patch by Joseph Pecoraro <Joseph Pecoraro> on 2014-08-29
Reviewed by Michael Saboff.

Source/JavaScriptCore:

General string / character related changes. Use ASCIILiteral where
possible, jsNontrivialString where possible, and replace string
literals with character literals in some places.

No new tests, no changes to functionality.

  • bytecode/CodeBlock.cpp:

(JSC::CodeBlock::nameForRegister):

  • bytecompiler/NodesCodegen.cpp:

(JSC::PostfixNode::emitBytecode):
(JSC::PrefixNode::emitBytecode):
(JSC::AssignErrorNode::emitBytecode):
(JSC::ForInNode::emitMultiLoopBytecode):
(JSC::ForOfNode::emitBytecode):
(JSC::ObjectPatternNode::toString):

  • dfg/DFGFunctionWhitelist.cpp:

(JSC::DFG::FunctionWhitelist::contains):

  • dfg/DFGOperations.cpp:

(JSC::DFG::newTypedArrayWithSize):
(JSC::DFG::newTypedArrayWithOneArgument):

  • inspector/ConsoleMessage.cpp:

(Inspector::ConsoleMessage::addToFrontend):

  • inspector/InspectorBackendDispatcher.cpp:

(Inspector::InspectorBackendDispatcher::dispatch):

  • inspector/ScriptCallStackFactory.cpp:

(Inspector::extractSourceInformationFromException):

  • inspector/scripts/codegen/generator_templates.py:
  • interpreter/StackVisitor.cpp:

(JSC::StackVisitor::Frame::functionName):
(JSC::StackVisitor::Frame::sourceURL):

  • jit/JITOperations.cpp:
  • jsc.cpp:

(functionDescribeArray):
(functionRun):
(functionLoad):
(functionReadFile):
(functionCheckSyntax):
(functionTransferArrayBuffer):
(runWithScripts):
(runInteractive):

  • parser/Lexer.cpp:

(JSC::Lexer<T>::invalidCharacterMessage):
(JSC::Lexer<T>::parseString):
(JSC::Lexer<T>::parseStringSlowCase):
(JSC::Lexer<T>::lex):

  • profiler/Profile.cpp:

(JSC::Profile::Profile):

  • runtime/Arguments.cpp:

(JSC::argumentsFuncIterator):

  • runtime/ArrayPrototype.cpp:

(JSC::performSlowSort):
(JSC::arrayProtoFuncSort):

  • runtime/ExceptionHelpers.cpp:

(JSC::createError):
(JSC::createInvalidParameterError):
(JSC::createNotAConstructorError):
(JSC::createNotAFunctionError):
(JSC::createNotAnObjectError):
(JSC::createErrorForInvalidGlobalAssignment):

  • runtime/FunctionPrototype.cpp:

(JSC::insertSemicolonIfNeeded):

  • runtime/JSArray.cpp:

(JSC::JSArray::defineOwnProperty):
(JSC::JSArray::pop):
(JSC::JSArray::push):

  • runtime/JSArrayBufferConstructor.cpp:

(JSC::JSArrayBufferConstructor::finishCreation):

  • runtime/JSArrayBufferPrototype.cpp:

(JSC::arrayBufferProtoFuncSlice):

  • runtime/JSDataView.cpp:

(JSC::JSDataView::create):

  • runtime/JSDataViewPrototype.cpp:

(JSC::getData):
(JSC::setData):

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::reset):

  • runtime/JSGlobalObjectFunctions.cpp:

(JSC::globalFuncProtoSetter):

  • runtime/JSPromiseConstructor.cpp:

(JSC::JSPromiseConstructor::finishCreation):

  • runtime/LiteralParser.cpp:

(JSC::LiteralParser<CharType>::Lexer::lex):
(JSC::LiteralParser<CharType>::Lexer::lexString):
(JSC::LiteralParser<CharType>::parse):

  • runtime/LiteralParser.h:

(JSC::LiteralParser::getErrorMessage):

  • runtime/TypeSet.cpp:

(JSC::TypeSet::seenTypes):
(JSC::TypeSet::displayName):
(JSC::TypeSet::allPrimitiveTypeNames):
(JSC::StructureShape::propertyHash):
(JSC::StructureShape::stringRepresentation):

Source/WTF:

  • wtf/text/WTFString.cpp:

(asciiDebug):

Location:
trunk/Source
Files:
31 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r173113 r173120  
     12014-08-29  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        JavaScriptCore: Use ASCIILiteral where possible
     4        https://bugs.webkit.org/show_bug.cgi?id=136179
     5
     6        Reviewed by Michael Saboff.
     7
     8        General string / character related changes. Use ASCIILiteral where
     9        possible, jsNontrivialString where possible, and replace string
     10        literals with character literals in some places.
     11
     12        No new tests, no changes to functionality.
     13
     14        * bytecode/CodeBlock.cpp:
     15        (JSC::CodeBlock::nameForRegister):
     16        * bytecompiler/NodesCodegen.cpp:
     17        (JSC::PostfixNode::emitBytecode):
     18        (JSC::PrefixNode::emitBytecode):
     19        (JSC::AssignErrorNode::emitBytecode):
     20        (JSC::ForInNode::emitMultiLoopBytecode):
     21        (JSC::ForOfNode::emitBytecode):
     22        (JSC::ObjectPatternNode::toString):
     23        * dfg/DFGFunctionWhitelist.cpp:
     24        (JSC::DFG::FunctionWhitelist::contains):
     25        * dfg/DFGOperations.cpp:
     26        (JSC::DFG::newTypedArrayWithSize):
     27        (JSC::DFG::newTypedArrayWithOneArgument):
     28        * inspector/ConsoleMessage.cpp:
     29        (Inspector::ConsoleMessage::addToFrontend):
     30        * inspector/InspectorBackendDispatcher.cpp:
     31        (Inspector::InspectorBackendDispatcher::dispatch):
     32        * inspector/ScriptCallStackFactory.cpp:
     33        (Inspector::extractSourceInformationFromException):
     34        * inspector/scripts/codegen/generator_templates.py:
     35        * interpreter/StackVisitor.cpp:
     36        (JSC::StackVisitor::Frame::functionName):
     37        (JSC::StackVisitor::Frame::sourceURL):
     38        * jit/JITOperations.cpp:
     39        * jsc.cpp:
     40        (functionDescribeArray):
     41        (functionRun):
     42        (functionLoad):
     43        (functionReadFile):
     44        (functionCheckSyntax):
     45        (functionTransferArrayBuffer):
     46        (runWithScripts):
     47        (runInteractive):
     48        * parser/Lexer.cpp:
     49        (JSC::Lexer<T>::invalidCharacterMessage):
     50        (JSC::Lexer<T>::parseString):
     51        (JSC::Lexer<T>::parseStringSlowCase):
     52        (JSC::Lexer<T>::lex):
     53        * profiler/Profile.cpp:
     54        (JSC::Profile::Profile):
     55        * runtime/Arguments.cpp:
     56        (JSC::argumentsFuncIterator):
     57        * runtime/ArrayPrototype.cpp:
     58        (JSC::performSlowSort):
     59        (JSC::arrayProtoFuncSort):
     60        * runtime/ExceptionHelpers.cpp:
     61        (JSC::createError):
     62        (JSC::createInvalidParameterError):
     63        (JSC::createNotAConstructorError):
     64        (JSC::createNotAFunctionError):
     65        (JSC::createNotAnObjectError):
     66        (JSC::createErrorForInvalidGlobalAssignment):
     67        * runtime/FunctionPrototype.cpp:
     68        (JSC::insertSemicolonIfNeeded):
     69        * runtime/JSArray.cpp:
     70        (JSC::JSArray::defineOwnProperty):
     71        (JSC::JSArray::pop):
     72        (JSC::JSArray::push):
     73        * runtime/JSArrayBufferConstructor.cpp:
     74        (JSC::JSArrayBufferConstructor::finishCreation):
     75        * runtime/JSArrayBufferPrototype.cpp:
     76        (JSC::arrayBufferProtoFuncSlice):
     77        * runtime/JSDataView.cpp:
     78        (JSC::JSDataView::create):
     79        * runtime/JSDataViewPrototype.cpp:
     80        (JSC::getData):
     81        (JSC::setData):
     82        * runtime/JSGlobalObject.cpp:
     83        (JSC::JSGlobalObject::reset):
     84        * runtime/JSGlobalObjectFunctions.cpp:
     85        (JSC::globalFuncProtoSetter):
     86        * runtime/JSPromiseConstructor.cpp:
     87        (JSC::JSPromiseConstructor::finishCreation):
     88        * runtime/LiteralParser.cpp:
     89        (JSC::LiteralParser<CharType>::Lexer::lex):
     90        (JSC::LiteralParser<CharType>::Lexer::lexString):
     91        (JSC::LiteralParser<CharType>::parse):
     92        * runtime/LiteralParser.h:
     93        (JSC::LiteralParser::getErrorMessage):
     94        * runtime/TypeSet.cpp:
     95        (JSC::TypeSet::seenTypes):
     96        (JSC::TypeSet::displayName):
     97        (JSC::TypeSet::allPrimitiveTypeNames):
     98        (JSC::StructureShape::propertyHash):
     99        (JSC::StructureShape::stringRepresentation):
     100
    11012014-08-29  Csaba Osztrogonác  <ossy@webkit.org>
    2102
  • trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp

    r172950 r173120  
    38463846    }
    38473847    if (virtualRegister.isArgument())
    3848         return String::format("arguments[%3d]", virtualRegister.toArgument()).impl();
     3848        return String::format("arguments[%3d]", virtualRegister.toArgument());
    38493849
    38503850    return "";
  • trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp

    r172820 r173120  
    892892
    893893    return emitThrowReferenceError(generator, m_operator == OpPlusPlus
    894         ? "Postfix ++ operator applied to value that is not a reference."
    895         : "Postfix -- operator applied to value that is not a reference.");
     894        ? ASCIILiteral("Postfix ++ operator applied to value that is not a reference.")
     895        : ASCIILiteral("Postfix -- operator applied to value that is not a reference."));
    896896}
    897897
    … …  
    10751075
    10761076    return emitThrowReferenceError(generator, m_operator == OpPlusPlus
    1077         ? "Prefix ++ operator applied to value that is not a reference."
    1078         : "Prefix -- operator applied to value that is not a reference.");
     1077        ? ASCIILiteral("Prefix ++ operator applied to value that is not a reference.")
     1078        : ASCIILiteral("Prefix -- operator applied to value that is not a reference."));
    10791079}
    10801080
    … …  
    16141614RegisterID* AssignErrorNode::emitBytecode(BytecodeGenerator& generator, RegisterID*)
    16151615{
    1616     return emitThrowReferenceError(generator, "Left side of assignment is not a reference.");
     1616    return emitThrowReferenceError(generator, ASCIILiteral("Left side of assignment is not a reference."));
    16171617}
    16181618
    … …  
    20362036{
    20372037    if (!m_lexpr->isAssignmentLocation()) {
    2038         emitThrowReferenceError(generator, "Left side of for-in statement is not a reference.");
     2038        emitThrowReferenceError(generator, ASCIILiteral("Left side of for-in statement is not a reference."));
    20392039        return;
    20402040    }
    … …  
    21682168{
    21692169    if (!m_lexpr->isAssignmentLocation()) {
    2170         emitThrowReferenceError(generator, "Left side of for-of statement is not a reference.");
     2170        emitThrowReferenceError(generator, ASCIILiteral("Left side of for-of statement is not a reference."));
    21712171        return;
    21722172    }
    … …  
    27852785        } else
    27862786            builder.append(m_targetPatterns[i].propertyName.string());
    2787         builder.append(":");
     2787        builder.append(':');
    27882788        m_targetPatterns[i].pattern->toString(builder);
    27892789        if (i < m_targetPatterns.size() - 1)
  • trunk/Source/JavaScriptCore/dfg/DFGFunctionWhitelist.cpp

    r170583 r173120  
    107107        return true;
    108108
    109     String nameAndHash = name;
    110     nameAndHash.append('#');
    111     nameAndHash.append(hash);
    112     return m_entries.contains(nameAndHash);
     109    return m_entries.contains(name + '#' + hash);
    113110}
    114111
  • trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp

    r172129 r173120  
    138138    NativeCallFrameTracer tracer(&vm, exec);
    139139    if (size < 0) {
    140         vm.throwException(exec, createRangeError(exec, "Requested length is negative"));
     140        vm.throwException(exec, createRangeError(exec, ASCIILiteral("Requested length is negative")));
    141141        return 0;
    142142    }
    … …  
    157157       
    158158        if (buffer->byteLength() % ViewClass::elementSize) {
    159             vm.throwException(exec, createRangeError(exec, "ArrayBuffer length minus the byteOffset is not a multiple of the element size"));
     159            vm.throwException(exec, createRangeError(exec, ASCIILiteral("ArrayBuffer length minus the byteOffset is not a multiple of the element size")));
    160160            return 0;
    161161        }
    … …  
    184184        length = value.asInt32();
    185185    else if (!value.isNumber()) {
    186         vm.throwException(exec, createTypeError(exec, "Invalid array length argument"));
     186        vm.throwException(exec, createTypeError(exec, ASCIILiteral("Invalid array length argument")));
    187187        return 0;
    188188    } else {
    189189        length = static_cast<int>(value.asNumber());
    190190        if (length != value.asNumber()) {
    191             vm.throwException(exec, createTypeError(exec, "Invalid array length argument (fractional lengths not allowed)"));
     191            vm.throwException(exec, createTypeError(exec, ASCIILiteral("Invalid array length argument (fractional lengths not allowed)")));
    192192            return 0;
    193193        }
    … …  
    195195   
    196196    if (length < 0) {
    197         vm.throwException(exec, createRangeError(exec, "Requested length is negative"));
     197        vm.throwException(exec, createRangeError(exec, ASCIILiteral("Requested length is negative")));
    198198        return 0;
    199199    }
  • trunk/Source/JavaScriptCore/inspector/ConsoleMessage.cpp

    r172930 r173120  
    212212            } else {
    213213                for (unsigned i = 0; i < m_arguments->argumentCount(); ++i) {
    214                     RefPtr<Inspector::Protocol::Runtime::RemoteObject> inspectorValue = injectedScript.wrapObject(m_arguments->argumentAt(i), "console", generatePreview);
     214                    RefPtr<Inspector::Protocol::Runtime::RemoteObject> inspectorValue = injectedScript.wrapObject(m_arguments->argumentAt(i), ASCIILiteral("console"), generatePreview);
    215215                    if (!inspectorValue) {
    216216                        ASSERT_NOT_REACHED();
  • trunk/Source/JavaScriptCore/inspector/InspectorBackendDispatcher.cpp

    r160523 r173120  
    9191    }
    9292
    93     RefPtr<InspectorValue> callIdValue = messageObject->get("id");
     93    RefPtr<InspectorValue> callIdValue = messageObject->get(ASCIILiteral("id"));
    9494    if (!callIdValue) {
    9595        reportProtocolError(nullptr, InvalidRequest, ASCIILiteral("'id' property was not found"));
    … …  
    103103    }
    104104
    105     RefPtr<InspectorValue> methodValue = messageObject->get("method");
     105    RefPtr<InspectorValue> methodValue = messageObject->get(ASCIILiteral("method"));
    106106    if (!methodValue) {
    107107        reportProtocolError(&callId, InvalidRequest, ASCIILiteral("'method' property wasn't found"));
  • trunk/Source/JavaScriptCore/inspector/ScriptCallStackFactory.cpp

    r164824 r173120  
    125125    *columnNumber = columnValue && columnValue.isNumber() ? int(columnValue.toNumber(exec)) : 0;
    126126    JSValue sourceURLValue = exceptionObject->getDirect(exec->vm(), Identifier(exec, "sourceURL"));
    127     *sourceURL = sourceURLValue && sourceURLValue.isString() ? sourceURLValue.toString(exec)->value(exec) : String("undefined");
     127    *sourceURL = sourceURLValue && sourceURLValue.isString() ? sourceURLValue.toString(exec)->value(exec) : ASCIILiteral("undefined");
    128128    exec->clearException();
    129129}
  • trunk/Source/JavaScriptCore/inspector/scripts/codegen/generator_templates.py

    • Property svn:executable set to *
    r172930 r173120  
    130130${dispatchCases}
    131131    else
    132         m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, String("'") + "${domainName}" + '.' + method + "' was not found");
     132        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found"));
    133133}""")
    134134
    … …  
    155155    HashMap<String, CallHandler>::iterator it = dispatchMap.find(method);
    156156    if (it == dispatchMap.end()) {
    157         m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, String("'") + "${domainName}" + '.' + method + "' was not found");
     157        m_backendDispatcher->reportProtocolError(&callId, InspectorBackendDispatcher::MethodNotFound, makeString('\\'', "${domainName}", '.', method, "' was not found"));
    158158        return;
    159159    }
  • trunk/Source/JavaScriptCore/interpreter/StackVisitor.cpp

    r172867 r173120  
    197197    switch (codeType()) {
    198198    case CodeType::Eval:
    199         traceLine = "eval code";
     199        traceLine = ASCIILiteral("eval code");
    200200        break;
    201201    case CodeType::Native:
    … …  
    207207        break;
    208208    case CodeType::Global:
    209         traceLine = "global code";
     209        traceLine = ASCIILiteral("global code");
    210210        break;
    211211    }
    … …  
    227227    }
    228228    case CodeType::Native:
    229         traceLine = "[native code]";
     229        traceLine = ASCIILiteral("[native code]");
    230230        break;
    231231    }
  • trunk/Source/JavaScriptCore/jit/JITOperations.cpp

    r173082 r173120  
    970970    RegExp* regexp = static_cast<RegExp*>(regexpPtr);
    971971    if (!regexp->isValid()) {
    972         vm.throwException(exec, createSyntaxError(exec, "Invalid flags supplied to RegExp constructor."));
     972        vm.throwException(exec, createSyntaxError(exec, ASCIILiteral("Invalid flags supplied to RegExp constructor.")));
    973973        return JSValue::encode(jsUndefined());
    974974    }
    … …  
    16161616    JSValue result = jsBoolean(couldDelete);
    16171617    if (!couldDelete && exec->codeBlock()->isStrictMode())
    1618         vm.throwException(exec, createTypeError(exec, "Unable to delete property."));
     1618        vm.throwException(exec, createTypeError(exec, ASCIILiteral("Unable to delete property.")));
    16191619    return JSValue::encode(result);
    16201620}
  • trunk/Source/JavaScriptCore/jsc.cpp

    r173018 r173120  
    715715    JSObject* object = jsDynamicCast<JSObject*>(exec->argument(0));
    716716    if (!object)
    717         return JSValue::encode(jsString(exec, "<not object>"));
    718     return JSValue::encode(jsString(exec, toString("<Public length: ", object->getArrayLength(), "; vector length: ", object->getVectorLength(), ">")));
     717        return JSValue::encode(jsNontrivialString(exec, ASCIILiteral("<not object>")));
     718    return JSValue::encode(jsNontrivialString(exec, toString("<Public length: ", object->getArrayLength(), "; vector length: ", object->getVectorLength(), ">")));
    719719}
    720720
    … …  
    870870    Vector<char> script;
    871871    if (!fillBufferWithContentsOfFile(fileName, script))
    872         return JSValue::encode(exec->vm().throwException(exec, createError(exec, "Could not open file.")));
     872        return JSValue::encode(exec->vm().throwException(exec, createError(exec, ASCIILiteral("Could not open file."))));
    873873
    874874    GlobalObject* globalObject = GlobalObject::create(exec->vm(), GlobalObject::createStructure(exec->vm(), jsNull()), Vector<String>());
    … …  
    899899    Vector<char> script;
    900900    if (!fillBufferWithContentsOfFile(fileName, script))
    901         return JSValue::encode(exec->vm().throwException(exec, createError(exec, "Could not open file.")));
     901        return JSValue::encode(exec->vm().throwException(exec, createError(exec, ASCIILiteral("Could not open file."))));
    902902
    903903    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    … …  
    915915    Vector<char> script;
    916916    if (!fillBufferWithContentsOfFile(fileName, script))
    917         return JSValue::encode(exec->vm().throwException(exec, createError(exec, "Could not open file.")));
     917        return JSValue::encode(exec->vm().throwException(exec, createError(exec, ASCIILiteral("Could not open file."))));
    918918
    919919    return JSValue::encode(jsString(exec, stringFromUTF(script.data())));
    … …  
    925925    Vector<char> script;
    926926    if (!fillBufferWithContentsOfFile(fileName, script))
    927         return JSValue::encode(exec->vm().throwException(exec, createError(exec, "Could not open file.")));
     927        return JSValue::encode(exec->vm().throwException(exec, createError(exec, ASCIILiteral("Could not open file."))));
    928928
    929929    JSGlobalObject* globalObject = exec->lexicalGlobalObject();
    … …  
    10121012{
    10131013    if (exec->argumentCount() < 1)
    1014         return JSValue::encode(exec->vm().throwException(exec, createError(exec, "Not enough arguments")));
     1014        return JSValue::encode(exec->vm().throwException(exec, createError(exec, ASCIILiteral("Not enough arguments"))));
    10151015   
    10161016    JSArrayBuffer* buffer = jsDynamicCast<JSArrayBuffer*>(exec->argument(0));
    10171017    if (!buffer)
    1018         return JSValue::encode(exec->vm().throwException(exec, createError(exec, "Expected an array buffer")));
     1018        return JSValue::encode(exec->vm().throwException(exec, createError(exec, ASCIILiteral("Expected an array buffer"))));
    10191019   
    10201020    ArrayBufferContents dummyContents;
    … …  
    11871187        } else {
    11881188            script = scripts[i].argument;
    1189             fileName = "[Command Line]";
     1189            fileName = ASCIILiteral("[Command Line]");
    11901190        }
    11911191
    … …  
    12291229static void runInteractive(GlobalObject* globalObject)
    12301230{
    1231     String interpreterName("Interpreter");
     1231    String interpreterName(ASCIILiteral("Interpreter"));
    12321232   
    12331233    bool shouldQuit = false;
  • trunk/Source/JavaScriptCore/parser/Lexer.cpp

    r172380 r173120  
    507507    switch (m_current) {
    508508    case 0:
    509         return "Invalid character: '\\0'";
     509        return ASCIILiteral("Invalid character: '\\0'");
    510510    case 10:
    511         return "Invalid character: '\\n'";
     511        return ASCIILiteral("Invalid character: '\\n'");
    512512    case 11:
    513         return "Invalid character: '\\v'";
     513        return ASCIILiteral("Invalid character: '\\v'");
    514514    case 13:
    515         return "Invalid character: '\\r'";
     515        return ASCIILiteral("Invalid character: '\\r'");
    516516    case 35:
    517         return "Invalid character: '#'";
     517        return ASCIILiteral("Invalid character: '#'");
    518518    case 64:
    519         return "Invalid character: '@'";
     519        return ASCIILiteral("Invalid character: '@'");
    520520    case 96:
    521         return "Invalid character: '`'";
     521        return ASCIILiteral("Invalid character: '`'");
    522522    default:
    523         return String::format("Invalid character '\\u%04u'", static_cast<unsigned>(m_current)).impl();
     523        return String::format("Invalid character '\\u%04u'", static_cast<unsigned>(m_current));
    524524    }
    525525}
    … …  
    10271027                shift();
    10281028                if (!isASCIIHexDigit(m_current) || !isASCIIHexDigit(peek(1))) {
    1029                     m_lexErrorMessage = "\\x can only be followed by a hex character sequence";
     1029                    m_lexErrorMessage = ASCIILiteral("\\x can only be followed by a hex character sequence");
    10301030                    return (atEnd() || (isASCIIHexDigit(m_current) && (m_code + 1 == m_codeEnd))) ? StringUnterminated : StringCannotBeParsed;
    10311031                }
    … …  
    10921092                shift();
    10931093                if (!isASCIIHexDigit(m_current) || !isASCIIHexDigit(peek(1))) {
    1094                     m_lexErrorMessage = "\\x can only be followed by a hex character sequence";
     1094                    m_lexErrorMessage = ASCIILiteral("\\x can only be followed by a hex character sequence");
    10951095                    return StringCannotBeParsed;
    10961096                }
    … …  
    11101110                        record16('u');
    11111111                } else {
    1112                     m_lexErrorMessage = "\\u can only be followed by a Unicode character sequence";
     1112                    m_lexErrorMessage = ASCIILiteral("\\u can only be followed by a Unicode character sequence");
    11131113                    return character.valueType() == UnicodeHexValue::IncompleteHex ? StringUnterminated : StringCannotBeParsed;
    11141114                }
    … …  
    11181118                shift();
    11191119                if (character1 != '0' || isASCIIDigit(m_current)) {
    1120                     m_lexErrorMessage = "The only valid numeric escape in strict mode is '\\0'";
     1120                    m_lexErrorMessage = ASCIILiteral("The only valid numeric escape in strict mode is '\\0'");
    11211121                    return StringCannotBeParsed;
    11221122                }
    … …  
    11481148                shift();
    11491149            } else {
    1150                 m_lexErrorMessage = "Unterminated string constant";
     1150                m_lexErrorMessage = ASCIILiteral("Unterminated string constant");
    11511151                return StringUnterminated;
    11521152            }
    … …  
    11611161            // New-line or end of input is not allowed
    11621162            if (atEnd() || isLineTerminator(m_current)) {
    1163                 m_lexErrorMessage = "Unexpected EOF";
     1163                m_lexErrorMessage = ASCIILiteral("Unexpected EOF");
    11641164                return atEnd() ? StringUnterminated : StringCannotBeParsed;
    11651165            }
    … …  
    15231523            if (parseMultilineComment())
    15241524                goto start;
    1525             m_lexErrorMessage = "Multiline comment was not closed properly";
     1525            m_lexErrorMessage = ASCIILiteral("Multiline comment was not closed properly");
    15261526            token = UNTERMINATED_MULTILINE_COMMENT_ERRORTOK;
    15271527            goto returnError;
    … …  
    16491649        if ((m_current | 0x20) == 'x') {
    16501650            if (!isASCIIHexDigit(peek(1))) {
    1651                 m_lexErrorMessage = "No hexadecimal digits after '0x'";
     1651                m_lexErrorMessage = ASCIILiteral("No hexadecimal digits after '0x'");
    16521652                token = INVALID_HEX_NUMBER_ERRORTOK;
    16531653                goto returnError;
    … …  
    16551655            parseHex(tokenData->doubleValue);
    16561656            if (isIdentStart(m_current)) {
    1657                 m_lexErrorMessage = "No space between hexadecimal literal and identifier";
     1657                m_lexErrorMessage = ASCIILiteral("No space between hexadecimal literal and identifier");
    16581658                token = INVALID_HEX_NUMBER_ERRORTOK;
    16591659                goto returnError;
    … …  
    16661666        record8('0');
    16671667        if (strictMode && isASCIIDigit(m_current)) {
    1668             m_lexErrorMessage = "Decimal integer literals with a leading zero are forbidden in strict mode";
     1668            m_lexErrorMessage = ASCIILiteral("Decimal integer literals with a leading zero are forbidden in strict mode");
    16691669            token = INVALID_OCTAL_NUMBER_ERRORTOK;
    16701670            goto returnError;
    … …  
    16861686                if ((m_current | 0x20) == 'e') {
    16871687                    if (!parseNumberAfterExponentIndicator()) {
    1688                         m_lexErrorMessage = "Non-number found after exponent indicator";
     1688                        m_lexErrorMessage = ASCIILiteral("Non-number found after exponent indicator");
    16891689                        token = atEnd() ? UNTERMINATED_NUMERIC_LITERAL_ERRORTOK : INVALID_NUMERIC_LITERAL_ERRORTOK;
    16901690                        goto returnError;
    … …  
    16991699        // No identifiers allowed directly after numeric literal, e.g. "3in" is bad.
    17001700        if (UNLIKELY(isIdentStart(m_current))) {
    1701             m_lexErrorMessage = "At least one digit must occur after a decimal point";
     1701            m_lexErrorMessage = ASCIILiteral("At least one digit must occur after a decimal point");
    17021702            token = atEnd() ? UNTERMINATED_NUMERIC_LITERAL_ERRORTOK : INVALID_NUMERIC_LITERAL_ERRORTOK;
    17031703            goto returnError;
    … …  
    17501750    default:
    17511751        RELEASE_ASSERT_NOT_REACHED();
    1752         m_lexErrorMessage = "Internal Error";
     1752        m_lexErrorMessage = ASCIILiteral("Internal Error");
    17531753        token = ERRORTOK;
    17541754        goto returnError;
  • trunk/Source/JavaScriptCore/profiler/Profile.cpp

    r163140 r173120  
    4444    // FIXME: When multi-threading is supported this will be a vector and calls
    4545    // into the profiler will need to know which thread it is executing on.
    46     m_head = ProfileNode::create(0, CallIdentifier("Thread_1", String(), 0, 0), 0, 0);
     46    m_head = ProfileNode::create(0, CallIdentifier(ASCIILiteral("Thread_1"), String(), 0, 0), 0, 0);
    4747}
    4848
  • trunk/Source/JavaScriptCore/runtime/Arguments.cpp

    r172176 r173120  
    436436    Arguments* arguments = jsDynamicCast<Arguments*>(thisObj);
    437437    if (!arguments)
    438         return JSValue::encode(throwTypeError(exec, "Attempted to use Arguments iterator on non-Arguments object"));
     438        return JSValue::encode(throwTypeError(exec, ASCIILiteral("Attempted to use Arguments iterator on non-Arguments object")));
    439439    return JSValue::encode(JSArgumentsIterator::create(exec->vm(), exec->callee()->globalObject()->argumentsIteratorStructure(), arguments));
    440440}
  • trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp

    r172756 r173120  
    695695                    return false;
    696696            } else if (!thisObj->methodTable(exec->vm())->deletePropertyByIndex(thisObj, exec, i)) {
    697                 throwTypeError(exec, "Unable to delete property.");
     697                throwTypeError(exec, ASCIILiteral("Unable to delete property."));
    698698                return false;
    699699            }
    … …  
    703703                    return false;
    704704            } else if (!thisObj->methodTable(exec->vm())->deletePropertyByIndex(thisObj, exec, themin)) {
    705                 throwTypeError(exec, "Unable to delete property.");
     705                throwTypeError(exec, ASCIILiteral("Unable to delete property."));
    706706                return false;
    707707            }
    … …  
    768768       
    769769        if (!thisObj->methodTable(exec->vm())->deletePropertyByIndex(thisObj, exec, index)) {
    770             throwTypeError(exec, "Unable to delete property.");
     770            throwTypeError(exec, ASCIILiteral("Unable to delete property."));
    771771            return JSValue::encode(jsUndefined());
    772772        }
  • trunk/Source/JavaScriptCore/runtime/ExceptionHelpers.cpp

    r171824 r173120  
    123123JSObject* createError(ExecState* exec, ErrorFactory errorFactory, JSValue value, const String& message)
    124124{
    125     String errorMessage = makeString(errorDescriptionForValue(exec, value)->value(exec), " ", message);
     125    String errorMessage = makeString(errorDescriptionForValue(exec, value)->value(exec), ' ', message);
    126126    JSObject* exception = errorFactory(exec, errorMessage);
    127127    ASSERT(exception->isErrorInstance());
    … …  
    132132JSObject* createInvalidParameterError(ExecState* exec, const char* op, JSValue value)
    133133{
    134     return createError(exec, createTypeError, value, makeString("is not a valid argument for '", op, "'"));
     134    return createError(exec, createTypeError, value, makeString("is not a valid argument for '", op, '\''));
    135135}
    136136
    137137JSObject* createNotAConstructorError(ExecState* exec, JSValue value)
    138138{
    139     return createError(exec, createTypeError, value, "is not a constructor");
     139    return createError(exec, createTypeError, value, ASCIILiteral("is not a constructor"));
    140140}
    141141
    142142JSObject* createNotAFunctionError(ExecState* exec, JSValue value)
    143143{
    144     return createError(exec, createTypeError, value, "is not a function");
     144    return createError(exec, createTypeError, value, ASCIILiteral("is not a function"));
    145145}
    146146
    147147JSObject* createNotAnObjectError(ExecState* exec, JSValue value)
    148148{
    149     return createError(exec, createTypeError, value, "is not an object");
     149    return createError(exec, createTypeError, value, ASCIILiteral("is not an object"));
    150150}
    151151
    152152JSObject* createErrorForInvalidGlobalAssignment(ExecState* exec, const String& propertyName)
    153153{
    154     return createReferenceError(exec, makeString("Strict mode forbids implicit creation of global property '", propertyName, "'"));
     154    return createReferenceError(exec, makeString("Strict mode forbids implicit creation of global property '", propertyName, '\''));
    155155}
    156156
  • trunk/Source/JavaScriptCore/runtime/FunctionPrototype.cpp

    r171824 r173120  
    8686{
    8787    if (!bodyIncludesBraces)
    88         functionBody = makeString("{ ", functionBody, "}");
     88        functionBody = makeString("{ ", functionBody, '}');
    8989
    9090    ASSERT(functionBody[0] == '{');
    … …  
    9595        if (!Lexer<UChar>::isWhiteSpace(ch) && !Lexer<UChar>::isLineTerminator(ch)) {
    9696            if (ch != ';' && ch != '}')
    97                 functionBody = makeString(functionBody.substringSharingImpl(0, i + 1), ";", functionBody.substringSharingImpl(i + 1, functionBody.length() - (i + 1)));
     97                functionBody = makeString(functionBody.substringSharingImpl(0, i + 1), ';', functionBody.substringSharingImpl(i + 1, functionBody.length() - (i + 1)));
    9898            return;
    9999        }
  • trunk/Source/JavaScriptCore/runtime/JSArray.cpp

    r172176 r173120  
    109109        // d. If newLen is not equal to ToNumber( Desc.[[Value]]), throw a RangeError exception.
    110110        if (newLen != descriptor.value().toNumber(exec)) {
    111             exec->vm().throwException(exec, createRangeError(exec, "Invalid array length"));
     111            exec->vm().throwException(exec, createRangeError(exec, ASCIILiteral("Invalid array length")));
    112112            return false;
    113113        }
    … …  
    524524    // Call the [[Delete]] internal method of O with arguments indx and true.
    525525    if (!deletePropertyByIndex(this, exec, index)) {
    526         throwTypeError(exec, "Unable to delete property.");
     526        throwTypeError(exec, ASCIILiteral("Unable to delete property."));
    527527        return jsUndefined();
    528528    }
    … …  
    568568            methodTable(exec->vm())->putByIndex(this, exec, length, value, true);
    569569            if (!exec->hadException())
    570                 exec->vm().throwException(exec, createRangeError(exec, "Invalid array length"));
     570                exec->vm().throwException(exec, createRangeError(exec, ASCIILiteral("Invalid array length")));
    571571            return;
    572572        }
    … …  
    588588            methodTable(exec->vm())->putByIndex(this, exec, length, value, true);
    589589            if (!exec->hadException())
    590                 exec->vm().throwException(exec, createRangeError(exec, "Invalid array length"));
     590                exec->vm().throwException(exec, createRangeError(exec, ASCIILiteral("Invalid array length")));
    591591            return;
    592592        }
    … …  
    620620            methodTable(exec->vm())->putByIndex(this, exec, length, value, true);
    621621            if (!exec->hadException())
    622                 exec->vm().throwException(exec, createRangeError(exec, "Invalid array length"));
     622                exec->vm().throwException(exec, createRangeError(exec, ASCIILiteral("Invalid array length")));
    623623            return;
    624624        }
    … …  
    655655            // Per ES5.1 15.4.4.7 step 6 & 15.4.5.1 step 3.d.
    656656            if (!exec->hadException())
    657                 exec->vm().throwException(exec, createRangeError(exec, "Invalid array length"));
     657                exec->vm().throwException(exec, createRangeError(exec, ASCIILiteral("Invalid array length")));
    658658            return;
    659659        }
  • trunk/Source/JavaScriptCore/runtime/JSArrayBufferConstructor.cpp

    r171824 r173120  
    5050void JSArrayBufferConstructor::finishCreation(VM& vm, JSArrayBufferPrototype* prototype)
    5151{
    52     Base::finishCreation(vm, "ArrayBuffer");
     52    Base::finishCreation(vm, ASCIILiteral("ArrayBuffer"));
    5353    putDirectWithoutTransition(vm, vm.propertyNames->prototype, prototype, DontEnum | DontDelete | ReadOnly);
    5454    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), DontEnum | DontDelete | ReadOnly);
  • trunk/Source/JavaScriptCore/runtime/JSArrayBufferPrototype.cpp

    r171824 r173120  
    4242    JSArrayBuffer* thisObject = jsDynamicCast<JSArrayBuffer*>(exec->thisValue());
    4343    if (!thisObject)
    44         return throwVMError(exec, createTypeError(exec, "Receiver of slice must be an array buffer."));
     44        return throwVMError(exec, createTypeError(exec, ASCIILiteral("Receiver of slice must be an array buffer.")));
    4545   
    4646    if (!exec->argumentCount())
    47         return throwVMError(exec, createTypeError(exec, "Slice requires at least one argument."));
     47        return throwVMError(exec, createTypeError(exec, ASCIILiteral("Slice requires at least one argument.")));
    4848   
    4949    int32_t begin = exec->argument(0).toInt32(exec);
  • trunk/Source/JavaScriptCore/runtime/JSDataView.cpp

    r171824 r173120  
    4949    RefPtr<ArrayBuffer> buffer = passedBuffer;
    5050    if (!ArrayBufferView::verifySubRangeLength(buffer, byteOffset, byteLength, sizeof(uint8_t))) {
    51         throwVMError(exec, createRangeError(exec, "Length out of range of buffer"));
     51        throwVMError(exec, createRangeError(exec, ASCIILiteral("Length out of range of buffer")));
    5252        return nullptr;
    5353    }
    5454    if (!ArrayBufferView::verifyByteOffsetAlignment(byteOffset, sizeof(uint8_t))) {
    55         exec->vm().throwException(exec, createRangeError(exec, "Byte offset is not aligned"));
     55        exec->vm().throwException(exec, createRangeError(exec, ASCIILiteral("Byte offset is not aligned")));
    5656        return nullptr;
    5757    }
  • trunk/Source/JavaScriptCore/runtime/JSDataViewPrototype.cpp

    r172793 r173120  
    120120    JSDataView* dataView = jsDynamicCast<JSDataView*>(exec->thisValue());
    121121    if (!dataView)
    122         return throwVMError(exec, createTypeError(exec, "Receiver of DataView method must be a DataView"));
     122        return throwVMError(exec, createTypeError(exec, ASCIILiteral("Receiver of DataView method must be a DataView")));
    123123   
    124124    if (!exec->argumentCount())
    125         return throwVMError(exec, createTypeError(exec, "Need at least one argument (the byteOffset)"));
     125        return throwVMError(exec, createTypeError(exec, ASCIILiteral("Need at least one argument (the byteOffset)")));
    126126   
    127127    unsigned byteOffset = exec->uncheckedArgument(0).toUInt32(exec);
    … …  
    139139    unsigned byteLength = dataView->length();
    140140    if (elementSize > byteLength || byteOffset > byteLength - elementSize)
    141         return throwVMError(exec, createRangeError(exec, "Out of bounds access"));
     141        return throwVMError(exec, createRangeError(exec, ASCIILiteral("Out of bounds access")));
    142142
    143143    const unsigned dataSize = sizeof(typename Adaptor::Type);
    … …  
    165165    JSDataView* dataView = jsDynamicCast<JSDataView*>(exec->thisValue());
    166166    if (!dataView)
    167         return throwVMError(exec, createTypeError(exec, "Receiver of DataView method must be a DataView"));
     167        return throwVMError(exec, createTypeError(exec, ASCIILiteral("Receiver of DataView method must be a DataView")));
    168168   
    169169    if (exec->argumentCount() < 2)
    170         return throwVMError(exec, createTypeError(exec, "Need at least two argument (the byteOffset and value)"));
     170        return throwVMError(exec, createTypeError(exec, ASCIILiteral("Need at least two argument (the byteOffset and value)")));
    171171   
    172172    unsigned byteOffset = exec->uncheckedArgument(0).toUInt32(exec);
    … …  
    194194    unsigned byteLength = dataView->length();
    195195    if (elementSize > byteLength || byteOffset > byteLength - elementSize)
    196         return throwVMError(exec, createRangeError(exec, "Out of bounds access"));
     196        return throwVMError(exec, createRangeError(exec, ASCIILiteral("Out of bounds access")));
    197197
    198198    uint8_t* dataPtr = static_cast<uint8_t*>(dataView->vector()) + byteOffset;
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp

    r173100 r173120  
    441441   
    442442    std::array<InternalFunction*, NUMBER_OF_TYPED_ARRAY_TYPES> typedArrayConstructors;
    443     typedArrayConstructors[toIndex(TypeInt8)] = JSInt8ArrayConstructor::create(vm, JSInt8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt8)].prototype.get(), "Int8Array");
    444     typedArrayConstructors[toIndex(TypeInt16)] = JSInt16ArrayConstructor::create(vm, JSInt16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt16)].prototype.get(), "Int16Array");
    445     typedArrayConstructors[toIndex(TypeInt32)] = JSInt32ArrayConstructor::create(vm, JSInt32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt32)].prototype.get(), "Int32Array");
    446     typedArrayConstructors[toIndex(TypeUint8)] = JSUint8ArrayConstructor::create(vm, JSUint8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8)].prototype.get(), "Uint8Array");
    447     typedArrayConstructors[toIndex(TypeUint8Clamped)] = JSUint8ClampedArrayConstructor::create(vm, JSUint8ClampedArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8Clamped)].prototype.get(), "Uint8ClampedArray");
    448     typedArrayConstructors[toIndex(TypeUint16)] = JSUint16ArrayConstructor::create(vm, JSUint16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint16)].prototype.get(), "Uint16Array");
    449     typedArrayConstructors[toIndex(TypeUint32)] = JSUint32ArrayConstructor::create(vm, JSUint32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint32)].prototype.get(), "Uint32Array");
    450     typedArrayConstructors[toIndex(TypeFloat32)] = JSFloat32ArrayConstructor::create(vm, JSFloat32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat32)].prototype.get(), "Float32Array");
    451     typedArrayConstructors[toIndex(TypeFloat64)] = JSFloat64ArrayConstructor::create(vm, JSFloat64ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat64)].prototype.get(), "Float64Array");
    452     typedArrayConstructors[toIndex(TypeDataView)] = JSDataViewConstructor::create(vm, JSDataViewConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeDataView)].prototype.get(), "DataView");
     443    typedArrayConstructors[toIndex(TypeInt8)] = JSInt8ArrayConstructor::create(vm, JSInt8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt8)].prototype.get(), ASCIILiteral("Int8Array"));
     444    typedArrayConstructors[toIndex(TypeInt16)] = JSInt16ArrayConstructor::create(vm, JSInt16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt16)].prototype.get(), ASCIILiteral("Int16Array"));
     445    typedArrayConstructors[toIndex(TypeInt32)] = JSInt32ArrayConstructor::create(vm, JSInt32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeInt32)].prototype.get(), ASCIILiteral("Int32Array"));
     446    typedArrayConstructors[toIndex(TypeUint8)] = JSUint8ArrayConstructor::create(vm, JSUint8ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8)].prototype.get(), ASCIILiteral("Uint8Array"));
     447    typedArrayConstructors[toIndex(TypeUint8Clamped)] = JSUint8ClampedArrayConstructor::create(vm, JSUint8ClampedArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint8Clamped)].prototype.get(), ASCIILiteral("Uint8ClampedArray"));
     448    typedArrayConstructors[toIndex(TypeUint16)] = JSUint16ArrayConstructor::create(vm, JSUint16ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint16)].prototype.get(), ASCIILiteral("Uint16Array"));
     449    typedArrayConstructors[toIndex(TypeUint32)] = JSUint32ArrayConstructor::create(vm, JSUint32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeUint32)].prototype.get(), ASCIILiteral("Uint32Array"));
     450    typedArrayConstructors[toIndex(TypeFloat32)] = JSFloat32ArrayConstructor::create(vm, JSFloat32ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat32)].prototype.get(), ASCIILiteral("Float32Array"));
     451    typedArrayConstructors[toIndex(TypeFloat64)] = JSFloat64ArrayConstructor::create(vm, JSFloat64ArrayConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeFloat64)].prototype.get(), ASCIILiteral("Float64Array"));
     452    typedArrayConstructors[toIndex(TypeDataView)] = JSDataViewConstructor::create(vm, JSDataViewConstructor::createStructure(vm, this, m_functionPrototype.get()), m_typedArrays[toIndex(TypeDataView)].prototype.get(), ASCIILiteral("DataView"));
    453453
    454454    for (unsigned typedArrayIndex = NUMBER_OF_TYPED_ARRAY_TYPES; typedArrayIndex--;) {
  • trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp

    r167394 r173120  
    803803
    804804    if (!thisObject->setPrototypeWithCycleCheck(exec, value))
    805         exec->vm().throwException(exec, createError(exec, "cyclic __proto__ value"));
     805        exec->vm().throwException(exec, createError(exec, ASCIILiteral("cyclic __proto__ value")));
    806806    return JSValue::encode(jsUndefined());
    807807}
  • trunk/Source/JavaScriptCore/runtime/JSPromiseConstructor.cpp

    r171824 r173120  
    8686void JSPromiseConstructor::finishCreation(VM& vm, JSPromisePrototype* promisePrototype)
    8787{
    88     Base::finishCreation(vm, "Promise");
     88    Base::finishCreation(vm, ASCIILiteral("Promise"));
    8989    putDirectWithoutTransition(vm, vm.propertyNames->prototype, promisePrototype, DontEnum | DontDelete | ReadOnly);
    9090    putDirectWithoutTransition(vm, vm.propertyNames->length, jsNumber(1), ReadOnly | DontEnum | DontDelete);
  • trunk/Source/JavaScriptCore/runtime/LiteralParser.cpp

    r163844 r173120  
    282282        }
    283283    }
    284     m_lexErrorMessage = String::format("Unrecognized token '%c'", *m_ptr).impl();
     284    m_lexErrorMessage = String::format("Unrecognized token '%c'", *m_ptr);
    285285    return TokError;
    286286}
    … …  
    407407                    for (int i = 1; i < 5; i++) {
    408408                        if (!isASCIIHexDigit(m_ptr[i])) {
    409                             m_lexErrorMessage = String::format("\"\\%s\" is not a valid unicode escape", String(m_ptr, 5).ascii().data()).impl();
     409                            m_lexErrorMessage = String::format("\"\\%s\" is not a valid unicode escape", String(m_ptr, 5).ascii().data());
    410410                            return TokError;
    411411                        }
    … …  
    421421                        break;
    422422                    }
    423                     m_lexErrorMessage = String::format("Invalid escape character %c", *m_ptr).impl();
     423                    m_lexErrorMessage = String::format("Invalid escape character %c", *m_ptr);
    424424                    return TokError;
    425425            }
    … …  
    712712                        const LiteralParserToken<CharType>& token = m_lexer.currentToken();
    713713                        if (token.stringIs8Bit)
    714                             m_parseErrorMessage = String::format("Unexpected identifier \"%s\"", String(m_lexer.currentToken().stringToken8, m_lexer.currentToken().stringLength).ascii().data()).impl();
     714                            m_parseErrorMessage = String::format("Unexpected identifier \"%s\"", String(m_lexer.currentToken().stringToken8, m_lexer.currentToken().stringLength).ascii().data());
    715715                        else
    716                             m_parseErrorMessage = String::format("Unexpected identifier \"%s\"", String(m_lexer.currentToken().stringToken16, m_lexer.currentToken().stringLength).ascii().data()).impl();
     716                            m_parseErrorMessage = String::format("Unexpected identifier \"%s\"", String(m_lexer.currentToken().stringToken16, m_lexer.currentToken().stringLength).ascii().data());
    717717                        return JSValue();
    718718                    }
  • trunk/Source/JavaScriptCore/runtime/LiteralParser.h

    r160344 r173120  
    9999    {
    100100        if (!m_lexer.getErrorMessage().isEmpty())
    101             return String::format("JSON Parse error: %s", m_lexer.getErrorMessage().ascii().data()).impl();
     101            return String::format("JSON Parse error: %s", m_lexer.getErrorMessage().ascii().data());
    102102        if (!m_parseErrorMessage.isEmpty())
    103             return String::format("JSON Parse error: %s", m_parseErrorMessage.ascii().data()).impl();
     103            return String::format("JSON Parse error: %s", m_parseErrorMessage.ascii().data());
    104104        return ASCIILiteral("JSON Parse error: Unable to parse JSON string");
    105105    }
  • trunk/Source/JavaScriptCore/runtime/TypeSet.cpp

    r172976 r173120  
    100100{
    101101    if (m_seenTypes == TypeNothing)
    102         return "(Unreached Statement)";
     102        return ASCIILiteral("(Unreached Statement)");
    103103
    104104    StringBuilder seen;
    … …  
    124124        RefPtr<StructureShape> shape = m_structureHistory.at(i);
    125125        seen.append(shape->m_constructorName);
    126         seen.append(" ");
     126        seen.append(' ');
    127127    }
    128128
    … …  
    131131    for (size_t i = 0; i < m_structureHistory.size(); i++) {
    132132        seen.append(m_structureHistory.at(i)->stringRepresentation());
    133         seen.append(" ");
     133        seen.append(' ');
    134134    }
    135135    if (m_structureHistory.size())
    136         seen.append("]");
     136        seen.append(']');
    137137
    138138    if (m_structureHistory.size()) {
    … …  
    167167{
    168168    if (m_seenTypes == TypeNothing)
    169         return "";
     169        return emptyString();
    170170
    171171    if (m_structureHistory.size() && doesTypeConformTo(TypeObject | TypeNull | TypeUndefined)) {
    … …  
    174174        if (doesTypeConformTo(TypeObject))
    175175            return ctorName;
    176         else if (doesTypeConformTo(TypeObject | TypeNull | TypeUndefined))
    177             return ctorName + "?";
     176        if (doesTypeConformTo(TypeObject | TypeNull | TypeUndefined))
     177            return ctorName + '?';
    178178    }
    179179
    … …  
    182182
    183183    if (doesTypeConformTo(TypeFunction))
    184         return "Function";
     184        return ASCIILiteral("Function");
    185185    if (doesTypeConformTo(TypeUndefined))
    186         return "Undefined";
     186        return ASCIILiteral("Undefined");
    187187    if (doesTypeConformTo(TypeNull))
    188         return "Null";
     188        return ASCIILiteral("Null");
    189189    if (doesTypeConformTo(TypeBoolean))
    190         return "Boolean";
     190        return ASCIILiteral("Boolean");
    191191    if (doesTypeConformTo(TypeMachineInt))
    192         return "Integer";
     192        return ASCIILiteral("Integer");
    193193    if (doesTypeConformTo(TypeNumber | TypeMachineInt))
    194         return "Number";
     194        return ASCIILiteral("Number");
    195195    if (doesTypeConformTo(TypeString))
    196         return "String";
     196        return ASCIILiteral("String");
    197197
    198198    if (doesTypeConformTo(TypeNull | TypeUndefined))
    199         return "(?)";
     199        return ASCIILiteral("(?)");
    200200
    201201    if (doesTypeConformTo(TypeFunction | TypeNull | TypeUndefined))
    202         return "Function?";
     202        return ASCIILiteral("Function?");
    203203    if (doesTypeConformTo(TypeBoolean | TypeNull | TypeUndefined))
    204         return "Boolean?";
     204        return ASCIILiteral("Boolean?");
    205205    if (doesTypeConformTo(TypeMachineInt | TypeNull | TypeUndefined))
    206         return "Integer?";
     206        return ASCIILiteral("Integer?");
    207207    if (doesTypeConformTo(TypeNumber | TypeMachineInt | TypeNull | TypeUndefined))
    208         return "Number?";
     208        return ASCIILiteral("Number?");
    209209    if (doesTypeConformTo(TypeString | TypeNull | TypeUndefined))
    210         return "String?";
     210        return ASCIILiteral("String?");
    211211   
    212212    if (doesTypeConformTo(TypeObject | TypeFunction | TypeString))
    213         return "Object";
     213        return ASCIILiteral("Object");
    214214    if (doesTypeConformTo(TypeObject | TypeFunction | TypeString | TypeNull | TypeUndefined))
    215         return "Object?";
    216 
    217     return "(many)";
     215        return ASCIILiteral("Object?");
     216
     217    return ASCIILiteral("(many)");
    218218}
    219219
    … …  
    222222    RefPtr<Inspector::Protocol::Array<String>> seen = Inspector::Protocol::Array<String>::create();
    223223    if (m_seenTypes & TypeUndefined)
    224          seen->addItem("Undefined");
     224        seen->addItem(ASCIILiteral("Undefined"));
    225225    if (m_seenTypes & TypeNull)
    226          seen->addItem("Null");
     226        seen->addItem(ASCIILiteral("Null"));
    227227    if (m_seenTypes & TypeBoolean)
    228          seen->addItem("Boolean");
     228        seen->addItem(ASCIILiteral("Boolean"));
    229229    if (m_seenTypes & TypeMachineInt)
    230          seen->addItem("Integer");
     230        seen->addItem(ASCIILiteral("Integer"));
    231231    if (m_seenTypes & TypeNumber)
    232          seen->addItem("Number");
     232        seen->addItem(ASCIILiteral("Number"));
    233233    if (m_seenTypes & TypeString)
    234          seen->addItem("String");
     234        seen->addItem(ASCIILiteral("String"));
    235235
    236236    return seen.release();
    … …  
    283283
    284284    StringBuilder builder;
    285     builder.append(":");
     285    builder.append(':');
    286286    builder.append(m_constructorName);
    287     builder.append(":");
     287    builder.append(':');
    288288   
    289289    for (auto iter = m_fields.begin(), end = m_fields.end(); iter != end; ++iter) {
    … …  
    294294
    295295    if (m_proto) {
    296         builder.append(":");
     296        builder.append(':');
    297297        builder.append("__proto__");
    298298        builder.append(m_proto->propertyHash());
    … …  
    340340    RefPtr<StructureShape> curShape = this;
    341341
    342     representation.append("{");
     342    representation.append('{');
    343343    while (curShape) {
    344344        for (auto it = curShape->m_fields.begin(), end = curShape->m_fields.end(); it != end; ++it) {
    … …  
    349349
    350350        if (curShape->m_proto) {
    351             String prot = String("__proto__") + String(" [") + curShape->m_proto->m_constructorName + String("]");
     351            String prot = makeString("__proto__ [", curShape->m_proto->m_constructorName, ']');
    352352            representation.append(prot);
    353353            representation.append(", ");
    … …  
    360360        representation.resize(representation.length() - 2);
    361361
    362     representation.append("}");
     362    representation.append('}');
    363363
    364364    return representation.toString();
  • trunk/Source/WTF/ChangeLog

    r173072 r173120  
     12014-08-29  Joseph Pecoraro  <pecoraro@apple.com>
     2
     3        JavaScriptCore: Use ASCIILiteral where possible
     4        https://bugs.webkit.org/show_bug.cgi?id=136179
     5
     6        Reviewed by Michael Saboff.
     7
     8        * wtf/text/WTFString.cpp:
     9        (asciiDebug):
     10
    1112014-08-27  Filip Pizlo  <fpizlo@apple.com>
    212
  • trunk/Source/WTF/wtf/text/WTFString.cpp

    r170774 r173120  
    12071207{
    12081208    if (!impl)
    1209         return asciiDebug(String("[null]").impl());
     1209        return asciiDebug(String(ASCIILiteral("[null]")).impl());
    12101210
    12111211    Vector<char> buffer;
Note: See TracChangeset for help on using the changeset viewer.