<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#c23">Comment # 23</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:ticaiolima&#64;gmail.com" title="Caio Lima &lt;ticaiolima&#64;gmail.com&gt;"> <span class="fn">Caio Lima</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;&gt; Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:3434
&gt;&gt; +    ASSERT(scratchFPRRegCount &lt;= MATH_IC_MAX_FPR);
&gt; 
&gt; Please make this a static_assert</span >

Ok

<span class="quote">&gt;&gt; Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp:3512
&gt;&gt; +    // we need to check if it is possible allocate new registers
&gt; 
&gt; It seems like all 32-bit snippets are able to use tags as their scratch, can we just remove this code?</span >

My intention is to enable allocate scratches and avoid use tagGPRs to avoid instructions to restore the tags. Current Snnipets uses just one scratch that is mapped to result .tagGPR , but others like JITPowGenerator can use more. If scratches are already allocated, we don't need to use x/y.tagGPR and consequently, we don't need to restore their tags on snnipets.

<span class="quote">&gt;&gt; Source/JavaScriptCore/jit/JITMathIC.h:56
&gt;&gt; +#define MATH_IC_MAX_FPR 1
&gt; 
&gt; I would make these static fields inside JITMathIC instead of a define.</span >

Good. I am going to do that.

<span class="quote">&gt;&gt; Source/JavaScriptCore/jit/JITMulGenerator.cpp:41
&gt;&gt; +        m_scratchGPR = m_result.tagGPR();
&gt; 
&gt; Have you made sure it's always valid to do this?</span >

The current code always  use result.tagGPR as scratch on 32bits. So I suppose that it is valid. Also, AFIK all results assign are boxed, so the tag is going to be restored properly. I can double check that.</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>