Title: [239187] trunk/Source/_javascript_Core
Revision
239187
Author
[email protected]
Date
2018-12-13 16:19:23 -0800 (Thu, 13 Dec 2018)

Log Message

clang-tidy: Fix unnecessary object copies in _javascript_Core
<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.

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (239186 => 239187)


--- trunk/Source/_javascript_Core/ChangeLog	2018-12-14 00:18:54 UTC (rev 239186)
+++ trunk/Source/_javascript_Core/ChangeLog	2018-12-14 00:19:23 UTC (rev 239187)
@@ -1,3 +1,40 @@
+2018-12-13  David Kilzer  <[email protected]>
+
+        clang-tidy: Fix unnecessary object copies in _javascript_Core
+        <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.
+
 2018-12-13  Devin Rousso  <[email protected]>
 
         Web Inspector: remove DOM.BackendNodeId and associated commands/events

Modified: trunk/Source/_javascript_Core/assembler/testmasm.cpp (239186 => 239187)


--- trunk/Source/_javascript_Core/assembler/testmasm.cpp	2018-12-14 00:18:54 UTC (rev 239186)
+++ trunk/Source/_javascript_Core/assembler/testmasm.cpp	2018-12-14 00:19:23 UTC (rev 239187)
@@ -153,7 +153,7 @@
 }
 
 template<typename T, typename... Arguments>
-T invoke(MacroAssemblerCodeRef<JSEntryPtrTag> code, Arguments... arguments)
+T invoke(const MacroAssemblerCodeRef<JSEntryPtrTag>& code, Arguments... arguments)
 {
     void* executableAddress = untagCFunctionPtr<JSEntryPtrTag>(code.code().executableAddress());
     T (*function)(Arguments...) = bitwise_cast<T(*)(Arguments...)>(executableAddress);

Modified: trunk/Source/_javascript_Core/b3/testb3.cpp (239186 => 239187)


--- trunk/Source/_javascript_Core/b3/testb3.cpp	2018-12-14 00:18:54 UTC (rev 239186)
+++ trunk/Source/_javascript_Core/b3/testb3.cpp	2018-12-14 00:19:23 UTC (rev 239187)
@@ -164,7 +164,7 @@
 }
 
 template<typename Func>
-void checkDisassembly(Compilation& compilation, const Func& func, CString failText)
+void checkDisassembly(Compilation& compilation, const Func& func, const CString& failText)
 {
     CString disassembly = compilation.disassembly();
     if (func(disassembly.data()))

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp (239186 => 239187)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2018-12-14 00:18:54 UTC (rev 239186)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.cpp	2018-12-14 00:19:23 UTC (rev 239187)
@@ -6313,7 +6313,7 @@
 void SpeculativeJIT::compileStringEquality(
     Node* node, GPRReg leftGPR, GPRReg rightGPR, GPRReg lengthGPR, GPRReg leftTempGPR,
     GPRReg rightTempGPR, GPRReg leftTemp2GPR, GPRReg rightTemp2GPR,
-    JITCompiler::JumpList fastTrue, JITCompiler::JumpList fastFalse)
+    const JITCompiler::JumpList& fastTrue, const JITCompiler::JumpList& fastFalse)
 {
     JITCompiler::JumpList trueCase;
     JITCompiler::JumpList falseCase;

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h (239186 => 239187)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2018-12-14 00:18:54 UTC (rev 239186)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT.h	2018-12-14 00:19:23 UTC (rev 239187)
@@ -724,10 +724,10 @@
 
 #if USE(JSVALUE64)
     void cachedGetById(CodeOrigin, GPRReg baseGPR, GPRReg resultGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget, SpillRegistersMode, AccessType);
-    void cachedGetByIdWithThis(CodeOrigin, GPRReg baseGPR, GPRReg thisGPR, GPRReg resultGPR, unsigned identifierNumber, JITCompiler::JumpList slowPathTarget = JITCompiler::JumpList());
+    void cachedGetByIdWithThis(CodeOrigin, GPRReg baseGPR, GPRReg thisGPR, GPRReg resultGPR, unsigned identifierNumber, const JITCompiler::JumpList& slowPathTarget = JITCompiler::JumpList());
 #elif USE(JSVALUE32_64)
     void cachedGetById(CodeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, unsigned identifierNumber, JITCompiler::Jump slowPathTarget, SpillRegistersMode, AccessType);
-    void cachedGetByIdWithThis(CodeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg thisTagGPROrNone, GPRReg thisPayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, unsigned identifierNumber, JITCompiler::JumpList slowPathTarget = JITCompiler::JumpList());
+    void cachedGetByIdWithThis(CodeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg thisTagGPROrNone, GPRReg thisPayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR, unsigned identifierNumber, const JITCompiler::JumpList& slowPathTarget = JITCompiler::JumpList());
 #endif
 
     void compileDeleteById(Node*);
@@ -1199,8 +1199,8 @@
     void compileStringEquality(
         Node*, GPRReg leftGPR, GPRReg rightGPR, GPRReg lengthGPR,
         GPRReg leftTempGPR, GPRReg rightTempGPR, GPRReg leftTemp2GPR,
-        GPRReg rightTemp2GPR, JITCompiler::JumpList fastTrue,
-        JITCompiler::JumpList fastSlow);
+        GPRReg rightTemp2GPR, const JITCompiler::JumpList& fastTrue,
+        const JITCompiler::JumpList& fastSlow);
     void compileStringEquality(Node*);
     void compileStringIdentEquality(Node*);
     void compileStringToUntypedEquality(Node*, Edge stringEdge, Edge untypedEdge);

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp (239186 => 239187)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2018-12-14 00:18:54 UTC (rev 239186)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT32_64.cpp	2018-12-14 00:19:23 UTC (rev 239187)
@@ -228,7 +228,7 @@
 
 void SpeculativeJIT::cachedGetByIdWithThis(
     CodeOrigin codeOrigin, GPRReg baseTagGPROrNone, GPRReg basePayloadGPR, GPRReg thisTagGPR, GPRReg thisPayloadGPR, GPRReg resultTagGPR, GPRReg resultPayloadGPR,
-    unsigned identifierNumber, JITCompiler::JumpList slowPathTarget)
+    unsigned identifierNumber, const JITCompiler::JumpList& slowPathTarget)
 {
     RegisterSet usedRegisters = this->usedRegisters();
     

Modified: trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp (239186 => 239187)


--- trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2018-12-14 00:18:54 UTC (rev 239186)
+++ trunk/Source/_javascript_Core/dfg/DFGSpeculativeJIT64.cpp	2018-12-14 00:19:23 UTC (rev 239187)
@@ -187,7 +187,7 @@
     addSlowPathGenerator(WTFMove(slowPath));
 }
 
-void SpeculativeJIT::cachedGetByIdWithThis(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg thisGPR, GPRReg resultGPR, unsigned identifierNumber, JITCompiler::JumpList slowPathTarget)
+void SpeculativeJIT::cachedGetByIdWithThis(CodeOrigin codeOrigin, GPRReg baseGPR, GPRReg thisGPR, GPRReg resultGPR, unsigned identifierNumber, const JITCompiler::JumpList& slowPathTarget)
 {
     CallSiteIndex callSite = m_jit.recordCallSiteAndGenerateExceptionHandlingOSRExitIfNeeded(codeOrigin, m_stream->size());
     RegisterSet usedRegisters = this->usedRegisters();

Modified: trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp (239186 => 239187)


--- trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2018-12-14 00:18:54 UTC (rev 239186)
+++ trunk/Source/_javascript_Core/ftl/FTLLowerDFGToB3.cpp	2018-12-14 00:19:23 UTC (rev 239187)
@@ -11385,7 +11385,7 @@
     template<typename Functor>
     void checkStructure(
         LValue structureDiscriminant, const FormattedValue& formattedValue, ExitKind exitKind,
-        RegisteredStructureSet set, const Functor& weakStructureDiscriminant)
+        const RegisteredStructureSet& set, const Functor& weakStructureDiscriminant)
     {
         if (set.isEmpty()) {
             terminate(exitKind);

Modified: trunk/Source/_javascript_Core/jsc.cpp (239186 => 239187)


--- trunk/Source/_javascript_Core/jsc.cpp	2018-12-14 00:18:54 UTC (rev 239186)
+++ trunk/Source/_javascript_Core/jsc.cpp	2018-12-14 00:19:23 UTC (rev 239187)
@@ -216,7 +216,7 @@
 class Workers;
 
 template<typename Func>
-int runJSC(CommandLine, bool isWorker, const Func&);
+int runJSC(const CommandLine&, bool isWorker, const Func&);
 static void checkException(ExecState*, GlobalObject*, bool isLastFile, bool hasException, JSValue, CommandLine&, bool& success);
 
 class Message : public ThreadSafeRefCounted<Message> {
@@ -257,7 +257,7 @@
     template<typename Func>
     void broadcast(const Func&);
     
-    void report(String);
+    void report(const String&);
     String tryGetReport();
     String getReport();
     
@@ -817,8 +817,8 @@
     if (sourceOrigin.isNull())
         return reject(createError(exec, "Could not resolve the module specifier."_s));
 
-    auto referrer = sourceOrigin.string();
-    auto moduleName = moduleNameValue->value(exec);
+    const auto& referrer = sourceOrigin.string();
+    const auto& moduleName = moduleNameValue->value(exec);
     if (UNLIKELY(catchScope.exception()))
         return reject(catchScope.exception());
 
@@ -1643,7 +1643,7 @@
     m_condition.notifyAll();
 }
 
-void Workers::report(String string)
+void Workers::report(const String& string)
 {
     auto locker = holdLock(m_lock);
     m_reports.append(string.isolatedCopy());
@@ -1923,10 +1923,10 @@
 }
 
 template<typename ValueType>
-typename std::enable_if<!std::is_fundamental<ValueType>::value>::type addOption(VM&, JSObject*, Identifier, ValueType) { }
+typename std::enable_if<!std::is_fundamental<ValueType>::value>::type addOption(VM&, JSObject*, const Identifier&, ValueType) { }
 
 template<typename ValueType>
-typename std::enable_if<std::is_fundamental<ValueType>::value>::type addOption(VM& vm, JSObject* optionsObject, Identifier identifier, ValueType value)
+typename std::enable_if<std::is_fundamental<ValueType>::value>::type addOption(VM& vm, JSObject* optionsObject, const Identifier& identifier, ValueType value)
 {
     optionsObject->putDirect(vm, identifier, JSValue(value));
 }
@@ -2759,7 +2759,7 @@
 }
 
 template<typename Func>
-int runJSC(CommandLine options, bool isWorker, const Func& func)
+int runJSC(const CommandLine& options, bool isWorker, const Func& func)
 {
     Worker worker(Workers::singleton());
     
@@ -2820,7 +2820,7 @@
         for (auto& entry : compileTimeStats)
             compileTimeKeys.append(entry.key);
         std::sort(compileTimeKeys.begin(), compileTimeKeys.end());
-        for (CString key : compileTimeKeys)
+        for (const CString& key : compileTimeKeys)
             printf("%40s: %.3lf ms\n", key.data(), compileTimeStats.get(key).milliseconds());
     }
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to