<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@apple.com" title="Keith Miller <keith_miller@apple.com>"> <span class="fn">Keith Miller</span></a>
</span></b>
<pre>Comment on <span class=""><a href="attachment.cgi?id=276498&action=diff" name="attach_276498" title="Patch">attachment 276498</a> <a href="attachment.cgi?id=276498&action=edit" title="Patch">[details]</a></span>
Patch
View in context: <a href="https://bugs.webkit.org/attachment.cgi?id=276498&action=review">https://bugs.webkit.org/attachment.cgi?id=276498&action=review</a>
<span class="quote">> Source/JavaScriptCore/ChangeLog:14
> + Current patch implement check if 'super()' was called in constructor
> + more than once and raise RuntimeError if 'super()' called second time.
> + According to spec we need to raise error just after second super()
> + is finished, and before new this is assign
> + <a href="https://esdiscuss.org/topic/duplicate-super-call-behaviour">https://esdiscuss.org/topic/duplicate-super-call-behaviour</a>.
> + To implement this behavior was introduced new op code - op_is_empty
> + 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">> Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:1097
> + if (!(child.m_type & ~SpecEmpty)) {
> + setConstant(node, jsBoolean(true));
> + constantWasSet = true;
> + break;
> + }</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 "child.m_type && !(child.m_type & ~SpecEmpty)".</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>