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

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

<span class="quote">&gt; Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:3563
&gt; +    GPRReg scratchGPR[Generator::scratchGPRRegCount];
&gt; +    FPRReg scratchFPR[Generator::scratchFPRRegCount];</span >

I'm more of a fan of using Vector&lt;&gt; with an inline capacity for this API. You'll still get the same property where you don't end up mallocing any memory.

<span class="quote">&gt; Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:3600
&gt; +    for (size_t i = 0; i &lt; std::min&lt;unsigned&gt;(availableGPRs, scratchGPRRegCount); i++) {</span >

It seems wrong if the min() expression ever returns availableGPRs instead of scratchGPRRegCount. I would just turn this into an assert that we have enough registers.

<span class="quote">&gt; Source/JavaScriptCore/jit/JITMulGenerator.h:45
&gt; +        FPRReg leftFPR, FPRReg rightFPR, GPRReg *scratchGPRs, FPRReg *scratchFPRs)</span >

See my comment about using Vector here instead. You could even templatize it over Vector type to not have to worry about what the inline capacity of it is.</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>