<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Remove AllocationProfileWatchpoint node"
   href="https://bugs.webkit.org/show_bug.cgi?id=143999#c5">Comment # 5</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Remove AllocationProfileWatchpoint node"
   href="https://bugs.webkit.org/show_bug.cgi?id=143999">bug 143999</a>
              from <span class="vcard"><a class="email" href="mailto:fpizlo&#64;apple.com" title="Filip Pizlo &lt;fpizlo&#64;apple.com&gt;"> <span class="fn">Filip Pizlo</span></a>
</span></b>
        <pre>(In reply to <a href="show_bug.cgi?id=143999#c4">comment #4</a>)
<span class="quote">&gt; (In reply to <a href="show_bug.cgi?id=143999#c3">comment #3</a>)
&gt; &gt; Comment on <span class=""><a href="attachment.cgi?id=251246&amp;action=diff" name="attach_251246" title="Tentative patch, non thread-safe">attachment 251246</a> <a href="attachment.cgi?id=251246&amp;action=edit" title="Tentative patch, non thread-safe">[details]</a></span>
&gt; &gt; Tentative patch, non thread-safe
&gt; &gt; 
&gt; &gt; View in context:
&gt; &gt; <a href="https://bugs.webkit.org/attachment.cgi?id=251246&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=251246&amp;action=review</a>
&gt; &gt; 
&gt; &gt; &gt;&gt; Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp:2643
&gt; &gt; &gt;&gt;                  if (Structure* structure = function-&gt;allocationStructure()) {
&gt; &gt; &gt; 
&gt; &gt; &gt; We probably need to freeze the rare data here, in case it is removed by the JS thread and then the GC runs at that point.
&gt; &gt; &gt; Not sure how to do this, I first need to investigate more deeply how freeze() &amp; the GC works.
&gt; &gt; 
&gt; &gt; It seems that you're using JSFunction's helpers to get things from the rare
&gt; &gt; data.  I would make this explicit here, so instead of
&gt; &gt; function-&gt;allocationStructure() you'd do something like
&gt; &gt; rareData-&gt;allocationStructure().  And instead of
&gt; &gt; function-&gt;allocationProfileWatchpointSet() you'd do
&gt; &gt; rareData-&gt;allocationProfileWatchpointSet().
&gt; 
&gt; I had this discussion with Michael yesterday who told me keeping the
&gt; accessors would be better, but that is indeed problematic here. I will
&gt; change that.
&gt; 
&gt; &gt; 
&gt; &gt; Then you'd do:
&gt; &gt; 
&gt; &gt; FunctionRareData* rareData = function-&gt;rareData();
&gt; &gt; if (rareData) {
&gt; &gt;     if (Structure* structure = rareData-&gt;structure()) {
&gt; &gt;         m_graph.freeze(rareData);
&gt; 
&gt; Right, the m_graph.freeze(rareData) was the thing I was not sure would be
&gt; sufficient (thought I needed to store it somewhere).
&gt; Shouldn't it rather be:
&gt; 
&gt; if (rareData) {
&gt;     m_graph.freeze(rareData);
&gt;     if (Structure* structure = rareData-&gt;structure()) {
&gt;       ...
&gt;     }
&gt; }
&gt; 
&gt; in case the rare data is deallocated in between the two ifs (this shouldn't
&gt; matter after <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - Don't de-allocate FunctionRareData"
   href="show_bug.cgi?id=144000">https://bugs.webkit.org/show_bug.cgi?id=144000</a> is taken care
&gt; of)?</span >

It's safe to assume that a GC cannot happen during a DFG phase.  The parser counts as a phase.  Hence, you only need to freeze it if you decide that you'll be using it after parsing completes - i.e. exactly if/when you addLazily().

<span class="quote">&gt; 
&gt; Thanks!</span ></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>