Changeset 239187 in webkit


Ignore:
Timestamp:
Dec 13, 2018 4:19:23 PM (5 years ago)
Author:
ddkilzer@apple.com
Message:

clang-tidy: Fix unnecessary object copies in JavaScriptCore
<https://webkit.org/b/192680>
<rdar://problem/46708767>

Reviewed by Mark Lam.

  • assembler/testmasm.cpp:

(JSC::invoke):

  • Make MacroAssemblerCodeRef<JSEntryPtrTag> argument a const reference.
  • b3/testb3.cpp:

(JSC::B3::checkDisassembly):

  • Make CString argument a const reference.
  • dfg/DFGSpeculativeJIT.cpp:

(JSC::DFG::SpeculativeJIT::compileStringEquality):

  • dfg/DFGSpeculativeJIT.h:
  • dfg/DFGSpeculativeJIT32_64.cpp:

(JSC::DFG::SpeculativeJIT::cachedGetByIdWithThis):

  • dfg/DFGSpeculativeJIT64.cpp:

(JSC::DFG::SpeculativeJIT::cachedGetByIdWithThis):

  • Make JITCompiler::JumpList arguments a const reference.
  • ftl/FTLLowerDFGToB3.cpp:

(JSC::FTL::DFG::LowerDFGToB3::checkStructure):

  • Make RegisteredStructureSet argument a const reference.
  • jsc.cpp:

(GlobalObject::moduleLoaderImportModule): Make local auto
variables const references.
(Workers::report): Make String argument a const reference.
(addOption): Make Identifier argument a const reference.
(runJSC): Make CString loop variable a const reference.

Location:
trunk/Source/JavaScriptCore
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r239183 r239187  
     12018-12-13  David Kilzer  <ddkilzer@apple.com>
     2
     3        clang-tidy: Fix unnecessary object copies in JavaScriptCore
     4        <https://webkit.org/b/192680>
     5        <rdar://problem/46708767>
     6
     7        Reviewed by Mark Lam.
     8
     9        * assembler/testmasm.cpp:
     10        (JSC::invoke):
     11        - Make MacroAssemblerCodeRef<JSEntryPtrTag> argument a const
     12          reference.
     13
     14        * b3/testb3.cpp:
     15        (JSC::B3::checkDisassembly):
     16        - Make CString argument a const reference.
     17
     18        * dfg/DFGSpeculativeJIT.cpp:
     19        (JSC::DFG::SpeculativeJIT::compileStringEquality):
     20        * dfg/DFGSpeculativeJIT.h:
     21        * dfg/DFGSpeculativeJIT32_64.cpp:
     22        (JSC::DFG::SpeculativeJIT::cachedGetByIdWithThis):
     23        * dfg/DFGSpeculativeJIT64.cpp:
     24        (JSC::DFG::SpeculativeJIT::cachedGetByIdWithThis):
     25        - Make JITCompiler::JumpList arguments a const reference.
     26
     27        * ftl/FTLLowerDFGToB3.cpp:
     28        (JSC::FTL::DFG::LowerDFGToB3::checkStructure):
     29        - Make RegisteredStructureSet argument a const reference.
     30
     31        * jsc.cpp:
     32        (GlobalObject::moduleLoaderImportModule): Make local auto
     33        variables const references.
     34        (Workers::report): Make String argument a const reference.
     35        (addOption): Make Identifier argument a const reference.
     36        (runJSC): Make CString loop variable a const reference.
     37
    1382018-12-13  Devin Rousso  <drousso@apple.com>
    239
  • trunk/Source/JavaScriptCore/assembler/testmasm.cpp

    r238439 r239187  
    154154
    155155template<typename T, typename... Arguments>
    156 T invoke(MacroAssemblerCodeRef<JSEntryPtrTag> code, Arguments... arguments)
     156T invoke(const MacroAssemblerCodeRef<JSEntryPtrTag>& code, Arguments... arguments)
    157157{
    158158    void* executableAddress = untagCFunctionPtr<JSEntryPtrTag>(code.code().executableAddress());
  • trunk/Source/JavaScriptCore/b3/testb3.cpp

    r237173 r239187  
    165165
    166166template<typename Func>
    167 void checkDisassembly(Compilation& compilation, const Func& func, CString failText)
     167void checkDisassembly(Compilation& compilation, const Func& func, const CString& failText)
    168168{
    169169    CString disassembly = compilation.disassembly();
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp

    r239158 r239187  
    63146314    Node* node, GPRReg leftGPR, GPRReg rightGPR, GPRReg lengthGPR, GPRReg leftTempGPR,
    63156315    GPRReg rightTempGPR, GPRReg leftTemp2GPR, GPRReg rightTemp2GPR,
    6316     JITCompiler::JumpList fastTrue, JITCompiler::JumpList fastFalse)
     6316    const JITCompiler::JumpList& fastTrue, const JITCompiler::JumpList& fastFalse)
    63176317{
    63186318    JITCompiler::JumpList trueCase;
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h

    r239158 r239187  
    725725#if USE(JSVALUE64)
    726726    void cachedGetById(CodeOrigin, GPRReg baseGPR, GPRReg resultGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget, SpillRegistersMode, AccessType);
    727     void cachedGetByIdWithThis(CodeOrigin, GPRReg baseGPR, GPRReg thisGPR, GPRReg resultGPR, unsigned identifierNumber, JITCompiler::JumpList slowPathTarget = JITCompiler::JumpList());
     727    void cachedGetByIdWithThis(CodeOrigin, GPRReg baseGPR, GPRReg thisGPR, GPRReg resultGPR, unsigned identifierNumber, const JITCompiler::JumpList& slowPathTarget = JITCompiler::JumpList());
    728728#elif USE(JSVALUE32_64)
    729729    void cachedGetById(CodeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget, SpillRegistersMode, AccessType);
    730     void cachedGetByIdWithThis(CodeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg thisTagGPROrNone, GPRReg thisPayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, unsigned identifierNumber, JITCompiler::JumpList slowPathTarget = JITCompiler::JumpList());
     730    void cachedGetByIdWithThis(CodeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg thisTagGPROrNone, GPRReg thisPayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, unsigned identifierNumber, const JITCompiler::JumpList& slowPathTarget = JITCompiler::JumpList());
    731731#endif
    732732
     
    12001200        Node*, GPRReg leftGPR, GPRReg rightGPR, GPRReg lengthGPR,
    12011201        GPRReg leftTempGPR, GPRReg rightTempGPR, GPRReg leftTemp2GPR,
    1202         GPRReg rightTemp2GPR, JITCompiler::JumpList fastTrue,
    1203         JITCompiler::JumpList fastSlow);
     1202        GPRReg rightTemp2GPR, const JITCompiler::JumpList& fastTrue,
     1203        const JITCompiler::JumpList& fastSlow);
    12041204    void compileStringEquality(Node*);
    12051205    void compileStringIdentEquality(Node*);
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp

    r239158 r239187  
    229229void SpeculativeJIT::cachedGetByIdWithThis(
    230230    CodeOrigin codeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg thisTagGPR, GPRReg thisPayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR,
    231     unsigned identifierNumber, JITCompiler::JumpList slowPathTarget)
     231    unsigned identifierNumber, const JITCompiler::JumpList& slowPathTarget)
    232232{
    233233    RegisterSet usedRegisters = this->usedRegisters();
  • trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp

    r239158 r239187  
    188188}
    189189
    190 void SpeculativeJIT::cachedGetByIdWithThis(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg thisGPR, GPRReg resultGPR, unsigned identifierNumber, JITCompiler::JumpList slowPathTarget)
     190void SpeculativeJIT::cachedGetByIdWithThis(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg thisGPR, GPRReg resultGPR, unsigned identifierNumber, const JITCompiler::JumpList& slowPathTarget)
    191191{
    192192    CallSiteIndex callSite = m_jit.recordCallSiteAndGenerateExceptionHandlingOSRExitIfNeeded(codeOrigin, m_stream->size());
  • trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp

    r239158 r239187  
    1138611386    void checkStructure(
    1138711387        LValue structureDiscriminant, const FormattedValue& formattedValue, ExitKind exitKind,
    11388         RegisteredStructureSet set, const Functor& weakStructureDiscriminant)
     11388        const RegisteredStructureSet& set, const Functor& weakStructureDiscriminant)
    1138911389    {
    1139011390        if (set.isEmpty()) {
  • trunk/Source/JavaScriptCore/jsc.cpp

    r238766 r239187  
    217217
    218218template<typename Func>
    219 int runJSC(CommandLine, bool isWorker, const Func&);
     219int runJSC(const CommandLine&, bool isWorker, const Func&);
    220220static void checkException(ExecState*, GlobalObject*, bool isLastFile, bool hasException, JSValue, CommandLine&, bool& success);
    221221
     
    258258    void broadcast(const Func&);
    259259   
    260     void report(String);
     260    void report(const String&);
    261261    String tryGetReport();
    262262    String getReport();
     
    818818        return reject(createError(exec, "Could not resolve the module specifier."_s));
    819819
    820     auto referrer = sourceOrigin.string();
    821     auto moduleName = moduleNameValue->value(exec);
     820    const auto& referrer = sourceOrigin.string();
     821    const auto& moduleName = moduleNameValue->value(exec);
    822822    if (UNLIKELY(catchScope.exception()))
    823823        return reject(catchScope.exception());
     
    16441644}
    16451645
    1646 void Workers::report(String string)
     1646void Workers::report(const String& string)
    16471647{
    16481648    auto locker = holdLock(m_lock);
     
    19241924
    19251925template<typename ValueType>
    1926 typename std::enable_if<!std::is_fundamental<ValueType>::value>::type addOption(VM&, JSObject*, Identifier, ValueType) { }
     1926typename std::enable_if<!std::is_fundamental<ValueType>::value>::type addOption(VM&, JSObject*, const Identifier&, ValueType) { }
    19271927
    19281928template<typename ValueType>
    1929 typename std::enable_if<std::is_fundamental<ValueType>::value>::type addOption(VM& vm, JSObject* optionsObject, Identifier identifier, ValueType value)
     1929typename std::enable_if<std::is_fundamental<ValueType>::value>::type addOption(VM& vm, JSObject* optionsObject, const Identifier& identifier, ValueType value)
    19301930{
    19311931    optionsObject->putDirect(vm, identifier, JSValue(value));
     
    27602760
    27612761template<typename Func>
    2762 int runJSC(CommandLine options, bool isWorker, const Func& func)
     2762int runJSC(const CommandLine& options, bool isWorker, const Func& func)
    27632763{
    27642764    Worker worker(Workers::singleton());
     
    28212821            compileTimeKeys.append(entry.key);
    28222822        std::sort(compileTimeKeys.begin(), compileTimeKeys.end());
    2823         for (CString key : compileTimeKeys)
     2823        for (const CString& key : compileTimeKeys)
    28242824            printf("%40s: %.3lf ms\n", key.data(), compileTimeStats.get(key).milliseconds());
    28252825    }
Note: See TracChangeset for help on using the changeset viewer.