[webkit-changes] [WebKit/WebKit] 7ab897: [JSC] Wasm repatch should be maintained by reverse...

Yusuke Suzuki noreply at github.com
Sat Jan 28 13:08:07 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 7ab897711f80e7c2a341ec065a1ecda29bdeac3b
      https://github.com/WebKit/WebKit/commit/7ab897711f80e7c2a341ec065a1ecda29bdeac3b
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-01-28 (Sat, 28 Jan 2023)

  Changed paths:
    M Source/JavaScriptCore/CMakeLists.txt
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/Sources.txt
    M Source/JavaScriptCore/wasm/WasmBBQPlan.cpp
    M Source/JavaScriptCore/wasm/WasmCalleeGroup.cpp
    M Source/JavaScriptCore/wasm/WasmCalleeGroup.h
    A Source/JavaScriptCore/wasm/WasmCallsiteCollection.cpp
    A Source/JavaScriptCore/wasm/WasmCallsiteCollection.h
    M Source/JavaScriptCore/wasm/WasmCompilationMode.h
    M Source/JavaScriptCore/wasm/WasmOMGPlan.cpp
    M Source/JavaScriptCore/wasm/WasmOSREntryPlan.cpp
    M Source/JavaScriptCore/wasm/WasmPlan.cpp
    M Source/JavaScriptCore/wasm/WasmPlan.h

  Log Message:
  -----------
  [JSC] Wasm repatch should be maintained by reversed data structure
https://bugs.webkit.org/show_bug.cgi?id=251316
rdar://104775515

Reviewed by Saam Barati.

When repatching wasm callsites with a newly compiled code, we are literally iterating every callsites on the wasm module,
and updating them with a new one if it is matching against the registered one. But this is too stupid and it becomes exponentially
slow when wasm module gets large.

We should just maintain the data structure which answers callsites calling a function X. And when X is recompiled (e.g. -> BBQ -> OMG),
then we should query to this data structure to obtain the list of callsites calling to X super quickly.

This patch adds Wasm::CallsiteCollection. This maintains Vector<Vector> basically, Vector of callsites calling a function X.

This improves large wasm website performance in a dramatic way.

* Source/JavaScriptCore/CMakeLists.txt:
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/wasm/WasmBBQPlan.cpp:
(JSC::Wasm::BBQPlan::work):
* Source/JavaScriptCore/wasm/WasmCalleeGroup.cpp:
(JSC::Wasm::CalleeGroup::CalleeGroup):
* Source/JavaScriptCore/wasm/WasmCalleeGroup.h:
* Source/JavaScriptCore/wasm/WasmCallsiteCollection.cpp: Added.
(JSC::Wasm::CallsiteCollection::addCallsites):
(JSC::Wasm::CallsiteCollection::addCalleeGroupCallsites):
(JSC::Wasm::CallsiteCollection::updateCallsitesToCallUs):
* Source/JavaScriptCore/wasm/WasmCallsiteCollection.h: Added.
(JSC::Wasm::CallsiteCollection::CallsiteCollection):
(JSC::Wasm::CallsiteCollection::calleeGroupCallsites const):
* Source/JavaScriptCore/wasm/WasmCompilationMode.h:
* Source/JavaScriptCore/wasm/WasmOMGPlan.cpp:
(JSC::Wasm::OMGPlan::work):
* Source/JavaScriptCore/wasm/WasmOSREntryPlan.cpp:
(JSC::Wasm::OSREntryPlan::work):
* Source/JavaScriptCore/wasm/WasmPlan.cpp:
(JSC::Wasm::Plan::updateCallSitesToCallUs): Deleted.
* Source/JavaScriptCore/wasm/WasmPlan.h:

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




More information about the webkit-changes mailing list