[webkit-changes] [WebKit/WebKit] d8cbb6: Share JS -> Wasm IC entrypoint code

Keith Miller noreply at github.com
Wed Sep 11 10:38:33 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: d8cbb604f912d93e8d282803766de3578aea5852
      https://github.com/WebKit/WebKit/commit/d8cbb604f912d93e8d282803766de3578aea5852
  Author: Keith Miller <keith_miller at apple.com>
  Date:   2024-09-11 (Wed, 11 Sep 2024)

  Changed paths:
    M JSTests/stress/ftl-put-by-id-setter-exception-interesting-live-state.js
    M JSTests/wasm/WASM.js
    M JSTests/wasm/wabt-wrapper.js
    M Source/JavaScriptCore/bytecode/Repatch.cpp
    M Source/JavaScriptCore/interpreter/CallFrame.cpp
    M Source/JavaScriptCore/jit/AssemblyHelpers.cpp
    M Source/JavaScriptCore/jit/AssemblyHelpers.h
    M Source/JavaScriptCore/jit/CCallHelpers.h
    M Source/JavaScriptCore/jsc.cpp
    M Source/JavaScriptCore/runtime/SamplingProfiler.cpp
    M Source/JavaScriptCore/wasm/WasmCallee.cpp
    M Source/JavaScriptCore/wasm/WasmCallee.h
    M Source/JavaScriptCore/wasm/WasmCallingConvention.h
    M Source/JavaScriptCore/wasm/WasmCompilationMode.cpp
    M Source/JavaScriptCore/wasm/WasmCompilationMode.h
    M Source/JavaScriptCore/wasm/WasmOMGIRGenerator32_64.cpp
    M Source/JavaScriptCore/wasm/WasmOperations.cpp
    M Source/JavaScriptCore/wasm/WasmOperations.h
    M Source/JavaScriptCore/wasm/WasmSectionParser.cpp
    M Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp
    M Source/JavaScriptCore/wasm/WasmTypeDefinition.h
    M Source/JavaScriptCore/wasm/js/JSToWasm.cpp
    M Source/JavaScriptCore/wasm/js/JSToWasm.h
    M Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp
    M Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h
    M Source/JavaScriptCore/wasm/js/WebAssemblyFunctionBase.cpp
    M Source/JavaScriptCore/wasm/js/WebAssemblyFunctionBase.h
    M Tools/Scripts/run-jsc-stress-tests

  Log Message:
  -----------
  Share JS -> Wasm IC entrypoint code
https://bugs.webkit.org/show_bug.cgi?id=278674
rdar://134724248

Reviewed by Yusuke Suzuki.

Right now JS -> Wasm IC code is specific to a WebAssemblyFunction but most of the
logic is shared between every function with the same Wasm::Signature. This patch now
shares the JIT code between every WebAssemblyFunction with the same signature.

To make this work we now get the instance/entrypoint from the WebAssemblyFunction
via a load rather than embedding the constants/address of constants into the function.

Most of the other logic is the same however, in order to not load the instance twice we
can no longer use wasmContextInstancePointer as a scratch. Now, for arm64 we just use
wasmBaseMemoryPointer as the scratch and for x86 we try to use argumentGPR0 when not
initializing the first GP argument otherwise we clobber numberTagRegister. We could end
up using numberTagRegister again if there's a FP argument before the first GP argument
e.g. `(f32, i64) -> void`

* JSTests/wasm/WASM.js:
* JSTests/wasm/wabt-wrapper.js:
(export.async compile):
* Source/JavaScriptCore/bytecode/Repatch.cpp:
(JSC::jsToWasmICCodePtr):
* Source/JavaScriptCore/interpreter/CallFrame.cpp:
(JSC::CallFrame::dump const):
* Source/JavaScriptCore/jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::emitLoadStructure):
* Source/JavaScriptCore/jit/AssemblyHelpers.h:
* Source/JavaScriptCore/jit/CCallHelpers.h:
(JSC::CCallHelpers::operationExceptionRegister):
* Source/JavaScriptCore/jsc.cpp:
(JSC_DEFINE_HOST_FUNCTION):
* Source/JavaScriptCore/runtime/SamplingProfiler.cpp:
(JSC::descriptionForLocation):
* Source/JavaScriptCore/wasm/WasmCallee.h:
* Source/JavaScriptCore/wasm/WasmCallingConvention.h:
(JSC::Wasm::JSCallingConvention::callInformationFor const):
* Source/JavaScriptCore/wasm/WasmCompilationMode.cpp:
(JSC::Wasm::makeString): Deleted.
* Source/JavaScriptCore/wasm/WasmCompilationMode.h:
* Source/JavaScriptCore/wasm/WasmOperations.cpp:
(JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
* Source/JavaScriptCore/wasm/WasmOperations.h:
* Source/JavaScriptCore/wasm/WasmSectionParser.cpp:
(JSC::Wasm::SectionParser::parseException):
* Source/JavaScriptCore/wasm/WasmTypeDefinition.cpp:
(JSC::Wasm::FunctionSignature::FunctionSignature):
(JSC::Wasm::FunctionSignature::~FunctionSignature):
* Source/JavaScriptCore/wasm/WasmTypeDefinition.h:
(JSC::Wasm::TypeDefinition::TypeDefinition):
(JSC::Wasm::FunctionSignature::FunctionSignature): Deleted.
* Source/JavaScriptCore/wasm/js/JSToWasm.cpp:
(JSC::Wasm::marshallJSResult):
(JSC::Wasm::createJSToWasmJITInterpreter):
(JSC::Wasm::createJSToWasmWrapper):
(JSC::Wasm::trampolineReservedStackSize):
(JSC::Wasm::FunctionSignature::jsToWasmICEntrypoint const):
* Source/JavaScriptCore/wasm/js/JSToWasm.h:
* Source/JavaScriptCore/wasm/js/WebAssemblyFunction.cpp:
(JSC::WebAssemblyFunction::usedCalleeSaveRegisters):
(JSC::WebAssemblyFunction::WebAssemblyFunction):
(JSC::WebAssemblyFunction::usesTagRegisters const): Deleted.
(JSC::WebAssemblyFunction::calleeSaves const): Deleted.
(JSC::WebAssemblyFunction::usedCalleeSaveRegisters const): Deleted.
(JSC::trampolineReservedStackSize): Deleted.
(JSC::WebAssemblyFunction::jsCallEntrypointSlow): Deleted.
* Source/JavaScriptCore/wasm/js/WebAssemblyFunction.h:
* Source/JavaScriptCore/wasm/js/WebAssemblyFunctionBase.cpp:
(JSC::WebAssemblyFunctionBase::WebAssemblyFunctionBase):
(JSC::WebAssemblyFunctionBase::signature const):
* Source/JavaScriptCore/wasm/js/WebAssemblyFunctionBase.h:
* Tools/Scripts/run-jsc-stress-tests:

Canonical link: https://commits.webkit.org/283492@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