[webkit-changes] [WebKit/WebKit] fa0d2c: Inline small wasm functions

Justin Michaud noreply at github.com
Fri Mar 3 17:17:02 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fa0d2ca34a9cdfc451719663ed074136e63ac3a0
      https://github.com/WebKit/WebKit/commit/fa0d2ca34a9cdfc451719663ed074136e63ac3a0
  Author: Justin Michaud <justin_michaud at apple.com>
  Date:   2023-03-03 (Fri, 03 Mar 2023)

  Changed paths:
    M JSTests/wasm/function-tests/stack-trace.js
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-delegate-block.js
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-delegate-block.wasm
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-delegate-block.wat
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-delegate-catch.js
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-delegate-catch.wasm
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-delegate-catch.wat
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-delegate.js
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-delegate.wasm
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-delegate.wat
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-tag-arg.js
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-tag-arg.wasm
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch-with-tag-arg.wat
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch.js
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch.wasm
    A JSTests/wasm/stress/simple-inline-exception-inlinee-catch.wat
    A JSTests/wasm/stress/simple-inline-exception.js
    A JSTests/wasm/stress/simple-inline-exception.wasm
    A JSTests/wasm/stress/simple-inline-exception.wat
    A JSTests/wasm/stress/simple-inline-one-arg.js
    A JSTests/wasm/stress/simple-inline-one-arg.wasm
    A JSTests/wasm/stress/simple-inline-one-arg.wat
    A JSTests/wasm/stress/simple-inline.js
    A JSTests/wasm/stress/simple-inline.wasm
    A JSTests/wasm/stress/simple-inline.wat
    M JSTests/wasm/stress/tail-call.js
    M Source/JavaScriptCore/runtime/OptionsList.h
    M Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmModuleInformation.h
    M Tools/Scripts/run-jsc-stress-tests

  Log Message:
  -----------
  Inline small wasm functions
https://bugs.webkit.org/show_bug.cgi?id=252717

Reviewed by Yusuke Suzuki.

Support inlining small wasm functions. When we decide to inline,
we parse the inlinee and add its b3 nodes directly to our graph.

Our inlinee's exception handlers are added directly, but they take care to add extra
buffer state for their catch handlers. This state is ignored in the caller.

Arguments and return values are handled transparently, and we skip the
prologue, epilogue or stack check as the caller should handle these things.

Finally, we add a new testing mode that aggressively inlines to test this new pass.

* JSTests/wasm/stress/simple-inline-exception.js: Added.
(catch):
* JSTests/wasm/stress/simple-inline-exception.wasm: Added.
* JSTests/wasm/stress/simple-inline-exception.wat: Added.
* JSTests/wasm/stress/simple-inline.js: Added.
* JSTests/wasm/stress/simple-inline.wasm: Added.
* JSTests/wasm/stress/simple-inline.wat: Added.
* Source/JavaScriptCore/b3/B3Generate.cpp:
(JSC::B3::generateToAir):
* Source/JavaScriptCore/b3/B3StackmapValue.cpp:
(JSC::B3::StackmapValue::dumpMeta const):
* Source/JavaScriptCore/b3/B3Value.cpp:
(JSC::B3::Value::generateCompilerConstructionSite):
(JSC::B3::Value::deepDump const):
* Source/JavaScriptCore/jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::restoreCalleeSavesFromEntryFrameCalleeSavesBuffer):
(JSC::AssemblyHelpers::restoreCalleeSavesFromVMEntryFrameCalleeSavesBufferImpl):
(JSC::AssemblyHelpers::emitSave):
(JSC::AssemblyHelpers::emitRestore):
(JSC::AssemblyHelpers::emitSaveCalleeSavesFor):
(JSC::AssemblyHelpers::emitRestoreCalleeSavesFor):
* Source/JavaScriptCore/jit/AssemblyHelpersSpoolers.h:
(JSC::AssemblyHelpers::Spooler::execute):
* Source/JavaScriptCore/runtime/OptionsList.h:
* Source/JavaScriptCore/runtime/VM.cpp:
(JSC::VM::throwException):
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::addStackMap):
(JSC::Wasm::B3IRGenerator::takeStackmaps):
(JSC::Wasm::B3IRGenerator::takeExceptionHandlers):
(JSC::Wasm::B3IRGenerator::B3IRGenerator):
(JSC::Wasm::B3IRGenerator::addLoop):
(JSC::Wasm::B3IRGenerator::preparePatchpointForExceptions):
(JSC::Wasm::B3IRGenerator::emitCatchImpl):
(JSC::Wasm::B3IRGenerator::addDelegateToUnreachable):
(JSC::Wasm::B3IRGenerator::addReturn):
(JSC::Wasm::B3IRGenerator::emitInlineDirectCall):
(JSC::Wasm::B3IRGenerator::addCall):
* Source/JavaScriptCore/wasm/WasmCallee.cpp:
(JSC::Wasm::Callee::Callee):
(JSC::Wasm::Callee::runWithDowncast):
* Source/JavaScriptCore/wasm/WasmCompilationMode.cpp:
(JSC::Wasm::makeString):
* Source/JavaScriptCore/wasm/WasmCompilationMode.h:
(JSC::Wasm::isOSREntry):
(JSC::Wasm::isAnyBBQ):
(JSC::Wasm::isAnyOMG):
* Source/JavaScriptCore/wasm/WasmIRGeneratorHelpers.h:
(JSC::Wasm::emitThrowImpl):
* Source/JavaScriptCore/wasm/WasmModuleInformation.h:
(JSC::Wasm::ModuleInformation::functionWasmSizeImportSpace const):
(JSC::Wasm::ModuleInformation::functionWasmSize const):
(JSC::Wasm::ModuleInformation::isSIMDFunctionImportSpace const):
(JSC::Wasm::ModuleInformation::isSIMDFunction const):
(JSC::Wasm::ModuleInformation::addSIMDFunction):
(JSC::Wasm::ModuleInformation::doneSeeingFunction):
* Tools/Scripts/run-jsc-stress-tests:

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




More information about the webkit-changes mailing list