Title: [286901] trunk/Source/_javascript_Core
- Revision
- 286901
- Author
- ysuz...@apple.com
- Date
- 2021-12-10 21:11:13 -0800 (Fri, 10 Dec 2021)
Log Message
[JSC] Wasm catch thunk should be JIT code to use ExceptionHandlerPtrTag
https://bugs.webkit.org/show_bug.cgi?id=234183
Reviewed by Tadeu Zagallo.
ExceptionHandlerPtrTag is only usable for JITCode. Thus, we should not tag wasm catch LLInt code with it.
This patch fixes it by using trampoline. This is the same to normal LLInt's handleCatchThunk.
* assembler/JITOperationList.cpp:
(JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt):
* llint/LLIntExceptions.cpp:
(JSC::LLInt::handleWasmCatch):
(JSC::LLInt::handleWasmCatchAll):
* llint/LLIntThunks.cpp:
(JSC::LLInt::handleWasmCatchThunk):
(JSC::LLInt::handleWasmCatchAllThunk):
* llint/LLIntThunks.h:
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (286900 => 286901)
--- trunk/Source/_javascript_Core/ChangeLog 2021-12-11 03:43:48 UTC (rev 286900)
+++ trunk/Source/_javascript_Core/ChangeLog 2021-12-11 05:11:13 UTC (rev 286901)
@@ -1,3 +1,23 @@
+2021-12-10 Yusuke Suzuki <ysuz...@apple.com>
+
+ [JSC] Wasm catch thunk should be JIT code to use ExceptionHandlerPtrTag
+ https://bugs.webkit.org/show_bug.cgi?id=234183
+
+ Reviewed by Tadeu Zagallo.
+
+ ExceptionHandlerPtrTag is only usable for JITCode. Thus, we should not tag wasm catch LLInt code with it.
+ This patch fixes it by using trampoline. This is the same to normal LLInt's handleCatchThunk.
+
+ * assembler/JITOperationList.cpp:
+ (JSC::JITOperationList::populatePointersInJavaScriptCoreForLLInt):
+ * llint/LLIntExceptions.cpp:
+ (JSC::LLInt::handleWasmCatch):
+ (JSC::LLInt::handleWasmCatchAll):
+ * llint/LLIntThunks.cpp:
+ (JSC::LLInt::handleWasmCatchThunk):
+ (JSC::LLInt::handleWasmCatchAllThunk):
+ * llint/LLIntThunks.h:
+
2021-12-10 Michael Saboff <msab...@apple.com>
https://bugs.webkit.org/show_bug.cgi?id=234173
Modified: trunk/Source/_javascript_Core/assembler/JITOperationList.cpp (286900 => 286901)
--- trunk/Source/_javascript_Core/assembler/JITOperationList.cpp 2021-12-11 03:43:48 UTC (rev 286900)
+++ trunk/Source/_javascript_Core/assembler/JITOperationList.cpp 2021-12-11 05:11:13 UTC (rev 286901)
@@ -146,6 +146,10 @@
LLINT_ROUTINE(fuzzer_return_early_from_loop_hint)
LLINT_OP(op_catch)
+ LLINT_OP(wasm_catch)
+ LLINT_OP(wasm_catch_no_tls)
+ LLINT_OP(wasm_catch_all)
+ LLINT_OP(wasm_catch_all_no_tls)
LLINT_OP(llint_generic_return_point)
LLINT_RETURN_LOCATION(op_get_by_id)
Modified: trunk/Source/_javascript_Core/llint/LLIntExceptions.cpp (286900 => 286901)
--- trunk/Source/_javascript_Core/llint/LLIntExceptions.cpp 2021-12-11 03:43:48 UTC (rev 286900)
+++ trunk/Source/_javascript_Core/llint/LLIntExceptions.cpp 2021-12-11 05:11:13 UTC (rev 286901)
@@ -108,6 +108,10 @@
#if ENABLE(WEBASSEMBLY)
MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleWasmCatch(OpcodeSize size)
{
+#if ENABLE(JIT)
+ if (Options::useJIT())
+ return handleWasmCatchThunk(size);
+#endif
WasmOpcodeID opcode = Wasm::Context::useFastTLS() ? wasm_catch : wasm_catch_no_tls;
switch (size) {
case OpcodeSize::Narrow:
@@ -123,6 +127,10 @@
MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleWasmCatchAll(OpcodeSize size)
{
+#if ENABLE(JIT)
+ if (Options::useJIT())
+ return handleWasmCatchAllThunk(size);
+#endif
WasmOpcodeID opcode = Wasm::Context::useFastTLS() ? wasm_catch_all : wasm_catch_all_no_tls;
switch (size) {
case OpcodeSize::Narrow:
Modified: trunk/Source/_javascript_Core/llint/LLIntThunks.cpp (286900 => 286901)
--- trunk/Source/_javascript_Core/llint/LLIntThunks.cpp 2021-12-11 03:43:48 UTC (rev 286900)
+++ trunk/Source/_javascript_Core/llint/LLIntThunks.cpp 2021-12-11 05:11:13 UTC (rev 286901)
@@ -298,6 +298,74 @@
return { };
}
+#if ENABLE(WEBASSEMBLY)
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleWasmCatchThunk(OpcodeSize size)
+{
+ WasmOpcodeID opcode = Wasm::Context::useFastTLS() ? wasm_catch : wasm_catch_no_tls;
+ switch (size) {
+ case OpcodeSize::Narrow: {
+ static LazyNeverDestroyed<MacroAssemblerCodeRef<ExceptionHandlerPtrTag>> codeRef;
+ static std::once_flag onceKey;
+ std::call_once(onceKey, [&] {
+ codeRef.construct(generateThunkWithJumpTo<ExceptionHandlerPtrTag>(LLInt::getCodeFunctionPtr<OperationPtrTag>(opcode), "wasm_catch"));
+ });
+ return codeRef;
+ }
+ case OpcodeSize::Wide16: {
+ static LazyNeverDestroyed<MacroAssemblerCodeRef<ExceptionHandlerPtrTag>> codeRef;
+ static std::once_flag onceKey;
+ std::call_once(onceKey, [&] {
+ codeRef.construct(generateThunkWithJumpTo<ExceptionHandlerPtrTag>(LLInt::getWide16CodeFunctionPtr<OperationPtrTag>(opcode), "wasm_catch16"));
+ });
+ return codeRef;
+ }
+ case OpcodeSize::Wide32: {
+ static LazyNeverDestroyed<MacroAssemblerCodeRef<ExceptionHandlerPtrTag>> codeRef;
+ static std::once_flag onceKey;
+ std::call_once(onceKey, [&] {
+ codeRef.construct(generateThunkWithJumpTo<ExceptionHandlerPtrTag>(LLInt::getWide32CodeFunctionPtr<OperationPtrTag>(opcode), "wasm_catch32"));
+ });
+ return codeRef;
+ }
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ return { };
+}
+
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleWasmCatchAllThunk(OpcodeSize size)
+{
+ WasmOpcodeID opcode = Wasm::Context::useFastTLS() ? wasm_catch_all : wasm_catch_all_no_tls;
+ switch (size) {
+ case OpcodeSize::Narrow: {
+ static LazyNeverDestroyed<MacroAssemblerCodeRef<ExceptionHandlerPtrTag>> codeRef;
+ static std::once_flag onceKey;
+ std::call_once(onceKey, [&] {
+ codeRef.construct(generateThunkWithJumpTo<ExceptionHandlerPtrTag>(LLInt::getCodeFunctionPtr<OperationPtrTag>(opcode), "wasm_catch_all"));
+ });
+ return codeRef;
+ }
+ case OpcodeSize::Wide16: {
+ static LazyNeverDestroyed<MacroAssemblerCodeRef<ExceptionHandlerPtrTag>> codeRef;
+ static std::once_flag onceKey;
+ std::call_once(onceKey, [&] {
+ codeRef.construct(generateThunkWithJumpTo<ExceptionHandlerPtrTag>(LLInt::getWide16CodeFunctionPtr<OperationPtrTag>(opcode), "wasm_catch_all16"));
+ });
+ return codeRef;
+ }
+ case OpcodeSize::Wide32: {
+ static LazyNeverDestroyed<MacroAssemblerCodeRef<ExceptionHandlerPtrTag>> codeRef;
+ static std::once_flag onceKey;
+ std::call_once(onceKey, [&] {
+ codeRef.construct(generateThunkWithJumpTo<ExceptionHandlerPtrTag>(LLInt::getWide32CodeFunctionPtr<OperationPtrTag>(opcode), "wasm_catch_all32"));
+ });
+ return codeRef;
+ }
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ return { };
+}
+#endif
+
MacroAssemblerCodeRef<JSEntryPtrTag> genericReturnPointThunk(OpcodeSize size)
{
switch (size) {
Modified: trunk/Source/_javascript_Core/llint/LLIntThunks.h (286900 => 286901)
--- trunk/Source/_javascript_Core/llint/LLIntThunks.h 2021-12-11 03:43:48 UTC (rev 286900)
+++ trunk/Source/_javascript_Core/llint/LLIntThunks.h 2021-12-11 05:11:13 UTC (rev 286901)
@@ -81,6 +81,11 @@
MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleUncaughtExceptionThunk();
MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleCatchThunk(OpcodeSize);
+#if ENABLE(WEBASSEMBLY)
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleWasmCatchThunk(OpcodeSize);
+MacroAssemblerCodeRef<ExceptionHandlerPtrTag> handleWasmCatchAllThunk(OpcodeSize);
+#endif
+
#if ENABLE(JIT_CAGE)
MacroAssemblerCodeRef<NativeToJITGatePtrTag> jitCagePtrThunk();
#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes