Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cd8340e8676091cea8211420a2e95c5dfde2fe46
      
https://github.com/WebKit/WebKit/commit/cd8340e8676091cea8211420a2e95c5dfde2fe46
  Author: Yusuke Suzuki <[email protected]>
  Date:   2026-03-09 (Mon, 09 Mar 2026)

  Changed paths:
    M Source/JavaScriptCore/assembler/LinkBuffer.cpp
    M Source/JavaScriptCore/assembler/LinkBuffer.h
    M Source/JavaScriptCore/assembler/PerfLog.cpp
    M Source/JavaScriptCore/assembler/PerfLog.h
    M Source/JavaScriptCore/dfg/DFGJITCompiler.cpp
    M Source/JavaScriptCore/dfg/DFGJITCompiler.h
    M Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp
    M Source/JavaScriptCore/ftl/FTLCompile.cpp
    M Source/JavaScriptCore/ftl/FTLState.cpp
    M Source/JavaScriptCore/jit/JIT.cpp
    M Source/JavaScriptCore/parser/SourceProvider.cpp
    M Source/JavaScriptCore/parser/SourceProvider.h
    M Source/JavaScriptCore/runtime/Options.cpp
    M Source/JavaScriptCore/runtime/OptionsList.h

  Log Message:
  -----------
  [JSC] Add SourceDump option to JITDump
https://bugs.webkit.org/show_bug.cgi?id=309409
rdar://171953162

Reviewed by Yijia Huang.

Like IRDump mechanism, this patch implements useSourceDump mechanism,
which is additional option to JITDump. Once it is enabled, we attempt to
record original source URL content to the local disk (or using local
file path if possible). Then resolving Origin to bytecode offset, and
then line and column of source. And attaching these information to
JITDump's debug metadata. As a result, we can show the original JS
source code as a source, with samples attached to the right place of JS
source code.

The limitation is,

1. This is adding huge performance penalty. So you can enable it with
   your own risk.
2. This is generating significant amount of source to directory
   like /tmp.
3. Because it is using JIT dump, only works for JIT functions.
   Interpreter cannot work well.
4. Currently wasm is not supported.
5. Inlined functions in JS JIT cannot be represented as a nested frames
   with JITDump. This is large limitation since we cannot show which
   inlined function has how many samples well in the consistent view.
   This requires JITDump format's extension.

The idea and some mechanisms are contributed by Jeff Muizelaar.

* Source/JavaScriptCore/assembler/LinkBuffer.cpp:
(JSC::LinkBuffer::logJITCodeForJITDump):
* Source/JavaScriptCore/assembler/LinkBuffer.h:
(JSC::SourceCodeDumpDebugInfo::SourceCodeDumpDebugInfo):
(JSC::LinkBuffer::setSourceCodeDumpDebugInfo):
* Source/JavaScriptCore/assembler/PerfLog.cpp:
(JSC::PerfLog::PerfLog):
(JSC::PerfLog::log):
* Source/JavaScriptCore/assembler/PerfLog.h:
* Source/JavaScriptCore/dfg/DFGJITCompiler.cpp:
(JSC::DFG::JITCompiler::collectSourceCodeDumpDebugInfo):
* Source/JavaScriptCore/dfg/DFGJITCompiler.h:
(JSC::DFG::JITCompiler::setForNode):
* Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::compile):
(JSC::DFG::SpeculativeJIT::compileFunction):
* Source/JavaScriptCore/ftl/FTLCompile.cpp:
(JSC::FTL::collectIRDumpDebugInfo):
(JSC::FTL::collectSourceCodeDumpDebugInfo):
(JSC::FTL::compile):
* Source/JavaScriptCore/ftl/FTLState.cpp:
(JSC::FTL::State::State):
* Source/JavaScriptCore/jit/JIT.cpp:
(JSC::JIT::link):
* Source/JavaScriptCore/parser/SourceProvider.cpp:
(JSC::SourceProvider::sourceCodeDumpFilePath):
* Source/JavaScriptCore/parser/SourceProvider.h:
* Source/JavaScriptCore/runtime/Options.cpp:
(JSC::Options::notifyOptionsChanged):
* Source/JavaScriptCore/runtime/OptionsList.h:

Canonical link: https://commits.webkit.org/308946@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to