<p dir="auto">I am aware try-catch is emitted in 'for of' for some compatibility reason; however, it can be a surprising performance-hit on eg V8. Is there a way to suppress its emission (at the cost of some compatibility)?</p>
<h3 dir="auto"><g-emoji class="g-emoji" alias="computer" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f4bb.png">💻</g-emoji></h3>
<ul class="contains-task-list">
<li class="task-list-item"><input type="checkbox" id="" disabled="" class="task-list-item-checkbox"> Would you like to work on a fix?</li>
</ul>
<h3 dir="auto">How are you using Babel?</h3>
<p dir="auto">Programmatic API (<code class="notranslate">babel.transform</code>, <code class="notranslate">babel.parse</code>)</p>
<h3 dir="auto">Input code</h3>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="({
  __proto__: a,
  __proto__: a,
  a: a = 1
})"><pre class="notranslate"><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">__proto__</span>: <span class="pl-s1">a</span><span class="pl-kos">,</span>
  <span class="pl-c1">__proto__</span>: <span class="pl-s1">a</span><span class="pl-kos">,</span>
  <span class="pl-c1">a</span>: <span class="pl-s1">a</span> <span class="pl-c1">=</span> <span class="pl-c1">1</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
<p dir="auto"><a href="https://babel.dev/repl#?browsers=firefox%2091&amp;build=&amp;builtIns=false&amp;corejs=3.6&amp;spec=false&amp;loose=false&amp;code_lz=BQbwUABBD60A4CcD2AXJsBcECGAaSM8yamO-U2W2EAvBAIxgC-AlEA&amp;debug=false&amp;forceAllTransforms=false&amp;shippedProposals=false&amp;circleciRepo=&amp;evaluate=false&amp;fileSize=false&amp;timeTravel=false&amp;sourceType=module&amp;lineWrap=true&amp;presets=stage-1&amp;prettier=false&amp;targets=&amp;version=7.16.2&amp;externalPlugins=&amp;assumptions=%7B%7D" rel="nofollow">REPL</a></p>
<h3 dir="auto">Configuration file name</h3>
<p dir="auto"><em>No response</em></p>
<h3 dir="auto">Configuration</h3>
<p dir="auto">N. A.</p>
<h3 dir="auto">Current and expected behavior</h3>
<p dir="auto">Currently Babel parses it without errors.</p>
<p dir="auto">It should throw</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="Redefinition of __proto__ property."><pre class="notranslate"><code class="notranslate">Redefinition of __proto__ property.
</code></pre></div>
<p dir="auto">just like Babel correctly throws in the following example:</p>
<div class="highlight highlight-source-js notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="({
  __proto__: a,
  __proto__: a,
})"><pre class="notranslate"><span class="pl-kos">(</span><span class="pl-kos">{</span>
  <span class="pl-c1">__proto__</span>: <span class="pl-s1">a</span><span class="pl-kos">,</span>
  <span class="pl-c1">__proto__</span>: <span class="pl-s1">a</span><span class="pl-kos">,</span>
<span class="pl-kos">}</span><span class="pl-kos">)</span></pre></div>
<h3 dir="auto">Environment</h3>
<p dir="auto">REPL</p>
<h3 dir="auto">Possible solution</h3>
<p dir="auto">This issue is very similar to <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="472093115" data-permission-text="Title is private" data-url="https://github.com/babel/babel/issues/10262" data-hovercard-type="issue" data-hovercard-url="/babel/babel/issues/10262/hovercard" href="https://github.com/babel/babel/issues/10262">#10262</a>.</p>
<p dir="auto">Like how we handle <code class="notranslate">shorthandAssign</code></p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/babel/babel/blob/7250d2562be881f9cdc24c6646468e0f3afcaf9d/packages/babel-parser/src/parser/expression.js#L317-L319">babel/packages/babel-parser/src/parser/expression.js</a>
    </p>
    <p class="mb-0 color-fg-muted">
        Lines 317 to 319
      in
      <a data-pjax="true" class="commit-tease-sha" href="/babel/babel/commit/7250d2562be881f9cdc24c6646468e0f3afcaf9d">7250d25</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L317" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="317"></td>
          <td id="LC317" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-k">if</span> <span class="pl-kos">(</span><span class="pl-s1">refExpressionErrors</span><span class="pl-kos">.</span><span class="pl-c1">shorthandAssign</span> <span class="pl-c1">&gt;=</span> <span class="pl-s1">node</span><span class="pl-kos">.</span><span class="pl-c1">left</span><span class="pl-kos">.</span><span class="pl-c1">start</span><span class="pl-kos">)</span> <span class="pl-kos">{</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L318" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="318"></td>
          <td id="LC318" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line">   <span class="pl-s1">refExpressionErrors</span><span class="pl-kos">.</span><span class="pl-c1">shorthandAssign</span> <span class="pl-c1">=</span> <span class="pl-c1">-</span><span class="pl-c1">1</span><span class="pl-kos">;</span> <span class="pl-c">// reset because shorthand default was used correctly</span> </td>
        </tr>

        <tr class="border-0">
          <td id="L319" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="319"></td>
          <td id="LC319" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-kos">}</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<p dir="auto">we should reset <code class="notranslate">doubleProto</code> only when it is used correctly.</p>
<p dir="auto"></p><div class="Box Box--condensed my-2">
  <div class="Box-header f6">
    <p class="mb-0 text-bold">
      <a href="https://github.com/babel/babel/blob/7250d2562be881f9cdc24c6646468e0f3afcaf9d/packages/babel-parser/src/parser/expression.js#L312">babel/packages/babel-parser/src/parser/expression.js</a>
    </p>
    <p class="mb-0 color-fg-muted">
         Line 312
      in
      <a data-pjax="true" class="commit-tease-sha" href="/babel/babel/commit/7250d2562be881f9cdc24c6646468e0f3afcaf9d">7250d25</a>
    </p>
  </div>
  <div itemprop="text" class="Box-body p-0 blob-wrapper blob-wrapper-embedded data">
    <table class="highlight tab-size mb-0 js-file-line-container" data-tab-size="8" data-paste-markdown-skip="">

        <tbody><tr class="border-0">
          <td id="L312" class="blob-num border-0 px-3 py-0 color-bg-default" data-line-number="312"></td>
          <td id="LC312" class="blob-code border-0 px-3 py-0 color-bg-default blob-code-inner js-file-line"> <span class="pl-s1">refExpressionErrors</span><span class="pl-kos">.</span><span class="pl-c1">doubleProto</span> <span class="pl-c1">=</span> <span class="pl-c1">-</span><span class="pl-c1">1</span><span class="pl-kos">;</span> <span class="pl-c">// reset because double __proto__ is valid in assignment expression</span> </td>
        </tr>
    </tbody></table>
  </div>
</div>
<p></p>
<h3 dir="auto">Additional context</h3>
<p dir="auto"><em>No response</em></p>