<?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>142234</bug_id>
          
          <creation_ts>2015-03-03 14:20:00 -0800</creation_ts>
          <short_desc>JIT debugging features that selectively disable the JITs for code blocks need to stay out of the way of the critical path of JIT management</short_desc>
          <delta_ts>2015-03-03 14:36:26 -0800</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>528+ (Nightly build)</version>
          <rep_platform>All</rep_platform>
          <op_sys>All</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>
          
          <blocked>142229</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Filip Pizlo">fpizlo</reporter>
          <assigned_to name="Filip Pizlo">fpizlo</assigned_to>
          <cc>benjamin</cc>
    
    <cc>mark.lam</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>1073796</commentid>
    <comment_count>0</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2015-03-03 14:20:00 -0800</bug_when>
    <thetext>Long ago, we used to selectively disable compilation of CodeBlocks for debugging purposes by adding hacks to DFGDriver.cpp.  This was all well and good.  It used the existing CompilationFailed mode of the DFG driver to signal failure of CodeBlocks that we didn&apos;t want to compile.  That&apos;s great because CompilationFailed is a well-supported return value on the critical path, usually used for when we run out of JIT memory.

Later, this was moved into DFGCapabilities. This was basically incorrect. It introduced a bug where disabling compiling of a CodeBlock meant that we stopped inlining it as well.  So if you had a compiler bug that arose if foo was inlined into bar, and you bisected down to bar, then foo would no longer get inlined and you wouldn&apos;t see the bug.  That&apos;s busted.

So then we changed the code in DFGCapabilities to mark bar as CanCompile and foo as CanInline. Now, foo wouldn&apos;t get compiled alone but it would get inlined.

But then we removed CanCompile because that capability mode only existed for the purpose of our old varargs hacks.  After that removal, &quot;CanInline&quot; became CannotCompile.  This means that if you bisect down on bar in the &quot;foo inlined into bar&quot; case, you&apos;ll crash in the DFG because the baseline JIT wouldn&apos;t have known to insert profiling on foo.

We could fix this by bringing back CanInline.

But this is all a pile of nonsense.  The debug support to selectively disable compilation of some CodeBlocks shouldn&apos;t cross-cut our entire engine and should most certainly never involve adding new capability modes.  This support is a hack at best and is for use by JSC hackers only.  It should be as unintrusive as possible.

So, as in the ancient times, the only proper place to put this hack is in DFGDriver.cpp, and return CompilationFailed.  This is correct not just because it takes capability modes out of the picture (and obviates the need to introduce new ones), but also because it means that disabling compilation doesn&apos;t change the profiling mode of other CodeBlocks in the Baseline JIT.  Capability mode influences profiling mode which in turn influences code generation in the Baseline JIT, sometimes in very significant ways - like, we sometimes do additional double-to-int conversions in Baseline if we know that we might tier-up into the DFG, since this buys us more precise profiling.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1073799</commentid>
    <comment_count>1</comment_count>
      <attachid>247794</attachid>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2015-03-03 14:23:17 -0800</bug_when>
    <thetext>Created attachment 247794
the patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1073802</commentid>
    <comment_count>2</comment_count>
      <attachid>247794</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2015-03-03 14:26:17 -0800</bug_when>
    <thetext>Comment on attachment 247794
the patch

View in context: https://bugs.webkit.org/attachment.cgi?id=247794&amp;action=review

r=me

&gt; Source/JavaScriptCore/ChangeLog:12
&gt; +        at timelike infinity. That makes these hacks much more likely to continue working as we make

&quot;timelike&quot;?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1073803</commentid>
    <comment_count>3</comment_count>
      <attachid>247794</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2015-03-03 14:27:14 -0800</bug_when>
    <thetext>Comment on attachment 247794
the patch

What happened to MacroAssembler::supportsFloatingPoint()?  You didn&apos;t include that in the new check.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1073804</commentid>
    <comment_count>4</comment_count>
    <who name="Benjamin Poulain">benjamin</who>
    <bug_when>2015-03-03 14:28:52 -0800</bug_when>
    <thetext>View in context: https://bugs.webkit.org/attachment.cgi?id=247794&amp;action=review

r=me too

&gt; Source/JavaScriptCore/ChangeLog:8
&gt; +        See bug description for complete analysis. This reduces the intrusiveness of debugging hacks

You should copy the description here. We assume that the ChangeLogs will survive bugzilla.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1073805</commentid>
    <comment_count>5</comment_count>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2015-03-03 14:29:28 -0800</bug_when>
    <thetext>(In reply to comment #3)
&gt; Comment on attachment 247794 [details]
&gt; the patch
&gt; 
&gt; What happened to MacroAssembler::supportsFloatingPoint()?  You didn&apos;t
&gt; include that in the new check.

My bad.  This didn&apos;t need to be moved.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1073806</commentid>
    <comment_count>6</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2015-03-03 14:30:35 -0800</bug_when>
    <thetext>(In reply to comment #2)
&gt; Comment on attachment 247794 [details]
&gt; the patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=247794&amp;action=review
&gt; 
&gt; r=me
&gt; 
&gt; &gt; Source/JavaScriptCore/ChangeLog:12
&gt; &gt; +        at timelike infinity. That makes these hacks much more likely to continue working as we make
&gt; 
&gt; &quot;timelike&quot;?

It&apos;s a term of art, see for example http://en.wikipedia.org/wiki/Closed_timelike_curve</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1073807</commentid>
    <comment_count>7</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2015-03-03 14:30:50 -0800</bug_when>
    <thetext>(In reply to comment #4)
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=247794&amp;action=review
&gt; 
&gt; r=me too
&gt; 
&gt; &gt; Source/JavaScriptCore/ChangeLog:8
&gt; &gt; +        See bug description for complete analysis. This reduces the intrusiveness of debugging hacks
&gt; 
&gt; You should copy the description here. We assume that the ChangeLogs will
&gt; survive bugzilla.

OK.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1073810</commentid>
    <comment_count>8</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2015-03-03 14:36:26 -0800</bug_when>
    <thetext>Landed in http://trac.webkit.org/changeset/180956</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>247794</attachid>
            <date>2015-03-03 14:23:17 -0800</date>
            <delta_ts>2015-03-03 14:26:17 -0800</delta_ts>
            <desc>the patch</desc>
            <filename>blah.patch</filename>
            <type>text/plain</type>
            <size>4899</size>
            <attacher name="Filip Pizlo">fpizlo</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMTgwOTU1KQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDMwIEBA
CisyMDE1LTAzLTAzICBGaWxpcCBQaXpsbyAgPGZwaXpsb0BhcHBsZS5jb20+CisKKyAgICAgICAg
SklUIGRlYnVnZ2luZyBmZWF0dXJlcyB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MCw3IEBACiAjaW5jbHVkZSAiSlNTdHJpbmcuaCIKIAogI2luY2x1ZGUg
IkNvZGVCbG9jay5oIgorI2luY2x1ZGUgIkRGR0Z1bmN0aW9uV2hpdGVsaXN0LmgiCiAjaW5jbHVk
ZSAiREZHSklUQ29kZS5oIgogI2luY2x1ZGUgIkRGR1BsYW4uaCIKICNpbmNsdWRlICJERkdUaHVu
a3MuaCIKQEAgLTYyLDYgKzYzLDEwIEBAIHN0YXRpYyBDb21waWxhdGlvblJlc3VsdCBjb21waWxl
SW1wbCgKIHsKICAgICBTYW1wbGluZ1JlZ2lvbiBzYW1wbGluZ1JlZ2lvbigiREZHIENvbXBpbGF0
aW9uIChEcml2ZXIpIik7CiAgICAgCisgICAgaWYgKCFPcHRpb25zOjpieXRlY29kZVJhbmdlVG9E
RkdDb21waWxlKCkuaXNJblJhbmdlKGNvZGVCbG9jay0+aW5zdHJ1Y3Rpb25Db3VudCgpKQorICAg
ICAgICB8fCAhRnVuY3Rpb25XaGl0ZWxpc3Q6OmVuc3VyZUdsb2JhbFdoaXRlbGlzdCgpLmNvbnRh
aW5zKGNvZGVCbG9jaykpCisgICAgICAgIHJldHVybiBDb21waWxhdGlvbkZhaWxlZDsKKyAgICAK
ICAgICBudW1Db21waWxhdGlvbnMrKzsKICAgICAKICAgICBBU1NFUlQoY29kZUJsb2NrKTsK
</data>
<flag name="review"
          id="272706"
          type_id="1"
          status="+"
          setter="mark.lam"
    />
          </attachment>
      

    </bug>

</bugzilla>