<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Math.pow with Object arguments get deoptimized"
   href="https://bugs.webkit.org/show_bug.cgi?id=157938">157938</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>Math.pow with Object arguments get deoptimized
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>JavaScriptCore
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>joepeck&#64;webkit.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>benjamin&#64;webkit.org, fpizlo&#64;apple.com, ggaren&#64;apple.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>* SUMMARY
Math.pow with Object arguments get deoptimized.

It seems the DFG doesn't reason about converting Object -&gt; numbers via valueOf() here.

* TEST
var sum = 0;
for (var i = 0; i &lt; 1e5; ++i) {
    sum += Math.pow(2, {valueOf() { return 3 }});
}

* NOTES
$ jsc test.js -p profile.json
$ display-profiler-output profile.json 
   CodeBlock    #Instr      Source Counts         Machine Counts    #Compil  Inlines  #Exits   Last Opts                         Source                      
                         Base/DFG/FTL/FTLOSR   Base/DFG/FTL/FTLOSR          Src/Total         Get/Put/Call
valueOf#BI9kVc    8       462/10073/89433/0     462/10073/89433/0      3       0/0       0       0/0/0     function () { return 3 }
&lt;global&gt;#D7oSjt  267        99506/20/0/0           99506/20/0/0        4       0/0      20       1/5/1     var sum = 0; for (var i = 0; i &lt; 1e5; ++i) { sum +

<span class="quote">&gt; log &lt;global&gt;#D7oSjt</span >
Compilation &lt;global&gt;#D7oSjt-1-Baseline:
    Total count: 3283261  Max count: 99506
Compilation &lt;global&gt;#D7oSjt-2-DFG:
    Total count: 120  Max count: 5
    EXIT: at bc#186 due to Uncountable, 5 times
    Jettisoned due to BaselineLoopReoptimizationTrigger
Compilation &lt;global&gt;#D7oSjt-3-DFG:
    Total count: 240  Max count: 10
    EXIT: at bc#186 due to Uncountable, 10 times
    Jettisoned due to BaselineLoopReoptimizationTrigger
Compilation &lt;global&gt;#D7oSjt-4-DFG:
    Total count: 120  Max count: 5
    EXIT: at bc#186 due to Uncountable, 5 times

<span class="quote">&gt; d &lt;global&gt;#D7oSjt-2-DFG</span >
...
      5                     99486/20/0/0                     94:&lt; 5:loc12&gt;    NewObject(JS|UseAsOther, Final, %DY:Object, R:HeapObjectCount, W:HeapObjectCount, Exits, bc#99)
...
      5                     99486/20/0/0                    238:&lt;!0:-&gt;    InvalidationPoint(MustGen, W:SideState, Exits, bc#177, exit: bc#186)
      5                     99506/20/0/0                    233:&lt; 1:loc14&gt;    DoubleConstant(Double|PureInt, Bytecodedouble, Double: 4611686018427387904, 2.000000, bc#186)
      5                     99506/20/0/0                    157:&lt; 2:loc12&gt;    ArithPow(DoubleRep:&#64;233&lt;Double&gt;, Check:Int32:&#64;94, Double|UseAsOther, Bytecodedouble, Exits, bc#186)
      5                     99506/20/0/0                         0x510434202461: mov $0x4000000000000000, %rax
      5                     99506/20/0/0                         0x51043420246b: movq %rax, %xmm0
      5                     99506/20/0/0                         0x510434202470: jmp 0x510434202725
    !!!!!                      !!!!!                                           EXIT: due to Uncountable, 5 times</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>