<html>
    <head>
      <base href="https://bugs.webkit.org/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - How we load new.target in arrow functions is broken"
   href="https://bugs.webkit.org/show_bug.cgi?id=155153">155153</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>How we load new.target in arrow functions is broken
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>WebKit
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>WebKit Nightly Build
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Unspecified
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>Normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P2
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>JavaScriptCore
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>webkit-unassigned&#64;lists.webkit.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sbarati&#64;apple.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>gskachkov&#64;gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>function foo() {
    let arr = () =&gt; {
        if (false) {
            print(new.target);
        } else {
            print(new.target);
        }
    };
    arr();
}
new foo();

This prints undefined. It shouldn't.
The reason is that we make a classic mistake
where we emit code to load new.target once.
Even if that code is behind a branch in byte code,
we assume all uses can use that already loaded value.
That's wrong. We either need to always emit the load from
the scope for each new.target, or we need to emit the load
at the function prologue before any uses of new.target.

I think loading it from the scope is probably cleaner because
the alternative punishes programs that never use new.target.
That said, always loading it from the scope will punish programs
that do the load in a loop.</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>