<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body>
      <p>
        <div>
            <b><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - calling super() a second time in a constructor should throw"
   href="https://bugs.webkit.org/show_bug.cgi?id=151113#c37">Comment # 37</a>
              on <a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - calling super() a second time in a constructor should throw"
   href="https://bugs.webkit.org/show_bug.cgi?id=151113">bug 151113</a>
              from <span class="vcard"><a class="email" href="mailto:keith_miller&#64;apple.com" title="Keith Miller &lt;keith_miller&#64;apple.com&gt;"> <span class="fn">Keith Miller</span></a>
</span></b>
        <pre>Comment on <span class=""><a href="attachment.cgi?id=276498&amp;action=diff" name="attach_276498" title="Patch">attachment 276498</a> <a href="attachment.cgi?id=276498&amp;action=edit" title="Patch">[details]</a></span>
Patch

View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=276498&amp;action=review">https://bugs.webkit.org/attachment.cgi?id=276498&amp;action=review</a>

<span class="quote">&gt; Source/JavaScriptCore/ChangeLog:14
&gt; +        Current patch implement check if 'super()' was called in constructor 
&gt; +        more than once and raise RuntimeError if 'super()' called second time. 
&gt; +        According to spec we need to raise error just after second super() 
&gt; +        is finished, and before new this is assign 
&gt; +        <a href="https://esdiscuss.org/topic/duplicate-super-call-behaviour">https://esdiscuss.org/topic/duplicate-super-call-behaviour</a>. 
&gt; +        To implement this behavior was introduced new op code - op_is_empty
&gt; +        that is used to check if 'this' is empty.</span >

I think the phrasing of the changelog would be clearer as:

Currently, our implementation checks if 'super()' was called in a constructor more than once and raises a RuntimeError before the second call. According to the spec we need to raise an error just after the second super() is finished and before the new 'this' is assigned <a href="https://esdiscuss.org/topic/duplicate-super-call-behaviour">https://esdiscuss.org/topic/duplicate-super-call-behaviour</a>. To implement this behavior this patch adds a new op code, op_is_empty, that is used to check if 'this' is empty.

<span class="quote">&gt; Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:1097
&gt; +            if (!(child.m_type &amp; ~SpecEmpty)) {
&gt; +                setConstant(node, jsBoolean(true));
&gt; +                constantWasSet = true;
&gt; +                break;
&gt; +            }</span >

I think this case is wrong. If the abstract interpreter has no information then child.m_type will be SpecNone (0) and this case will convert the IsEmpty check into a constant. I think a correct condition would be &quot;child.m_type &amp;&amp; !(child.m_type &amp; ~SpecEmpty)&quot;.</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>