<?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>149713</bug_id>
          
          <creation_ts>2015-10-01 09:51:49 -0700</creation_ts>
          <short_desc>DFG peephole does not have effect on CompareEq / CompareStrictEq because of MovHint</short_desc>
          <delta_ts>2018-03-22 05:02:23 -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>DUPLICATE</resolution>
          <dup_id>177100</dup_id>
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=149616</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Yusuke Suzuki">ysuzuki</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>fpizlo</cc>
    
    <cc>ggaren</cc>
    
    <cc>keith_miller</cc>
    
    <cc>mark.lam</cc>
    
    <cc>msaboff</cc>
    
    <cc>saam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1129952</commentid>
    <comment_count>0</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2015-10-01 09:51:49 -0700</bug_when>
    <thetext>Currently, we have op_jless, op_jgreater etc. But we don&apos;t have op_jeq.
Instead we compile the following

function eq(a, b)
{
    if (a === b)
        return true;
    return false;
}

to

eq#CU1c7h:[0x7fb57e6dd268-&gt;0x7fb57e46c200, NoneFunctionCall, 17]: 17 m_instructions; 136 bytes; 3 parameter(s); 8 callee register(s); 6 variable(s)
[   0] enter             
[   1] get_scope         loc3
[   3] mov               loc4, loc3
[   6] eq                loc6, arg1, arg2
[  10] jfalse            loc6, 5(-&gt;15)
[  13] ret               True(const1)
[  15] ret               False(const2)

So, in DFG, between op_eq and op_jfalse, we have MovHint to store the result of op_eq.
As a result, detectPeepHoleBranch() never detects peep hole for that case.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1129962</commentid>
    <comment_count>1</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2015-10-01 10:06:57 -0700</bug_when>
    <thetext>When and if we implement a fix that allows the peephole detection to &quot;skip&quot; the MovHint, we should check how much of a speed-up it is.

If it is not a speed-up, then instead of writing a patch that extends the peephole to skip MovHint, we should write a patch that removes all code for those peepholes that are currently dead because of the MovHint.  That peephole code is a pain to maintain and it&apos;s possible that it buys us nothing.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1129967</commentid>
    <comment_count>2</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2015-10-01 10:23:49 -0700</bug_when>
    <thetext>(In reply to comment #1)
&gt; When and if we implement a fix that allows the peephole detection to &quot;skip&quot;
&gt; the MovHint, we should check how much of a speed-up it is.
&gt; 
&gt; If it is not a speed-up, then instead of writing a patch that extends the
&gt; peephole to skip MovHint, we should write a patch that removes all code for
&gt; those peepholes that are currently dead because of the MovHint.  That
&gt; peephole code is a pain to maintain and it&apos;s possible that it buys us
&gt; nothing.

Right. This peep hole optimization is easily broken because the assumption the optimization rely on is fragile.
If it does not provide significant performance improvement, dropping these code is better.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1130012</commentid>
    <comment_count>3</comment_count>
    <who name="Saam Barati">saam</who>
    <bug_when>2015-10-01 12:58:35 -0700</bug_when>
    <thetext>Yeah, I remember running into not being able
to get peephole optimization to kick in because
of MovHints (that&apos;s why I asked you to upload
a test for that, because I thought you found
a way for it to kick in).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1408328</commentid>
    <comment_count>4</comment_count>
    <who name="Yusuke Suzuki">ysuzuki</who>
    <bug_when>2018-03-22 05:02:23 -0700</bug_when>
    <thetext>

*** This bug has been marked as a duplicate of bug 177100 ***</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>