[webkit-changes] [WebKit/WebKit] 85f4c9: [SIMD] Skip LLInt for SIMD functions.

Justin Michaud noreply at github.com
Fri Dec 2 11:38:32 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 85f4c97a6e063901a359c620aa1007c7c3ebd7ea
      https://github.com/WebKit/WebKit/commit/85f4c97a6e063901a359c620aa1007c7c3ebd7ea
  Author: Justin Michaud <justin_michaud at apple.com>
  Date:   2022-12-02 (Fri, 02 Dec 2022)

  Changed paths:
    M JSTests/wasm/v8/exceptions-simd.js
    M JSTests/wasm/v8/multi-value-simd.js
    M JSTests/wasm/v8/simd-errors.js
    M Source/JavaScriptCore/assembler/JITOperationList.cpp
    M Source/JavaScriptCore/bytecode/BytecodeList.rb
    M Source/JavaScriptCore/llint/LLIntThunks.cpp
    M Source/JavaScriptCore/llint/LLIntThunks.h
    M Source/JavaScriptCore/llint/LowLevelInterpreter.asm
    M Source/JavaScriptCore/llint/WebAssembly.asm
    M Source/JavaScriptCore/offlineasm/arm64.rb
    M Source/JavaScriptCore/offlineasm/instructions.rb
    M Source/JavaScriptCore/offlineasm/risc.rb
    M Source/JavaScriptCore/offlineasm/x86.rb
    M Source/JavaScriptCore/runtime/Options.cpp
    M Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmCallee.h
    M Source/JavaScriptCore/wasm/WasmFormat.h
    M Source/JavaScriptCore/wasm/WasmFunctionParser.h
    M Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmLLIntPlan.cpp
    M Source/JavaScriptCore/wasm/WasmModuleInformation.h
    M Source/JavaScriptCore/wasm/WasmOperations.cpp
    M Source/JavaScriptCore/wasm/WasmSectionParser.cpp
    M Source/JavaScriptCore/wasm/WasmSlowPaths.cpp
    M Source/JavaScriptCore/wasm/WasmSlowPaths.h
    M Source/JavaScriptCore/wasm/WasmTypeDefinition.h

  Log Message:
  -----------
  [SIMD] Skip LLInt for SIMD functions.
https://bugs.webkit.org/show_bug.cgi?id=246346

Reviewed by Yusuke Suzuki.

Today, enabling WASM SIMD requires disabling the LLInt since it does not
implement any of the instructions. This patch forces functions that use
SIMD instructions to go straight to BBQ instead.

The way this works is that when the LLInt sees an instruction or type that
requires SIMD support, it emits a crash bytecode and marks the function as
a SIMD function in the WASM module information. Then, we emit a new
LLInt entrypoint that blocks while the function tiers up.

This new entrypoint preserves the full width of the vector argument registers
and jumps to the new BBQ code for the function.

Note that after this change, we require LLInt to be turned on if SIMD is enabled.
This ensures that isSIMDFunction is populated.

The optimal future solution is that the LLInt should support SIMD.

* Source/JavaScriptCore/assembler/JITOperationList.cpp:
(JSC::llintOperations):
* Source/JavaScriptCore/bytecode/BytecodeList.rb:
* Source/JavaScriptCore/llint/LLIntThunks.cpp:
(JSC::LLInt::wasmFunctionEntryThunkSIMD):
* Source/JavaScriptCore/llint/LLIntThunks.h:
* Source/JavaScriptCore/llint/LowLevelInterpreter.asm:
* Source/JavaScriptCore/llint/WebAssembly.asm:
* Source/JavaScriptCore/offlineasm/arm64.rb:
* Source/JavaScriptCore/offlineasm/instructions.rb:
* Source/JavaScriptCore/offlineasm/risc.rb:
* Source/JavaScriptCore/offlineasm/x86.rb:
* Source/JavaScriptCore/runtime/Options.cpp:
(JSC::Options::recomputeDependentOptions):
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/JavaScriptCore/wasm/WasmAirIRGenerator.cpp:
(JSC::Wasm::AirIRGenerator::notifyFunctionUsesSIMD):
(JSC::Wasm::AirIRGenerator::AirIRGenerator):
(JSC::Wasm::AirIRGenerator::addCrash):
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::addCrash):
* Source/JavaScriptCore/wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser<Context>::parse):
(JSC::Wasm::FunctionParser<Context>::simd):
(JSC::Wasm::FunctionParser<Context>::parseExpression):
(JSC::Wasm::FunctionParser<Context>::parseUnreachableExpression):
* Source/JavaScriptCore/wasm/WasmLLIntGenerator.cpp:
(JSC::Wasm::LLIntGenerator::notifyFunctionUsesSIMD):
(JSC::Wasm::LLIntGenerator::addCrash):
* Source/JavaScriptCore/wasm/WasmLLIntPlan.cpp:
(JSC::Wasm::LLIntPlan::didCompleteCompilation):
* Source/JavaScriptCore/wasm/WasmModuleInformation.h:
(JSC::Wasm::ModuleInformation::isSIMDFunction const):
(JSC::Wasm::ModuleInformation::addSIMDFunction):
* Source/JavaScriptCore/wasm/WasmOperations.cpp:
(JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/wasm/WasmSlowPaths.cpp:
(JSC::LLInt::wasm_log_crash):
(JSC::LLInt::jitCompileAndSetHeuristics):
(JSC::LLInt::jitCompileSIMDFunction):
(JSC::LLInt::WASM_SLOW_PATH_DECL):
* Source/JavaScriptCore/wasm/WasmSlowPaths.h:
* Source/JavaScriptCore/wasm/WasmTypeDefinition.h:
(JSC::Wasm::FunctionSignature::numReturnVectors const):

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




More information about the webkit-changes mailing list