<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#c43">Comment # 43</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=297820&amp;action=diff" name="attach_297820" title="Patch">attachment 297820</a> <a href="attachment.cgi?id=297820&amp;action=edit" title="Patch">[details]</a></span>
Patch

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

<span class="quote">&gt; Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:3572
&gt; +        } else 
&gt; +            scratchGPR[i] = InvalidGPRReg;</span >

Is this side of the branch ever taken? It seems like we should almost assert against it, and if a generator knows how to handle using the tags, it should just *always* do that and report that it needs fewer registers.

<span class="quote">&gt; Source/JavaScriptCore/jit/JITAddGenerator.h:52
&gt; +        FPRReg leftFPR, FPRReg rightFPR, Vector&lt;GPRReg, scratchGPRRegCount&gt; scratchGPRs, Vector&lt;FPRReg, scratchFPRRegCount&gt; scratchFPRs)</span >

You shouldn't be copying these vectors for these constructors. I'd use &quot;const Vector&lt;...&gt;&amp;&quot; as the type here.

<span class="quote">&gt; Source/JavaScriptCore/jit/JITArithmetic.cpp:777
&gt; +        else
&gt; +            scratchGPR[i] = InvalidGPRReg;</span >

Ditto as the DFG code that does this.

<span class="quote">&gt; Source/JavaScriptCore/jit/JITMulGenerator.cpp:41
&gt; +    // Maybe it was not possible allocate scratchGPR. In this case, we use result.tagGPR
&gt; +    if (m_scratchGPR == InvalidGPRReg)
&gt; +        m_scratchGPR = m_result.tagGPR();</span >

Ditto, we should just always use tag if we're 32-bit and we know we need a scratch and that the code is valid when using the tag as a scratch.

<span class="quote">&gt; Source/JavaScriptCore/jit/JITMulGenerator.h:52
&gt; +        FPRReg leftFPR, FPRReg rightFPR, Vector&lt;GPRReg, scratchGPRRegCount&gt; scratchGPRs, Vector&lt;FPRReg, scratchFPRRegCount&gt; scratchFPRs)</span >

Ditto about copying the vectors.

<span class="quote">&gt; Source/JavaScriptCore/jit/JITSubGenerator.h:51
&gt; +        FPRReg leftFPR, FPRReg rightFPR, Vector&lt;GPRReg, scratchGPRRegCount&gt; scratchGPRs, Vector&lt;FPRReg, scratchFPRRegCount&gt; scratchFPRs)</span >

Ditto about copying the vectors.</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>