Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: cfbd6fb2d1c38e82f36f7bd8a8b4cae94bb89a7f
      
https://github.com/WebKit/WebKit/commit/cfbd6fb2d1c38e82f36f7bd8a8b4cae94bb89a7f
  Author: Yusuke Suzuki <[email protected]>
  Date:   2025-10-27 (Mon, 27 Oct 2025)

  Changed paths:
    M JSTests/wasm/stress/cc-int-to-int-tail-call.js
    M JSTests/wasm/stress/simd-tail-calls-throw.js
    M JSTests/wasm/stress/simple-inline-stacktrace-2.js
    M JSTests/wasm/stress/simple-inline-stacktrace-with-catch-2.js
    M JSTests/wasm/stress/tail-call-across-modules.js
    M JSTests/wasm/stress/tail-call-double.js
    M JSTests/wasm/stress/tail-call-js.js
    M JSTests/wasm/stress/tail-call-simple-i64.js
    M JSTests/wasm/stress/tail-call-simple-int.js
    M JSTests/wasm/stress/tail-call-simple.js
    M JSTests/wasm/stress/tail-call.js
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/Sources.txt
    M Source/JavaScriptCore/runtime/OptionsList.h
    M Source/JavaScriptCore/wasm/WasmCallProfile.h
    M Source/JavaScriptCore/wasm/WasmCallee.cpp
    M Source/JavaScriptCore/wasm/WasmCallee.h
    M Source/JavaScriptCore/wasm/WasmCalleeGroup.cpp
    M Source/JavaScriptCore/wasm/WasmCalleeGroup.h
    M Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h
    M Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp
    A Source/JavaScriptCore/wasm/WasmInliningDecision.cpp
    A Source/JavaScriptCore/wasm/WasmInliningDecision.h
    M Source/JavaScriptCore/wasm/WasmMergedProfile.cpp
    M Source/JavaScriptCore/wasm/WasmMergedProfile.h
    M Source/JavaScriptCore/wasm/WasmModule.cpp
    M Source/JavaScriptCore/wasm/WasmModule.h
    M Source/JavaScriptCore/wasm/WasmModuleInformation.h
    M Source/JavaScriptCore/wasm/WasmOMGIRGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmOMGIRGenerator32_64.cpp
    M Source/JavaScriptCore/wasm/WasmStreamingParser.cpp
    M Tools/Scripts/run-jsc-stress-tests

  Log Message:
  -----------
  [JSC] Introduce non-local wasm inlining decision
https://bugs.webkit.org/show_bug.cgi?id=301465
rdar://163406661

Reviewed by Dan Hecht.

This patch introduces Wasm::InliningDecision, which overviews the
entire function and deciding which callsite should be inlined. Previous
implementation was deciding inlining locally: we check earlier callsite
and do inlining and we stop inlining when it reaches to the threshold.
Instead, we should check the entire graph of the function and select
inlining candidates globally.

To do this massive design change, we start with V8's algorithm for
inlining heuristics. We will tune and add more behavior changes after
this but this patch starts with V8's one. InliningDecision implements
V8's current inlining heuristics mechanism. And InliningDecision fully
computes which callsite should be inlined a-priori, and OMG compiler
just follows to this decision after all computation is done. We also
increase maxPolymorphicCallees to 4 to align to V8's heuristics.

* JSTests/wasm/stress/cc-int-to-int-tail-call.js:
* JSTests/wasm/stress/simd-tail-calls-throw.js:
* JSTests/wasm/stress/simple-inline-stacktrace-2.js:
* JSTests/wasm/stress/simple-inline-stacktrace-with-catch-2.js:
* JSTests/wasm/stress/tail-call-across-modules.js:
* JSTests/wasm/stress/tail-call-double.js:
* JSTests/wasm/stress/tail-call-js.js:
* JSTests/wasm/stress/tail-call-simple-i64.js:
* JSTests/wasm/stress/tail-call-simple-int.js:
* JSTests/wasm/stress/tail-call-simple.js:
* JSTests/wasm/stress/tail-call.js:
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/JavaScriptCore/wasm/WasmCallProfile.h:
* Source/JavaScriptCore/wasm/WasmCallee.cpp:
(JSC::Wasm::IPIntCallee::IPIntCallee):
(JSC::Wasm::IPIntCallee::needsProfiling const):
* Source/JavaScriptCore/wasm/WasmCallee.h:
* Source/JavaScriptCore/wasm/WasmCalleeGroup.cpp:
(JSC::Wasm::CalleeGroup::tryGetBBQCallee):
(JSC::Wasm::CalleeGroup::tryGetBBQCalleeForLoopOSRConcurrently):
* Source/JavaScriptCore/wasm/WasmCalleeGroup.h:
* Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h:
(JSC::Wasm::FunctionIPIntMetadataGenerator::addCallTarget):
* Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp:
(JSC::Wasm::IPIntGenerator::addCall):
(JSC::Wasm::IPIntGenerator::addCallIndirect):
(JSC::Wasm::IPIntGenerator::addCallRef):
(JSC::Wasm::IPIntGenerator::finalize):
* Source/JavaScriptCore/wasm/WasmInliningDecision.cpp: Added.
(JSC::Wasm::InliningNode::InliningNode):
(JSC::Wasm::InliningNode::score const):
(JSC::Wasm::InliningDecision::canInline):
(JSC::Wasm::InliningNode::callTarget):
(JSC::Wasm::InliningNode::inlineNode):
(JSC::Wasm::budgetScaleFactor):
(JSC::Wasm::InliningDecision::InliningDecision):
(JSC::Wasm::InliningDecision::profileForCallee):
(JSC::Wasm::isHigherPriority):
(JSC::Wasm::InliningDecision::expand):
* Source/JavaScriptCore/wasm/WasmInliningDecision.h: Added.
(JSC::Wasm::InliningNode::callee const):
(JSC::Wasm::InliningNode::caller const):
(JSC::Wasm::InliningNode::callSites const):
(JSC::Wasm::InliningNode::isInlined const):
(JSC::Wasm::InliningNode::isUnused const):
(JSC::Wasm::InliningNode::caseIndex const):
(JSC::Wasm::InliningNode::depth const):
(JSC::Wasm::InliningNode::callProfileIndex const):
(JSC::Wasm::InliningNode::relativeCallCount const):
(JSC::Wasm::InliningNode::wasmSize const):
* Source/JavaScriptCore/wasm/WasmMergedProfile.cpp:
(JSC::Wasm::MergedProfile::MergedProfile):
(JSC::Wasm::MergedProfile::Candidates::merge):
(JSC::Wasm::MergedProfile::Candidates::finalize const):
(JSC::Wasm::MergedProfile::merge):
* Source/JavaScriptCore/wasm/WasmMergedProfile.h:
(JSC::Wasm::MergedProfile::size const):
(JSC::Wasm::MergedProfile::merged const):
(JSC::Wasm::MergedProfile::totalCount const):
* Source/JavaScriptCore/wasm/WasmModule.cpp:
(JSC::Wasm::Module::createMergedProfile):
* Source/JavaScriptCore/wasm/WasmModule.h:
* Source/JavaScriptCore/wasm/WasmModuleInformation.h:
* Source/JavaScriptCore/wasm/WasmOMGIRGenerator.cpp:
(JSC::Wasm::OMGIRGenerator::OMGIRGenerator):
(JSC::Wasm::OMGIRGenerator::canInline const):
(JSC::Wasm::OMGIRGenerator::emitInlineDirectCall):
(JSC::Wasm::OMGIRGenerator::emitDirectCall):
(JSC::Wasm::OMGIRGenerator::tryInliningPolymorphicCalls):
(JSC::Wasm::OMGIRGenerator::addCallIndirect):
(JSC::Wasm::OMGIRGenerator::addCallRef):
(JSC::Wasm::parseAndCompileOMG):
* Source/JavaScriptCore/wasm/WasmOMGIRGenerator32_64.cpp:
(JSC::Wasm::OMGIRGenerator::OMGIRGenerator):
(JSC::Wasm::OMGIRGenerator::canInline const):
(JSC::Wasm::OMGIRGenerator::addCallIndirect):
(JSC::Wasm::OMGIRGenerator::addCallRef):
* Source/JavaScriptCore/wasm/WasmStreamingParser.cpp:
(JSC::Wasm::StreamingParser::parseFunctionSize):
* Tools/Scripts/run-jsc-stress-tests:

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



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

Reply via email to