<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[287311] trunk/Source/JavaScriptCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/287311">287311</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2021-12-21 04:54:37 -0800 (Tue, 21 Dec 2021)</dd>
</dl>

<h3>Log Message</h3>
<pre>[RISCV64] Add or enable missing CPU(RISCV64) codepaths in baseline JIT
https://bugs.webkit.org/show_bug.cgi?id=234551

Patch by Zan Dobersek <zdobersek@igalia.com> on 2021-12-21
Reviewed by Yusuke Suzuki.

Sprinkle the necessary CPU(RISCV64) build guards as well as additional
RISCV64-specific codepaths encapsualted by those build guards in the
baseline JIT code. In many cases we can align with the code that ARM64
is already using.

In InlineAccess, the byte-sizes for access and replacement operations
are based on a mix of educated guessing and aggressive testing.

In baseline JIT, we can usually adopt what ARM64 already does since the
similarities are big enough.

* bytecode/InlineAccess.h: The sizes here are based on the estimated
count of necessary instructions for access or replacement, and were
tested with the enabled crash-inducing fallback in linkCodeInline().
(JSC::InlineAccess::sizeForPropertyAccess):
(JSC::InlineAccess::sizeForPropertyReplace):
(JSC::InlineAccess::sizeForLengthAccess):
* jit/AssemblyHelpers.cpp:
(JSC::AssemblyHelpers::emitLoadStructure):
(JSC::AssemblyHelpers::debugCall):
* jit/AssemblyHelpers.h:
(JSC::AssemblyHelpers::emitSaveThenMaterializeTagRegisters):
(JSC::AssemblyHelpers::emitRestoreSavedTagRegisters):
(JSC::AssemblyHelpers::prologueStackPointerDelta):
(JSC::AssemblyHelpers::emitFunctionPrologue):
(JSC::AssemblyHelpers::emitFunctionEpilogueWithEmptyFrame):
(JSC::AssemblyHelpers::emitFunctionEpilogue):
(JSC::AssemblyHelpers::preserveReturnAddressAfterCall):
(JSC::AssemblyHelpers::restoreReturnAddressBeforeReturn):
* jit/CCallHelpers.h:
(JSC::CCallHelpers::prepareForTailCallSlow):
* jit/CallFrameShuffler.cpp:
(JSC::CallFrameShuffler::prepareForTailCall):
* jit/JITPropertyAccess.cpp:
(JSC::JIT::slow_op_resolve_scopeGenerator):
(JSC::JIT::slow_op_get_from_scopeGenerator):
* jit/RegisterSet.cpp:
(JSC::RegisterSet::macroScratchRegisters):
(JSC::RegisterSet::dfgCalleeSaveRegisters):
(JSC::RegisterSet::ftlCalleeSaveRegisters):
* jit/ThunkGenerators.cpp:
(JSC::popThunkStackPreservesAndHandleExceptionGenerator):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeInlineAccessh">trunk/Source/JavaScriptCore/bytecode/InlineAccess.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitAssemblyHelperscpp">trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitAssemblyHelpersh">trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitCCallHelpersh">trunk/Source/JavaScriptCore/jit/CCallHelpers.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitCallFrameShufflercpp">trunk/Source/JavaScriptCore/jit/CallFrameShuffler.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITPropertyAccesscpp">trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitRegisterSetcpp">trunk/Source/JavaScriptCore/jit/RegisterSet.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitThunkGeneratorscpp">trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (287310 => 287311)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog    2021-12-21 12:42:19 UTC (rev 287310)
+++ trunk/Source/JavaScriptCore/ChangeLog       2021-12-21 12:54:37 UTC (rev 287311)
</span><span class="lines">@@ -1,5 +1,55 @@
</span><span class="cx"> 2021-12-21  Zan Dobersek  <zdobersek@igalia.com>
</span><span class="cx"> 
</span><ins>+        [RISCV64] Add or enable missing CPU(RISCV64) codepaths in baseline JIT
+        https://bugs.webkit.org/show_bug.cgi?id=234551
+
+        Reviewed by Yusuke Suzuki.
+
+        Sprinkle the necessary CPU(RISCV64) build guards as well as additional
+        RISCV64-specific codepaths encapsualted by those build guards in the
+        baseline JIT code. In many cases we can align with the code that ARM64
+        is already using.
+
+        In InlineAccess, the byte-sizes for access and replacement operations
+        are based on a mix of educated guessing and aggressive testing.
+
+        In baseline JIT, we can usually adopt what ARM64 already does since the
+        similarities are big enough.
+
+        * bytecode/InlineAccess.h: The sizes here are based on the estimated
+        count of necessary instructions for access or replacement, and were
+        tested with the enabled crash-inducing fallback in linkCodeInline().
+        (JSC::InlineAccess::sizeForPropertyAccess):
+        (JSC::InlineAccess::sizeForPropertyReplace):
+        (JSC::InlineAccess::sizeForLengthAccess):
+        * jit/AssemblyHelpers.cpp:
+        (JSC::AssemblyHelpers::emitLoadStructure):
+        (JSC::AssemblyHelpers::debugCall):
+        * jit/AssemblyHelpers.h:
+        (JSC::AssemblyHelpers::emitSaveThenMaterializeTagRegisters):
+        (JSC::AssemblyHelpers::emitRestoreSavedTagRegisters):
+        (JSC::AssemblyHelpers::prologueStackPointerDelta):
+        (JSC::AssemblyHelpers::emitFunctionPrologue):
+        (JSC::AssemblyHelpers::emitFunctionEpilogueWithEmptyFrame):
+        (JSC::AssemblyHelpers::emitFunctionEpilogue):
+        (JSC::AssemblyHelpers::preserveReturnAddressAfterCall):
+        (JSC::AssemblyHelpers::restoreReturnAddressBeforeReturn):
+        * jit/CCallHelpers.h:
+        (JSC::CCallHelpers::prepareForTailCallSlow):
+        * jit/CallFrameShuffler.cpp:
+        (JSC::CallFrameShuffler::prepareForTailCall):
+        * jit/JITPropertyAccess.cpp:
+        (JSC::JIT::slow_op_resolve_scopeGenerator):
+        (JSC::JIT::slow_op_get_from_scopeGenerator):
+        * jit/RegisterSet.cpp:
+        (JSC::RegisterSet::macroScratchRegisters):
+        (JSC::RegisterSet::dfgCalleeSaveRegisters):
+        (JSC::RegisterSet::ftlCalleeSaveRegisters):
+        * jit/ThunkGenerators.cpp:
+        (JSC::popThunkStackPreservesAndHandleExceptionGenerator):
+
+2021-12-21  Zan Dobersek  <zdobersek@igalia.com>
+
</ins><span class="cx">         [RISCV64] Add missing MacroAssemblerRISCV64 floating-point rounding, comparison methods
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=234475
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeInlineAccessh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/InlineAccess.h (287310 => 287311)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/InlineAccess.h      2021-12-21 12:42:19 UTC (rev 287310)
+++ trunk/Source/JavaScriptCore/bytecode/InlineAccess.h 2021-12-21 12:54:37 UTC (rev 287311)
</span><span class="lines">@@ -54,6 +54,8 @@
</span><span class="cx">         return 48;
</span><span class="cx"> #elif CPU(MIPS)
</span><span class="cx">         return 72;
</span><ins>+#elif CPU(RISCV64)
+        return 44;
</ins><span class="cx"> #else
</span><span class="cx"> #error "unsupported platform"
</span><span class="cx"> #endif
</span><span class="lines">@@ -72,6 +74,8 @@
</span><span class="cx">         return 48;
</span><span class="cx"> #elif CPU(MIPS)
</span><span class="cx">         return 72;
</span><ins>+#elif CPU(RISCV64)
+        return 52;
</ins><span class="cx"> #else
</span><span class="cx"> #error "unsupported platform"
</span><span class="cx"> #endif
</span><span class="lines">@@ -93,6 +97,8 @@
</span><span class="cx">         size_t size = 30;
</span><span class="cx"> #elif CPU(MIPS)
</span><span class="cx">         size_t size = 56;
</span><ins>+#elif CPU(RISCV64)
+        size_t size = 60;
</ins><span class="cx"> #else
</span><span class="cx"> #error "unsupported platform"
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitAssemblyHelperscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp (287310 => 287311)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp      2021-12-21 12:42:19 UTC (rev 287310)
+++ trunk/Source/JavaScriptCore/jit/AssemblyHelpers.cpp 2021-12-21 12:54:37 UTC (rev 287311)
</span><span class="lines">@@ -392,7 +392,7 @@
</span><span class="cx"> void AssemblyHelpers::emitLoadStructure(VM& vm, RegisterID source, RegisterID dest, RegisterID scratch)
</span><span class="cx"> {
</span><span class="cx"> #if USE(JSVALUE64)
</span><del>-#if CPU(ARM64)
</del><ins>+#if CPU(ARM64) || CPU(RISCV64)
</ins><span class="cx">     RegisterID scratch2 = dataTempRegister;
</span><span class="cx"> #elif CPU(X86_64)
</span><span class="cx">     RegisterID scratch2 = scratchRegister();
</span><span class="lines">@@ -1069,7 +1069,7 @@
</span><span class="cx">         storeDouble(FPRInfo::toRegister(i), Address(GPRInfo::regT0));
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-#if CPU(X86_64) || CPU(ARM_THUMB2) || CPU(ARM64) || CPU(MIPS)
</del><ins>+#if CPU(X86_64) || CPU(ARM_THUMB2) || CPU(ARM64) || CPU(MIPS) || CPU(RISCV64)
</ins><span class="cx">     move(TrustedImmPtr(buffer), GPRInfo::argumentGPR2);
</span><span class="cx">     move(TrustedImmPtr(argument), GPRInfo::argumentGPR1);
</span><span class="cx">     move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitAssemblyHelpersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h (287310 => 287311)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h        2021-12-21 12:42:19 UTC (rev 287310)
+++ trunk/Source/JavaScriptCore/jit/AssemblyHelpers.h   2021-12-21 12:54:37 UTC (rev 287311)
</span><span class="lines">@@ -348,7 +348,7 @@
</span><span class="cx">     void emitSaveThenMaterializeTagRegisters()
</span><span class="cx">     {
</span><span class="cx"> #if USE(JSVALUE64)
</span><del>-#if CPU(ARM64)
</del><ins>+#if CPU(ARM64) || CPU(RISCV64)
</ins><span class="cx">         pushPair(GPRInfo::numberTagRegister, GPRInfo::notCellMaskRegister);
</span><span class="cx"> #else
</span><span class="cx">         push(GPRInfo::numberTagRegister);
</span><span class="lines">@@ -366,7 +366,7 @@
</span><span class="cx">     void emitRestoreSavedTagRegisters()
</span><span class="cx">     {
</span><span class="cx"> #if USE(JSVALUE64)
</span><del>-#if CPU(ARM64)
</del><ins>+#if CPU(ARM64) || CPU(RISCV64)
</ins><span class="cx">         popPair(GPRInfo::numberTagRegister, GPRInfo::notCellMaskRegister);
</span><span class="cx"> #else
</span><span class="cx">         pop(GPRInfo::notCellMaskRegister);
</span><span class="lines">@@ -594,6 +594,46 @@
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if CPU(RISCV64)
+    static constexpr size_t prologueStackPointerDelta()
+    {
+        // Prologue saves the framePointerRegister and returnAddressRegister
+        return 2 * sizeof(void*);
+    }
+
+    void emitFunctionPrologue()
+    {
+        pushPair(framePointerRegister, linkRegister);
+        move(stackPointerRegister, framePointerRegister);
+    }
+
+    void emitFunctionEpilogueWithEmptyFrame()
+    {
+        popPair(framePointerRegister, linkRegister);
+    }
+
+    void emitFunctionEpilogue()
+    {
+        move(framePointerRegister, stackPointerRegister);
+        emitFunctionEpilogueWithEmptyFrame();
+    }
+
+    ALWAYS_INLINE void preserveReturnAddressAfterCall(RegisterID reg)
+    {
+        move(linkRegister, reg);
+    }
+
+    ALWAYS_INLINE void restoreReturnAddressBeforeReturn(RegisterID reg)
+    {
+        move(reg, linkRegister);
+    }
+
+    ALWAYS_INLINE void restoreReturnAddressBeforeReturn(Address address)
+    {
+        loadPtr(address, linkRegister);
+    }
+#endif
+
</ins><span class="cx">     void emitGetFromCallFrameHeaderPtr(VirtualRegister entry, GPRReg to, GPRReg from = GPRInfo::callFrameRegister)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(entry.isHeader());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitCCallHelpersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/CCallHelpers.h (287310 => 287311)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/CCallHelpers.h   2021-12-21 12:42:19 UTC (rev 287310)
+++ trunk/Source/JavaScriptCore/jit/CCallHelpers.h      2021-12-21 12:54:37 UTC (rev 287311)
</span><span class="lines">@@ -801,7 +801,7 @@
</span><span class="cx"> 
</span><span class="cx">         // We don't need the current frame beyond this point. Masquerade as our
</span><span class="cx">         // caller.
</span><del>-#if CPU(ARM_THUMB2) || CPU(ARM64)
</del><ins>+#if CPU(ARM_THUMB2) || CPU(ARM64) || CPU(RISCV64)
</ins><span class="cx">         loadPtr(Address(framePointerRegister, CallFrame::returnPCOffset()), linkRegister);
</span><span class="cx">         subPtr(TrustedImm32(2 * sizeof(void*)), newFrameSizeGPR);
</span><span class="cx"> #if CPU(ARM64E)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitCallFrameShufflercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/CallFrameShuffler.cpp (287310 => 287311)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/CallFrameShuffler.cpp    2021-12-21 12:42:19 UTC (rev 287310)
+++ trunk/Source/JavaScriptCore/jit/CallFrameShuffler.cpp       2021-12-21 12:54:37 UTC (rev 287311)
</span><span class="lines">@@ -387,7 +387,7 @@
</span><span class="cx">     // sp will point to head1 since the callee's prologue pushes
</span><span class="cx">     // the call frame and link register.
</span><span class="cx">     m_newFrameOffset = -1;
</span><del>-#elif CPU(ARM64)
</del><ins>+#elif CPU(ARM64) || CPU(RISCV64)
</ins><span class="cx">     // We load the frame pointer and link register manually. We
</span><span class="cx">     // could ask the algorithm to load the link register for us
</span><span class="cx">     // (which would allow for its use as an extra temporary), but
</span><span class="lines">@@ -438,7 +438,7 @@
</span><span class="cx">         m_newFrameBase);
</span><span class="cx"> 
</span><span class="cx">     // We load the link register manually for architectures that have one
</span><del>-#if CPU(ARM_THUMB2) || CPU(ARM64)
</del><ins>+#if CPU(ARM_THUMB2) || CPU(ARM64) || CPU(RISCV64)
</ins><span class="cx">     m_jit.loadPtr(MacroAssembler::Address(MacroAssembler::framePointerRegister, CallFrame::returnPCOffset()),
</span><span class="cx">         MacroAssembler::linkRegister);
</span><span class="cx"> #if CPU(ARM64E)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITPropertyAccesscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp (287310 => 287311)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp    2021-12-21 12:42:19 UTC (rev 287310)
+++ trunk/Source/JavaScriptCore/jit/JITPropertyAccess.cpp       2021-12-21 12:54:37 UTC (rev 287311)
</span><span class="lines">@@ -2139,7 +2139,7 @@
</span><span class="cx">     // The fast path already pushed the return address.
</span><span class="cx"> #if CPU(X86_64)
</span><span class="cx">     jit.push(X86Registers::ebp);
</span><del>-#elif CPU(ARM64) || CPU(ARM_THUMB2)
</del><ins>+#elif CPU(ARM64) || CPU(ARM_THUMB2) || CPU(RISCV64)
</ins><span class="cx">     jit.pushPair(framePointerRegister, linkRegister);
</span><span class="cx"> #elif CPU(MIPS)
</span><span class="cx">     jit.pushPair(framePointerRegister, returnAddressRegister);
</span><span class="lines">@@ -2167,7 +2167,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if CPU(X86_64)
</span><span class="cx">     jit.pop(X86Registers::ebp);
</span><del>-#elif CPU(ARM64) || CPU(ARM_THUMB2)
</del><ins>+#elif CPU(ARM64) || CPU(ARM_THUMB2) || CPU(RISCV64)
</ins><span class="cx">     jit.popPair(framePointerRegister, linkRegister);
</span><span class="cx"> #elif CPU(MIPS)
</span><span class="cx">     jit.popPair(framePointerRegister, returnAddressRegister);
</span><span class="lines">@@ -2373,7 +2373,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if CPU(X86_64)
</span><span class="cx">     jit.push(X86Registers::ebp);
</span><del>-#elif CPU(ARM64) || CPU(ARM_THUMB2)
</del><ins>+#elif CPU(ARM64) || CPU(ARM_THUMB2) || CPU(RISCV64)
</ins><span class="cx">     jit.pushPair(framePointerRegister, linkRegister);
</span><span class="cx"> #elif CPU(MIPS)
</span><span class="cx">     jit.pushPair(framePointerRegister, returnAddressRegister);
</span><span class="lines">@@ -2422,7 +2422,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if CPU(X86_64)
</span><span class="cx">     jit.pop(X86Registers::ebp);
</span><del>-#elif CPU(ARM64) || CPU(ARM_THUMB2)
</del><ins>+#elif CPU(ARM64) || CPU(ARM_THUMB2) || CPU(RISCV64)
</ins><span class="cx">     jit.popPair(framePointerRegister, linkRegister);
</span><span class="cx"> #elif CPU(MIPS)
</span><span class="cx">     jit.popPair(framePointerRegister, returnAddressRegister);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitRegisterSetcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/RegisterSet.cpp (287310 => 287311)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/RegisterSet.cpp  2021-12-21 12:42:19 UTC (rev 287310)
+++ trunk/Source/JavaScriptCore/jit/RegisterSet.cpp     2021-12-21 12:54:37 UTC (rev 287311)
</span><span class="lines">@@ -92,7 +92,7 @@
</span><span class="cx"> {
</span><span class="cx"> #if CPU(X86_64)
</span><span class="cx">     return RegisterSet(MacroAssembler::s_scratchRegister);
</span><del>-#elif CPU(ARM64)
</del><ins>+#elif CPU(ARM64) || CPU(RISCV64)
</ins><span class="cx">     return RegisterSet(MacroAssembler::dataTempRegister, MacroAssembler::memoryTempRegister);
</span><span class="cx"> #elif CPU(MIPS)
</span><span class="cx">     RegisterSet result;
</span><span class="lines">@@ -253,7 +253,7 @@
</span><span class="cx"> #elif CPU(ARM_THUMB2) || CPU(MIPS)
</span><span class="cx">     result.set(GPRInfo::regCS0);
</span><span class="cx">     result.set(GPRInfo::regCS1);
</span><del>-#elif CPU(ARM64)
</del><ins>+#elif CPU(ARM64) || CPU(RISCV64)
</ins><span class="cx">     static_assert(GPRInfo::regCS8 == GPRInfo::numberTagRegister, "");
</span><span class="cx">     static_assert(GPRInfo::regCS9 == GPRInfo::notCellMaskRegister, "");
</span><span class="cx">     result.set(GPRInfo::regCS8);
</span><span class="lines">@@ -298,6 +298,32 @@
</span><span class="cx">     result.set(FPRInfo::fpRegCS5);
</span><span class="cx">     result.set(FPRInfo::fpRegCS6);
</span><span class="cx">     result.set(FPRInfo::fpRegCS7);
</span><ins>+#elif CPU(RISCV64)
+    result.set(GPRInfo::regCS0);
+    result.set(GPRInfo::regCS1);
+    result.set(GPRInfo::regCS2);
+    result.set(GPRInfo::regCS3);
+    result.set(GPRInfo::regCS4);
+    result.set(GPRInfo::regCS5);
+    result.set(GPRInfo::regCS6);
+    result.set(GPRInfo::regCS7);
+    static_assert(GPRInfo::regCS8 == GPRInfo::numberTagRegister, "");
+    static_assert(GPRInfo::regCS9 == GPRInfo::notCellMaskRegister, "");
+    result.set(GPRInfo::regCS8);
+    result.set(GPRInfo::regCS9);
+    result.set(GPRInfo::regCS10);
+    result.set(FPRInfo::fpRegCS0);
+    result.set(FPRInfo::fpRegCS1);
+    result.set(FPRInfo::fpRegCS2);
+    result.set(FPRInfo::fpRegCS3);
+    result.set(FPRInfo::fpRegCS4);
+    result.set(FPRInfo::fpRegCS5);
+    result.set(FPRInfo::fpRegCS6);
+    result.set(FPRInfo::fpRegCS7);
+    result.set(FPRInfo::fpRegCS8);
+    result.set(FPRInfo::fpRegCS9);
+    result.set(FPRInfo::fpRegCS10);
+    result.set(FPRInfo::fpRegCS11);
</ins><span class="cx"> #else
</span><span class="cx">     UNREACHABLE_FOR_PLATFORM();
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitThunkGeneratorscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp (287310 => 287311)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp      2021-12-21 12:42:19 UTC (rev 287310)
+++ trunk/Source/JavaScriptCore/jit/ThunkGenerators.cpp 2021-12-21 12:54:37 UTC (rev 287311)
</span><span class="lines">@@ -85,7 +85,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if CPU(X86_64)
</span><span class="cx">     jit.addPtr(CCallHelpers::TrustedImm32(2 * sizeof(CPURegister)), X86Registers::esp);
</span><del>-#elif CPU(ARM64) || CPU(ARM_THUMB2)
</del><ins>+#elif CPU(ARM64) || CPU(ARM_THUMB2) || CPU(RISCV64)
</ins><span class="cx">     jit.popPair(CCallHelpers::framePointerRegister, CCallHelpers::linkRegister);
</span><span class="cx"> #elif CPU(MIPS)
</span><span class="cx">     jit.popPair(CCallHelpers::framePointerRegister, CCallHelpers::returnAddressRegister);
</span></span></pre>
</div>
</div>

</body>
</html>