<?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>171888</bug_id>
          
          <creation_ts>2017-05-09 15:17:04 -0700</creation_ts>
          <short_desc>Heap::heap() should behave gracefully for null pointers</short_desc>
          <delta_ts>2017-05-09 15:27:21 -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>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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Filip Pizlo">fpizlo</reporter>
          <assigned_to name="Filip Pizlo">fpizlo</assigned_to>
          <cc>buildbot</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>1306609</commentid>
    <comment_count>0</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2017-05-09 15:17:04 -0700</bug_when>
    <thetext>Some callers of Heap::heap() can pass a null cell and they will behave gracefully if we return a null Heap.  So, let&apos;s do that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1306612</commentid>
    <comment_count>1</comment_count>
      <attachid>309549</attachid>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2017-05-09 15:19:11 -0700</bug_when>
    <thetext>Created attachment 309549
the patch</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1306613</commentid>
    <comment_count>2</comment_count>
      <attachid>309549</attachid>
    <who name="Mark Lam">mark.lam</who>
    <bug_when>2017-05-09 15:23:15 -0700</bug_when>
    <thetext>Comment on attachment 309549
the patch

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

r=me

&gt; Source/JavaScriptCore/heap/HeapInlines.h:49
&gt; +    if (!cell)

nit: make this &quot;if (UNLIKELY(!cell))&quot;

&gt; Source/JavaScriptCore/heap/HeapInlines.h:56
&gt;      if (!v.isCell())

might as well make this one UNLIKELY too.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1306614</commentid>
    <comment_count>3</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2017-05-09 15:25:56 -0700</bug_when>
    <thetext>(In reply to Mark Lam from comment #2)
&gt; Comment on attachment 309549 [details]
&gt; the patch
&gt; 
&gt; View in context:
&gt; https://bugs.webkit.org/attachment.cgi?id=309549&amp;action=review
&gt; 
&gt; r=me
&gt; 
&gt; &gt; Source/JavaScriptCore/heap/HeapInlines.h:49
&gt; &gt; +    if (!cell)
&gt; 
&gt; nit: make this &quot;if (UNLIKELY(!cell))&quot;
&gt; 
&gt; &gt; Source/JavaScriptCore/heap/HeapInlines.h:56
&gt; &gt;      if (!v.isCell())
&gt; 
&gt; might as well make this one UNLIKELY too.

UNIKELY is unlikely to help if it&apos;s for an early return.  UNLIKELY is most useful when it lets the compiler know that some code is unlikely to be reached, but here the fall-through path is likely to be reached either way.

Also, I already benchmarked it without the UNLIKELY.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>1306615</commentid>
    <comment_count>4</comment_count>
    <who name="Filip Pizlo">fpizlo</who>
    <bug_when>2017-05-09 15:27:21 -0700</bug_when>
    <thetext>Landed in https://trac.webkit.org/changeset/216547/webkit</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="1"
              isprivate="0"
          >
            <attachid>309549</attachid>
            <date>2017-05-09 15:19:11 -0700</date>
            <delta_ts>2017-05-09 15:23:15 -0700</delta_ts>
            <desc>the patch</desc>
            <filename>blah.patch</filename>
            <type>text/plain</type>
            <size>1544</size>
            <attacher name="Filip Pizlo">fpizlo</attacher>
            
              <data encoding="base64">SW5kZXg6IFNvdXJjZS9KYXZhU2NyaXB0Q29yZS9DaGFuZ2VMb2cKPT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQotLS0gU291
cmNlL0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkocmV2aXNpb24gMjE2NTQ1KQorKysgU291cmNl
L0phdmFTY3JpcHRDb3JlL0NoYW5nZUxvZwkod29ya2luZyBjb3B5KQpAQCAtMSwzICsxLDIwIEBA
CisyMDE3LTA1LTA5ICBGaWxpcCBQaXpsbyAgPGZwaXpsb0BhcHBsZS5jb20+CisKKyAgICAgICAg
SGVhcDo6aGVhcCgpIHNob3VsZCBiZWhhdmUgZ3JhY2VmdWxseSBmb3IgbnVsbCBwb2ludGVycwor
ICAgICAgICBodHRwczovL2J1Z3Mud2Via2l0Lm9yZy9zaG93X2J1Zy5jZ2k/aWQ9MTcxODg4Cisg
ICAgICAgIDxyZGFyOi8vcHJvYmxlbS8zMjAwNTMxNT4KKworICAgICAgICBSZXZpZXdlZCBieSBO
T0JPRFkgKE9PUFMhKS4KKyAgICAgICAgCisgICAgICAgIFNvbWUgY2FsbGVycyBvZiBIZWFwOjpo
ZWFwKCkgY2FuIHBhc3MgYSBudWxsIGNlbGwgYW5kIHRoZXkgd2lsbCBiZWhhdmUgZ3JhY2VmdWxs
eSBpZiB3ZQorICAgICAgICByZXR1cm4gYSBudWxsIEhlYXAuIFNvLCBsZXQncyBkbyB0aGF0Lgor
ICAgICAgICAKKyAgICAgICAgVGhpcyBmaXhlcyBhIGNyYXNoIGFuZCBpdCBkb2VzIG5vdCBodXJ0
IHBlcmZvcm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XR1cm4gaGVhcCh2LmFzQ2VsbCgpKTsK
IH0KIAo=
</data>
<flag name="review"
          id="330727"
          type_id="1"
          status="+"
          setter="mark.lam"
    />
          </attachment>
      

    </bug>

</bugzilla>