[webkit-changes] [WebKit/WebKit] 4aeafe: [JSC] Extract wasm Catch runway into thunk

Yusuke Suzuki noreply at github.com
Mon Mar 6 11:37:49 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4aeafe5991bcfa11babf29a942217a7b9f2272bb
      https://github.com/WebKit/WebKit/commit/4aeafe5991bcfa11babf29a942217a7b9f2272bb
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-03-06 (Mon, 06 Mar 2023)

  Changed paths:
    M Source/JavaScriptCore/interpreter/Interpreter.cpp
    M Source/JavaScriptCore/interpreter/Interpreter.h
    M Source/JavaScriptCore/jit/JITExceptions.cpp
    M Source/JavaScriptCore/runtime/VM.h
    M Source/JavaScriptCore/wasm/WasmAirIRGenerator32_64.cpp
    M Source/JavaScriptCore/wasm/WasmAirIRGenerator64.cpp
    M Source/JavaScriptCore/wasm/WasmAirIRGeneratorBase.h
    M Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmBBQJIT.cpp
    M Source/JavaScriptCore/wasm/WasmIRGeneratorHelpers.h
    M Source/JavaScriptCore/wasm/WasmOperations.cpp
    M Source/JavaScriptCore/wasm/WasmOperations.h
    M Source/JavaScriptCore/wasm/WasmThunks.cpp
    M Source/JavaScriptCore/wasm/WasmThunks.h
    M Source/JavaScriptCore/wasm/js/JSWebAssemblyException.h

  Log Message:
  -----------
  [JSC] Extract wasm Catch runway into thunk
https://bugs.webkit.org/show_bug.cgi?id=253407
rdar://106249350

Reviewed by Justin Michaud.

Wasm catch requires a lot of code. And this is not so great given that some of super large realworld websites use
massive amount of try-catch inside wasm.

This patch extracts wasm catch runway into a thunk, and share it in all wasm tiers. And each wasm functions' catch
only includes the remaining part. VM now has a pointer which is used after the wasm catch runway. And thunk dispatches
this after setting up things. This is the same design to what wasm LLInt is doing basically. This change can reduce
code size significantly.

* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::CatchInfo::CatchInfo):
* Source/JavaScriptCore/interpreter/Interpreter.h:
* Source/JavaScriptCore/jit/JITExceptions.cpp:
(JSC::genericUnwind):
* Source/JavaScriptCore/runtime/VM.h:
* Source/JavaScriptCore/wasm/WasmAirIRGenerator32_64.cpp:
(JSC::Wasm::buildEntryBufferForCatch32):
(JSC::Wasm::buildEntryBufferForCatchSIMD32):
(JSC::Wasm::buildEntryBufferForCatchNoSIMD32):
(JSC::Wasm::emitCatchPrologueShared):
(JSC::Wasm::AirIRGenerator32::finalizeEntrypoints):
(JSC::Wasm::AirIRGenerator32::emitCatchImpl):
* Source/JavaScriptCore/wasm/WasmAirIRGenerator64.cpp:
(JSC::Wasm::AirIRGenerator64::finalizeEntrypoints):
(JSC::Wasm::AirIRGenerator64::emitCatchImpl):
(JSC::Wasm::parseAndCompileAir):
* Source/JavaScriptCore/wasm/WasmAirIRGeneratorBase.h:
(JSC::Wasm::ExpressionType>::AirIRGeneratorBase):
(JSC::Wasm::ExpressionType>::finalizeEntrypoints): Deleted.
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::insertEntrySwitch):
(JSC::Wasm::B3IRGenerator::addCatchToUnreachable):
(JSC::Wasm::B3IRGenerator::emitCatchImpl):
(JSC::Wasm::parseAndCompileB3):
* Source/JavaScriptCore/wasm/WasmBBQJIT.cpp:
(JSC::Wasm::BBQJIT::emitCatchPrologue):
(JSC::Wasm::BBQJIT::emitCatchAllImpl):
(JSC::Wasm::BBQJIT::emitCatchImpl):
(JSC::Wasm::parseAndCompileBBQ):
* Source/JavaScriptCore/wasm/WasmIRGeneratorHelpers.h:
(JSC::Wasm::buildEntryBufferForCatch):
(JSC::Wasm::emitCatchPrologueShared): Deleted.
* Source/JavaScriptCore/wasm/WasmOperations.cpp:
(JSC::Wasm::JSC_DEFINE_JIT_OPERATION):
(JSC::Wasm::retrieveAndClearExceptionIfCatchableNonSharedImpl):
(JSC::Wasm::WasmOperationsInternal::retrieveAndClearExceptionIfCatchableImpl): Deleted.
* Source/JavaScriptCore/wasm/WasmOperations.h:
* Source/JavaScriptCore/wasm/WasmThunks.cpp:
(JSC::Wasm::catchInWasmThunkGenerator):
* Source/JavaScriptCore/wasm/WasmThunks.h:
* Source/JavaScriptCore/wasm/js/JSWebAssemblyException.h:

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




More information about the webkit-changes mailing list