Title: [277110] trunk/Source/_javascript_Core
Revision
277110
Author
fpi...@apple.com
Date
2021-05-06 12:41:15 -0700 (Thu, 06 May 2021)

Log Message

It should be possible to --logJIT=true
https://bugs.webkit.org/show_bug.cgi?id=225464

Reviewed by Mark Lam.

This makes it easy to just log when JITing happens. It's like --dumpDisassembly=true but
without the disassembly.

* assembler/LinkBuffer.cpp:
(JSC::LinkBuffer::finalizeCodeWithDisassemblyImpl):
* assembler/LinkBuffer.h:
* runtime/Options.cpp:
(JSC::Options::recomputeDependentOptions):
* runtime/OptionsList.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (277109 => 277110)


--- trunk/Source/_javascript_Core/ChangeLog	2021-05-06 19:29:01 UTC (rev 277109)
+++ trunk/Source/_javascript_Core/ChangeLog	2021-05-06 19:41:15 UTC (rev 277110)
@@ -1,3 +1,20 @@
+2021-05-06  Filip Pizlo  <fpi...@apple.com>
+
+        It should be possible to --logJIT=true
+        https://bugs.webkit.org/show_bug.cgi?id=225464
+
+        Reviewed by Mark Lam.
+
+        This makes it easy to just log when JITing happens. It's like --dumpDisassembly=true but
+        without the disassembly.
+
+        * assembler/LinkBuffer.cpp:
+        (JSC::LinkBuffer::finalizeCodeWithDisassemblyImpl):
+        * assembler/LinkBuffer.h:
+        * runtime/Options.cpp:
+        (JSC::Options::recomputeDependentOptions):
+        * runtime/OptionsList.h:
+
 2021-05-06  Mark Lam  <mark....@apple.com>
 
         Forbid further execution in jsc shell if execution is terminated.

Modified: trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp (277109 => 277110)


--- trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp	2021-05-06 19:29:01 UTC (rev 277109)
+++ trunk/Source/_javascript_Core/assembler/LinkBuffer.cpp	2021-05-06 19:41:15 UTC (rev 277110)
@@ -90,9 +90,8 @@
     }
 #endif
 
-    if (!dumpDisassembly || m_alreadyDisassembled)
-        return result;
-    
+    bool justDumpingHeader = !dumpDisassembly || m_alreadyDisassembled;
+
     StringPrintStream out;
     out.printf("Generated JIT code for ");
     va_list argList;
@@ -102,10 +101,16 @@
     out.printf(":\n");
 
     uint8_t* executableAddress = result.code().untaggedExecutableAddress<uint8_t*>();
-    out.printf("    Code at [%p, %p):\n", executableAddress, executableAddress + result.size());
+    out.printf("    Code at [%p, %p)%s\n", executableAddress, executableAddress + result.size(), justDumpingHeader ? "." : ":");
     
     CString header = out.toCString();
     
+    if (justDumpingHeader) {
+        if (Options::logJIT())
+            dataLog(header);
+        return result;
+    }
+    
     if (Options::asyncDisassembly()) {
         CodeRef<DisassemblyPtrTag> codeRefForDisassembly = result.retagged<DisassemblyPtrTag>();
         disassembleAsynchronously(header, WTFMove(codeRefForDisassembly), m_size, "    ");

Modified: trunk/Source/_javascript_Core/assembler/LinkBuffer.h (277109 => 277110)


--- trunk/Source/_javascript_Core/assembler/LinkBuffer.h	2021-05-06 19:29:01 UTC (rev 277109)
+++ trunk/Source/_javascript_Core/assembler/LinkBuffer.h	2021-05-06 19:41:15 UTC (rev 277110)
@@ -378,16 +378,16 @@
 };
 
 #if OS(LINUX)
-#define FINALIZE_CODE_IF(condition, linkBufferReference, resultPtrTag, ...)  \
-    (UNLIKELY((condition))                                              \
-        ? (linkBufferReference).finalizeCodeWithDisassembly<resultPtrTag>(true, __VA_ARGS__) \
+#define FINALIZE_CODE_IF(condition, linkBufferReference, resultPtrTag, ...) \
+    (UNLIKELY((condition) || JSC::Options::logJIT()) \
+        ? (linkBufferReference).finalizeCodeWithDisassembly<resultPtrTag>((condition), __VA_ARGS__) \
         : (UNLIKELY(JSC::Options::logJITCodeForPerf()) \
             ? (linkBufferReference).finalizeCodeWithDisassembly<resultPtrTag>(false, __VA_ARGS__) \
             : (linkBufferReference).finalizeCodeWithoutDisassembly<resultPtrTag>()))
 #else
-#define FINALIZE_CODE_IF(condition, linkBufferReference, resultPtrTag, ...)  \
-    (UNLIKELY((condition))                                              \
-        ? (linkBufferReference).finalizeCodeWithDisassembly<resultPtrTag>(true, __VA_ARGS__) \
+#define FINALIZE_CODE_IF(condition, linkBufferReference, resultPtrTag, ...) \
+    (UNLIKELY((condition) || JSC::Options::logJIT()) \
+        ? (linkBufferReference).finalizeCodeWithDisassembly<resultPtrTag>((condition), __VA_ARGS__) \
         : (linkBufferReference).finalizeCodeWithoutDisassembly<resultPtrTag>())
 #endif
 

Modified: trunk/Source/_javascript_Core/runtime/Options.cpp (277109 => 277110)


--- trunk/Source/_javascript_Core/runtime/Options.cpp	2021-05-06 19:29:01 UTC (rev 277109)
+++ trunk/Source/_javascript_Core/runtime/Options.cpp	2021-05-06 19:41:15 UTC (rev 277110)
@@ -451,7 +451,8 @@
     if (!Options::useWebAssembly())
         Options::useFastTLSForWasmContext() = false;
     
-    if (Options::dumpDisassembly()
+    if (Options::logJIT()
+        || Options::dumpDisassembly()
         || Options::dumpDFGDisassembly()
         || Options::dumpFTLDisassembly()
         || Options::dumpBytecodeAtDFGTime()

Modified: trunk/Source/_javascript_Core/runtime/OptionsList.h (277109 => 277110)


--- trunk/Source/_javascript_Core/runtime/OptionsList.h	2021-05-06 19:29:01 UTC (rev 277109)
+++ trunk/Source/_javascript_Core/runtime/OptionsList.h	2021-05-06 19:41:15 UTC (rev 277110)
@@ -122,6 +122,7 @@
     /* dumpDisassembly implies dumpDFGDisassembly. */ \
     v(Bool, dumpDisassembly, false, Normal, "dumps disassembly of all JIT compiled code upon compilation") \
     v(Bool, asyncDisassembly, false, Normal, nullptr) \
+    v(Bool, logJIT, false, Normal, nullptr) \
     v(Bool, dumpDFGDisassembly, false, Normal, "dumps disassembly of DFG function upon compilation") \
     v(Bool, dumpFTLDisassembly, false, Normal, "dumps disassembly of FTL function upon compilation") \
     v(Bool, dumpRegExpDisassembly, false, Normal, "dumps disassembly of RegExp upon compilation") \
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to