[webkit-changes] [WebKit/WebKit] 5b9714: [JSC] Remove Wasm FastTLS

Yusuke Suzuki noreply at github.com
Wed Jan 4 16:50:13 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5b971463eaad3a705207799ef68ab8dcb3ee9277
      https://github.com/WebKit/WebKit/commit/5b971463eaad3a705207799ef68ab8dcb3ee9277
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-01-04 (Wed, 04 Jan 2023)

  Changed paths:
    M Source/JavaScriptCore/assembler/JITOperationList.cpp
    M Source/JavaScriptCore/bytecode/BytecodeList.rb
    M Source/JavaScriptCore/jit/AssemblyHelpers.cpp
    M Source/JavaScriptCore/llint/LLIntExceptions.cpp
    M Source/JavaScriptCore/llint/LLIntThunks.cpp
    M Source/JavaScriptCore/llint/LowLevelInterpreter.asm
    M Source/JavaScriptCore/llint/WebAssembly.asm
    M Source/JavaScriptCore/runtime/Gate.h
    M Source/JavaScriptCore/runtime/Options.cpp
    M Source/JavaScriptCore/runtime/OptionsList.h
    M Source/JavaScriptCore/wasm/WasmAirIRGeneratorBase.h
    M Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmContext.h
    M Source/JavaScriptCore/wasm/WasmContextInlines.h
    M Source/JavaScriptCore/wasm/WasmFaultSignalHandler.cpp
    M Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmMemoryInformation.cpp
    M Source/JavaScriptCore/wasm/WasmSlowPaths.cpp
    M Source/JavaScriptCore/wasm/WasmSlowPaths.h
    M Source/JavaScriptCore/wasm/js/JSToWasm.cpp
    M Source/JavaScriptCore/wasm/js/WasmToJS.cpp
    M Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp
    M Tools/Scripts/run-jsc-stress-tests

  Log Message:
  -----------
  [JSC] Remove Wasm FastTLS
https://bugs.webkit.org/show_bug.cgi?id=249993
rdar://103809090

Reviewed by Saam Barati.

This was originally introduced to make Wasm Position-Independent-Code (PIC).
However, this is no longer meaningful.

1. At that time, we are embedding VM's pointer directly into Wasm's Module code. But this is no longer happening.
   So, without FastTLS, Wasm Module is already PIC.
2. Original patch was considering about serializing Wasm code into IndexedDB, but that proposal was now completely abandoned.
3. In super hot leaf function in OMG, FastTLS is unnecessarily emitting code to load instance while pinned-register version
   can eliminate this. So, pinned register version gets better code generation.
4. This makes OSS and Internal wasm call etc. the same since both just uses pinned registers. It also reduces # of variants of stress tests.

This patch removes Wasm FastTLS and always use pinned registers.

* Source/JavaScriptCore/assembler/JITOperationList.cpp:
(JSC::llintOperations):
* Source/JavaScriptCore/bytecode/BytecodeList.rb:
* Source/JavaScriptCore/jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::loadWasmContextInstance):
(JSC::AssemblyHelpers::storeWasmContextInstance):
(JSC::AssemblyHelpers::loadWasmContextInstanceNeedsMacroScratchRegister):
(JSC::AssemblyHelpers::storeWasmContextInstanceNeedsMacroScratchRegister):
* Source/JavaScriptCore/llint/LLIntExceptions.cpp:
(JSC::LLInt::handleWasmCatch):
(JSC::LLInt::handleWasmCatchAll):
* Source/JavaScriptCore/llint/LLIntThunks.cpp:
(JSC::LLInt::wasmFunctionEntryThunk):
(JSC::LLInt::wasmFunctionEntryThunkSIMD):
(JSC::LLInt::handleWasmCatchThunk):
(JSC::LLInt::handleWasmCatchAllThunk):
* Source/JavaScriptCore/llint/LowLevelInterpreter.asm:
* Source/JavaScriptCore/llint/WebAssembly.asm:
* Source/JavaScriptCore/runtime/Gate.h:
* Source/JavaScriptCore/runtime/Options.cpp:
(JSC::Options::notifyOptionsChanged):
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/JavaScriptCore/wasm/WasmAirIRGeneratorBase.h:
(JSC::Wasm::ExpressionType>::restoreWasmContextInstance):
(JSC::Wasm::ExpressionType>::AirIRGeneratorBase):
(JSC::Wasm::ExpressionType>::finalizeEntrypoints):
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::restoreWasmContextInstance):
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
* Source/JavaScriptCore/wasm/WasmContext.h:
(JSC::Wasm::Context::pointerToInstance):
* Source/JavaScriptCore/wasm/WasmContextInlines.h:
(JSC::Wasm::Context::load const):
(JSC::Wasm::Context::store):
(JSC::Wasm::Context::tryLoadInstanceFromTLS):
(JSC::Wasm::Context::useFastTLS): Deleted.
* Source/JavaScriptCore/wasm/WasmFaultSignalHandler.cpp:
(JSC::Wasm::trapHandler):
* Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp:
(JSC::Wasm::LLIntGenerator::addCatchToUnreachable):
(JSC::Wasm::LLIntGenerator::addCatchAllToUnreachable):
(JSC::Wasm::LLIntGenerator::addCall):
(JSC::Wasm::LLIntGenerator::addCallIndirect):
(JSC::Wasm::LLIntGenerator::addCallRef):
* Source/JavaScriptCore/wasm/WasmMemoryInformation.cpp:
(JSC::Wasm::PinnedRegisterInfo::get):
* Source/JavaScriptCore/wasm/WasmSlowPaths.cpp:
(JSC::LLInt::WASM_SLOW_PATH_DECL):
* Source/JavaScriptCore/wasm/WasmSlowPaths.h:
* Source/JavaScriptCore/wasm/js/JSToWasm.cpp:
(JSC::Wasm::marshallJSResult):
(JSC::Wasm::createJSToWasmWrapper):
* Source/JavaScriptCore/wasm/js/WasmToJS.cpp:
(JSC::Wasm::wasmToJS):
* Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp:
(JSC::JSC_DEFINE_HOST_FUNCTION):
(JSC::WebAssemblyFunction::jsCallEntrypointSlow):
* Tools/Scripts/run-jsc-stress-tests:

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




More information about the webkit-changes mailing list