[webkit-changes] [WebKit/WebKit] c9a03e: [JSC] Compile wasm stubs in compiler threads

Yusuke Suzuki noreply at github.com
Mon May 27 09:45:05 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: c9a03e0c8a968c9c86e55c8b1aeeb3ef9d41c372
      https://github.com/WebKit/WebKit/commit/c9a03e0c8a968c9c86e55c8b1aeeb3ef9d41c372
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2024-05-27 (Mon, 27 May 2024)

  Changed paths:
    M Source/JavaScriptCore/wasm/WasmBBQPlan.cpp
    M Source/JavaScriptCore/wasm/WasmEntryPlan.cpp
    M Source/JavaScriptCore/wasm/WasmEntryPlan.h
    M Source/JavaScriptCore/wasm/WasmIPIntPlan.cpp
    M Source/JavaScriptCore/wasm/WasmLLIntPlan.cpp
    M Source/JavaScriptCore/wasm/WasmModule.h
    M Source/JavaScriptCore/wasm/WasmStreamingCompiler.cpp
    M Source/JavaScriptCore/wasm/js/JSWebAssembly.cpp
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.cpp
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h
    M Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp
    M Source/WebCore/bindings/js/SerializedScriptValue.cpp

  Log Message:
  -----------
  [JSC] Compile wasm stubs in compiler threads
https://bugs.webkit.org/show_bug.cgi?id=274721
rdar://128746101

Reviewed by Justin Michaud.

This patch moves wasm stub compilation from the main thread to one of compiler thread.
When EntryPlan is running, the first thread which starts compiling will compile stubs too.
If no thread compiled it, it gets compiled in the complete phase.

Since we can complete stub compilation in the compiler thread and share it in all wasm users,
we can make JSWebAssemblyModule creation simple. Now we change JSWebAssemblyModule::createStub
to JSWebAssemblyModule::create, and which just creates JSWebAssemblyModule and it does not fail
anymore.

We also change WasmEntryPlan's batch mechanism: instead of checking for each function compilation,
we now compute size apriori and grab range of function indice to compile.

And we also stop computing costly thing for wasm tail-calls which is not enabled. It should be done
more efficiently when enabling it.

* Source/JavaScriptCore/wasm/WasmBBQPlan.cpp:
(JSC::Wasm::BBQPlan::didCompleteCompilation):
* Source/JavaScriptCore/wasm/WasmEntryPlan.cpp:
(JSC::Wasm::EntryPlan::prepare):
(JSC::Wasm::EntryPlan::compileFunctions):
(JSC::Wasm::EntryPlan::didCompleteCompilation):
(JSC::Wasm::EntryPlan::generateWasmToWasmStubs):
(JSC::Wasm::EntryPlan::generateWasmToJSStubs):
* Source/JavaScriptCore/wasm/WasmEntryPlan.h:
* Source/JavaScriptCore/wasm/WasmIPIntPlan.cpp:
(JSC::Wasm::IPIntPlan::didCompleteCompilation):
* Source/JavaScriptCore/wasm/WasmLLIntPlan.cpp:
(JSC::Wasm::LLIntPlan::didCompleteCompilation):
* Source/JavaScriptCore/wasm/WasmModule.h:
* Source/JavaScriptCore/wasm/WasmStreamingCompiler.cpp:
(JSC::Wasm::StreamingCompiler::didComplete):
* Source/JavaScriptCore/wasm/js/JSWebAssembly.cpp:
(JSC::JSWebAssembly::webAssemblyModuleValidateAsync):
(JSC::compileAndInstantiate):
* Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.cpp:
(JSC::JSWebAssemblyModule::create):
(JSC::JSWebAssemblyModule::createStub): Deleted.
* Source/JavaScriptCore/wasm/js/JSWebAssemblyModule.h:
* Source/JavaScriptCore/wasm/js/WebAssemblyModuleConstructor.cpp:
(JSC::WebAssemblyModuleConstructor::createModule):
* Source/WebCore/bindings/js/SerializedScriptValue.cpp:
(WebCore::CloneDeserializer::readTerminal):

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



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


More information about the webkit-changes mailing list