Ignore:
Timestamp:
Aug 29, 2014, 2:33:30 PM (11 years ago)
Author:
[email protected]
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):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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;
Note: See TracChangeset for help on using the changeset viewer.