[webkit-changes] [WebKit/WebKit] 616189: [IPInt] Add rethrow
Keith Miller
noreply at github.com
Fri Oct 6 11:30:09 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 6161899549cff11020e444532726383465a26482
https://github.com/WebKit/WebKit/commit/6161899549cff11020e444532726383465a26482
Author: Keith Miller <keith_miller at apple.com>
Date: 2023-10-06 (Fri, 06 Oct 2023)
Changed paths:
A JSTests/wasm/stress/try-catch-loop-osr.js
M Source/JavaScriptCore/CMakeLists.txt
M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
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.h
M Source/JavaScriptCore/offlineasm/arm64.rb
M Source/JavaScriptCore/offlineasm/instructions.rb
M Source/JavaScriptCore/runtime/VM.h
M Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp
M Source/JavaScriptCore/wasm/WasmBBQJIT.cpp
M Source/JavaScriptCore/wasm/WasmBBQPlan.cpp
M Source/JavaScriptCore/wasm/WasmCallee.cpp
M Source/JavaScriptCore/wasm/WasmCallee.h
M Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h
M Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp
M Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.cpp
M Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.h
A Source/JavaScriptCore/wasm/WasmIPIntTierUpCounter.h
M Source/JavaScriptCore/wasm/WasmOMGPlan.cpp
M Source/JavaScriptCore/wasm/WasmOSREntryPlan.cpp
Log Message:
-----------
[IPInt] Add rethrow
https://bugs.webkit.org/show_bug.cgi?id=262704
Reviewed by Justin Michaud.
This patch adds support for rethrow in the IPInt. In the other wasm tiers rethrows are saved at the top
of the try/catch block's execution stack and popped when exiting the block. Since the IPInt doesn't have
any metadata on End instructions (And we don't really want to add metdata there), the location of pending
rethrows needs to be saved in a shadow stack. This shadow stack is located between the callframe and the
locals in the IPInt frame. In order to know which shadow stack slot to store the pending exception we could
save the try depth in the metadata but this would use more memory. Instead, a new field targetTryDepthForThrow
has been added to VM that forwards the try depth to the catch handler from the HandlerInfo.
268872 at main had a bug that it didn't restore the pointer to locals when reentering from an exception, this
fixes that.
We also add a new IPIntTierUpCount, which uses less memory than LLIntTierUpCount since it no longer has a
mostly unused vector. Lastly, this patch adds support for load/store pair (int width) in the offlineasm.
* JSTests/wasm/stress/try-catch-loop-osr.js: Added.
(import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.loopOSRWithRethrow.callback):
(import.Builder.from.string_appeared_here.import.as.assert.from.string_appeared_here.loopOSRWithRethrow):
(loopOSRWithMultiRethrow1.callback):
(loopOSRWithMultiRethrow1):
(loopOSRWithMultiRethrow2):
* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* 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.h:
* Source/JavaScriptCore/offlineasm/arm64.rb:
* Source/JavaScriptCore/offlineasm/instructions.rb:
* Source/JavaScriptCore/runtime/VM.h:
* Source/JavaScriptCore/wasm/WasmB3IRGenerator.cpp:
(JSC::Wasm::B3IRGenerator::emitLoopTierUpCheck):
* Source/JavaScriptCore/wasm/WasmBBQJIT.cpp:
(JSC::Wasm::BBQJIT::makeStackMap):
* Source/JavaScriptCore/wasm/WasmBBQPlan.cpp:
(JSC::Wasm::BBQPlan::work):
* Source/JavaScriptCore/wasm/WasmCallee.cpp:
(JSC::Wasm::IPIntCallee::IPIntCallee):
* Source/JavaScriptCore/wasm/WasmCallee.h:
* Source/JavaScriptCore/wasm/WasmFunctionIPIntMetadataGenerator.h:
(JSC::Wasm::FunctionIPIntMetadataGenerator::tierUpCounter):
* Source/JavaScriptCore/wasm/WasmIPIntGenerator.cpp:
(JSC::Wasm::IPIntGenerator::addLoop):
(JSC::Wasm::IPIntGenerator::addTry):
(JSC::Wasm::IPIntGenerator::addCatchToUnreachable):
(JSC::Wasm::IPIntGenerator::addCatchAllToUnreachable):
(JSC::Wasm::IPIntGenerator::addRethrow):
(JSC::Wasm::IPIntGenerator::finalize):
* Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.cpp:
(JSC::LLInt::jitCompileAndSetHeuristics):
(JSC::LLInt::WASM_IPINT_EXTERN_CPP_DECL):
* Source/JavaScriptCore/wasm/WasmIPIntSlowPaths.h:
* Source/JavaScriptCore/wasm/WasmIPIntTierUpCounter.h: Added.
(JSC::Wasm::IPIntTierUpCounter::IPIntTierUpCounter):
(JSC::Wasm::IPIntTierUpCounter::optimizeAfterWarmUp):
(JSC::Wasm::IPIntTierUpCounter::checkIfOptimizationThresholdReached):
(JSC::Wasm::IPIntTierUpCounter::optimizeSoon):
(JSC::Wasm::IPIntTierUpCounter::osrEntryDataForLoop const):
* Source/JavaScriptCore/wasm/WasmOMGPlan.cpp:
(JSC::Wasm::OMGPlan::work):
* Source/JavaScriptCore/wasm/WasmOSREntryPlan.cpp:
(JSC::Wasm::OSREntryPlan::work):
Canonical link: https://commits.webkit.org/269002@main
More information about the webkit-changes
mailing list