<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>167460</bug_id>
          
          <creation_ts>2017-01-26 12:04:56 -0800</creation_ts>
          <short_desc>Why doesn&apos;t mandelbrot.js FTL?</short_desc>
          <delta_ts>2018-07-11 01:36:53 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>JavaScriptCore</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>167149</dependson>
    
    <dependson>172216</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter name="JF Bastien">jfbastien</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>jfbastien</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
    
    <cc>ysuzuki</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1270278</commentid>
    <comment_count>0</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-01-26 12:04:56 -0800</bug_when>
    <thetext>I added a mandelbrot test in #167149 because I wanted something with nested loops and not just int32.

This happens:

$ ./current-release/bin/jsc ./JSTests/microbenchmarks/mandelbrot.js --useConcurrentJIT=0 -p a &amp;&amp; ./Tools/Scripts/display-profiler-output a
    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
mandelbrot#DoqaAb  579          50989/4078434/0/0             50989/4078434/0/0          4       0/0      15       4/0/4     function mandelbrot(x, y, w, h, scene_i, scene_z, X, Y, iterations) { const max_z = 2.0; for (let i = 
  shade#Eqog0q     118             67/6301/0/0                   67/1911/0/0             2       2/2       0       1/0/1     function i =&gt; shades[Math.round((i * (shades.length - 1)) / max_s)]
 &lt;global&gt;#DMGh43   779            2543/3507/0/0                 2543/3507/0/0            2       0/0       1       3/0/3     const max_s = 255; const hysterisis = 3; function mandelbrot(x, y, w, h, scene_i, scene_z, X, Y, itera
printable#EmK4D0   135            1524/4390/0/0                 1524/4390/0/0            2       1/1       0       1/0/2     function printable(scene_i, scene_z, X, Y) { let s = &quot;&quot;; for (let i = 0; i &lt; X; ++i) { for (let j = 0;
    of#A2awz5      114               0/0/0/0                       0/0/0/0               0       0/0       0        N/A      function () { &quot;use strict&quot;; var length = arguments.length; var array = @isConstructor(this) ? new this
   fill#AXPfsF     231               0/0/0/0                       0/0/0/0               0       0/0       0        N/A      function (value ) { &quot;use strict&quot;; if (this == null) @throwTypeError(&quot;Array.prototype.fill requires tha
 toLength#ESso8n    59               0/0/0/0                       0/0/0/0               0       0/0       0        N/A      function (target) { &quot;use strict&quot;; var length = @toInteger(target); return length &gt; 0 ? (length &lt; @MAX_
toInteger#BxMpe8    74               0/0/0/0                       0/0/0/0               0       0/0       0        N/A      function (target) { &quot;use strict&quot;; var numberValue = @Number(target); if (numberValue !== numberValue) 
&gt; l mandelbrot
Compilation mandelbrot#DoqaAb-1-Baseline:
    Total count: 3155511  Max count: 50989
Compilation mandelbrot#DoqaAb-2-DFG:
    Total count: 530545  Max count: 5413
    EXIT: at bc#228 due to InadequateCoverage, 5 times
    Jettisoned due to BaselineLoopReoptimizationTrigger
Compilation mandelbrot#DoqaAb-3-DFG:
    Total count: 1146246  Max count: 22805
    EXIT: at bc#311 due to Overflow, 10 times
    Jettisoned due to BaselineLoopReoptimizationTrigger
Compilation mandelbrot#DoqaAb-4-DFG:
    Total count: 118896069  Max count: 4050216



That&apos;s not cool. Mandelbrot only has Number and some int32 coercion. Exit due to overflow isn&apos;t a good reason to not FTL here.

I&apos;ll investigate this at some point in time. It&apos;s not a rush, but good to fix.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1270284</commentid>
    <comment_count>1</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2017-01-26 12:18:33 -0800</bug_when>
    <thetext>--verboseFTLFailure=true</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1270293</commentid>
    <comment_count>2</comment_count>
    <who name="JF Bastien">jfbastien</who>
    <bug_when>2017-01-26 12:48:29 -0800</bug_when>
    <thetext>(In reply to comment #1)
&gt; --verboseFTLFailure=true

Ah nice.

FTL rejecting node in mandelbrot#DoqaAb:[0x111984dc0-&gt;0x111984b90-&gt;0x111994c80, NoneFunctionCall, 579]:
     349:&lt;!0:-&gt;	GetByVal(KnownCell:@342, Int32:@317, Untyped:@698, JS|MustGen|UseAsInt, Boolint32Other, ArrayStorage+OriginalArray+OutOfBounds+AsIs, R:World, W:Heap, Exits, ClobbersExit, bc#322)  predicting Boolint32Other
FTL rejecting node in printable#EmK4D0:[0x111985ae0-&gt;0x111985450-&gt;0x111994d20, NoneFunctionCall, 135]:
      94:&lt;!0:-&gt;	GetByVal(KnownCell:@93, Int32:@74, Untyped:@313, JS|MustGen, Boolint32, ArrayStorage+OriginalArray+InBounds+AsIs, R:Butterfly_vectorLength,IndexedArrayStorageProperties, Exits, bc#65)  predicting Boolint32
FTL rejecting &lt;global&gt;#DMGh43:[0x111985d10-&gt;0x1119840a0-&gt;0x111994be0, NoneGlobal, 779] because it doesn&apos;t belong to a function.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1311242</commentid>
    <comment_count>3</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-05-22 00:06:24 -0700</bug_when>
    <thetext>(In reply to JF Bastien from comment #2)
&gt; (In reply to comment #1)
&gt; &gt; --verboseFTLFailure=true
&gt; 
&gt; Ah nice.
&gt; 
&gt; FTL rejecting node in
&gt; mandelbrot#DoqaAb:[0x111984dc0-&gt;0x111984b90-&gt;0x111994c80, NoneFunctionCall,
&gt; 579]:
&gt;      349:&lt;!0:-&gt;	GetByVal(KnownCell:@342, Int32:@317, Untyped:@698,
&gt; JS|MustGen|UseAsInt, Boolint32Other,
&gt; ArrayStorage+OriginalArray+OutOfBounds+AsIs, R:World, W:Heap, Exits,
&gt; ClobbersExit, bc#322)  predicting Boolint32Other
&gt; FTL rejecting node in
&gt; printable#EmK4D0:[0x111985ae0-&gt;0x111985450-&gt;0x111994d20, NoneFunctionCall,
&gt; 135]:
&gt;       94:&lt;!0:-&gt;	GetByVal(KnownCell:@93, Int32:@74, Untyped:@313, JS|MustGen,
&gt; Boolint32, ArrayStorage+OriginalArray+InBounds+AsIs,
&gt; R:Butterfly_vectorLength,IndexedArrayStorageProperties, Exits, bc#65) 
&gt; predicting Boolint32
&gt; FTL rejecting &lt;global&gt;#DMGh43:[0x111985d10-&gt;0x1119840a0-&gt;0x111994be0,
&gt; NoneGlobal, 779] because it doesn&apos;t belong to a function.

https://bugs.webkit.org/show_bug.cgi?id=172216</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1311244</commentid>
    <comment_count>4</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2017-05-22 00:07:15 -0700</bug_when>
    <thetext>PutByVal support is also necessary.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1441134</commentid>
    <comment_count>5</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2018-07-11 01:36:53 -0700</bug_when>
    <thetext>We support it now :)</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>