Ignore:
Timestamp:
Dec 13, 2018, 4:19:23 PM (6 years ago)
Author:
[email protected]
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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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.