<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Refactor MathIC compilation process in Baseline and DFG to turn temporary registers usage more flexible"
   href="https://bugs.webkit.org/show_bug.cgi?id=160588#c22">Comment # 22</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Refactor MathIC compilation process in Baseline and DFG to turn temporary registers usage more flexible"
   href="https://bugs.webkit.org/show_bug.cgi?id=160588">bug 160588</a>
              from <span class="vcard"><a class="email" href="mailto:sbarati&#64;apple.com" title="Saam Barati &lt;sbarati&#64;apple.com&gt;"> <span class="fn">Saam Barati</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=289796&amp;action=diff" name="attach_289796" title="Patch">attachment 289796</a> <a href="attachment.cgi?id=289796&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=289796&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=289796&amp;action=review</a>

<span class="quote">&gt; Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:3434
&gt; +    ASSERT(scratchFPRRegCount &lt;= MATH_IC_MAX_GPR);
&gt; +    ASSERT(scratchFPRRegCount &lt;= MATH_IC_MAX_FPR);</span >

Please make this a static_assert

<span class="quote">&gt; Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:3512
&gt; +    // Since registers on 32-bit architectures like x86_32 are scarce
&gt; +    // we need to check if it is possible allocate new registers</span >

It seems like all 32-bit snippets are able to use tags as their scratch, can we just remove this code?

<span class="quote">&gt; Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp:1569
&gt; +        ASSERT(numGPScratchRegisters &lt;= MATH_IC_MAX_GPR);
&gt; +        ASSERT(numFPScratchRegisters &lt;= MATH_IC_MAX_FPR);</span >

Please make this a static_assert

<span class="quote">&gt; Source/JavaScriptCore/jit/JITMathIC.h:56
&gt; +#define MATH_IC_MAX_GPR 1
&gt; +#define MATH_IC_MAX_FPR 1</span >

I would make these static fields inside JITMathIC instead of a define.

<span class="quote">&gt; Source/JavaScriptCore/jit/JITMulGenerator.cpp:41
&gt; +    if (m_scratchGPR == InvalidGPRReg)
&gt; +        m_scratchGPR = m_result.tagGPR();</span >

Have you made sure it's always valid to do this?</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are the assignee for the bug.</li>
      </ul>
    </body>
</html>