[webkit-changes] [WebKit/WebKit] 1b97cb: [IPInt] Add support for the exceptions proposal (e...

Keith Miller noreply at github.com
Wed Oct 4 13:59:25 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1b97cb2b6e051d2f0ff0460714103eb4791a1832
      https://github.com/WebKit/WebKit/commit/1b97cb2b6e051d2f0ff0460714103eb4791a1832
  Author: Keith Miller <keith_miller at apple.com>
  Date:   2023-10-04 (Wed, 04 Oct 2023)

  Changed paths:
    M JSTests/wasm/stress/exception-simple-throw-catch.js
    M JSTests/wasm/stress/exception-throw-from-function-returning-tuple.js
    M Source/JavaScriptCore/interpreter/Interpreter.cpp
    M Source/JavaScriptCore/interpreter/Interpreter.h
    M Source/JavaScriptCore/jit/JITExceptions.cpp
    M Source/JavaScriptCore/llint/InPlaceInterpreter.asm
    M Source/JavaScriptCore/llint/InPlaceInterpreter.cpp
    M Source/JavaScriptCore/llint/InPlaceInterpreter.h
    M Source/JavaScriptCore/llint/LowLevelInterpreter.asm
    M Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
    M Source/JavaScriptCore/llint/WebAssembly.asm
    M Source/JavaScriptCore/offlineasm/arm64.rb
    M Source/JavaScriptCore/offlineasm/x86.rb
    M Source/JavaScriptCore/runtime/VM.h
    M Source/JavaScriptCore/wasm/WasmCallee.cpp
    M Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h
    M Source/JavaScriptCore/wasm/WasmFunctionParser.h
    M Source/JavaScriptCore/wasm/WasmHandlerInfo.cpp
    M Source/JavaScriptCore/wasm/WasmHandlerInfo.h
    M Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp
    M Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.cpp
    M Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.h

  Log Message:
  -----------
  [IPInt] Add support for the exceptions proposal (except rethrow)
https://bugs.webkit.org/show_bug.cgi?id=262446

Reviewed by Justin Michaud.

This patch adds support for the Wasm exceptions proposal, with the exception (pun intended) of rethrow.
Rethrow is suffiecently complicated in the IPInt that it should be in its own patch.

Exceptions work mostly as they do in the rest of JSC. When an exception is thrown we write the
target PC and the (newly added) MC to the VM. These tell us where to go once we've reentered the
IPInt. There's also two new entrypoints to the IPInt, one for regular catch blocks and one
for catch_all blocks.

Like the Wasm LLInt, IPInt exception handling works based on PC ranges. The current PC is (now) stored
to the CallFrame's CallSiteIndex when making calls / performing operations. When an exception is thrown
we check that the PC from the CallFrame is inside the range from one of the function's HandlerInfo.

This patch also has a couple of other fixes/improvements:
    1) offlineasm self moves should actually be elided. Previously we were checking that the
       two ruby objects had the same address, which didn't work.
    2) Add a dump to the IPInt, which tells you what the PC and MC should be for each instruction.
    3) Move the _ipint_call_impl call label below the call interpreter macros so it's clear
       _ipint_call_impl can fall through to .ipint_call_common.
    4) Add a message to the IPInt validation so you know which opcodes are too big.
    5) Rename WasmCodeBlock to UnboxedWasmCalleeStackSlot.
    6) Rename LLIntReturnPC to CallSiteIndex to match CallFrame.

* JSTests/wasm/stress/exception-liveness-tier-up.js:
(assert.eq.): Deleted.
(assert.eq): Deleted.
* JSTests/wasm/stress/exception-simple-throw-catch.js:
(testSimpleTryCatchValue2):
(testNestedCatch):
* JSTests/wasm/stress/exception-throw-from-function-returning-tuple.js:
(testCatchWithExceptionThrownFromFunctionReturningTuple3):
(testCatchWithExceptionThrownFromJSReturningTuple.callback):
(testCatchWithExceptionThrownFromJSReturningTuple):
* Source/JavaScriptCore/interpreter/Interpreter.cpp:
(JSC::CatchInfo::CatchInfo):
* Source/JavaScriptCore/interpreter/Interpreter.h:
* Source/JavaScriptCore/jit/JITExceptions.cpp:
(JSC::genericUnwind):
* Source/JavaScriptCore/llint/InPlaceInterpreter.asm:
* Source/JavaScriptCore/llint/InPlaceInterpreter.cpp:
* Source/JavaScriptCore/llint/InPlaceInterpreter.h:
* Source/JavaScriptCore/llint/WebAssembly.asm:
* Source/JavaScriptCore/offlineasm/arm64.rb:
* Source/JavaScriptCore/runtime/VM.h:
* Source/JavaScriptCore/wasm/WasmCallee.cpp:
(JSC::Wasm::IPIntCallee::IPIntCallee):
* Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h:
* Source/JavaScriptCore/wasm/WasmFunctionParser.h:
(JSC::Wasm::FunctionParser::getStackHeightInValues const):
* Source/JavaScriptCore/wasm/WasmHandlerInfo.cpp:
(JSC::Wasm::HandlerInfo::initialize):
* Source/JavaScriptCore/wasm/WasmHandlerInfo.h:
(JSC::Wasm::UnlinkedHandlerInfo::UnlinkedHandlerInfo):
* Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp:
(JSC::Wasm::IPIntGenerator::condenseControlFlowInstructions):
(JSC::Wasm::IPIntGenerator::addTry):
(JSC::Wasm::IPIntGenerator::convertTryToCatch):
(JSC::Wasm::IPIntGenerator::addCatch):
(JSC::Wasm::IPIntGenerator::addCatchToUnreachable):
(JSC::Wasm::IPIntGenerator::addCatchAllToUnreachable):
(JSC::Wasm::IPIntGenerator::addDelegate):
(JSC::Wasm::IPIntGenerator::addDelegateToUnreachable):
(JSC::Wasm::IPIntGenerator::addThrow):
(JSC::Wasm::IPIntGenerator::addEndToUnreachable):
(JSC::Wasm::IPIntGenerator::dump):
* Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.cpp:
(JSC::LLInt::WASM_IPINT_EXTERN_CPP_DECL):
* Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.h:
* Source/WebCore/rendering/svg/legacy/LegacyRenderSVGResourceClipperInlines.h: Removed.

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




More information about the webkit-changes mailing list