a858cfd3ec
Try blocks (whether catch or finally) will unconditionally create handler tables and start a new basic block for the exception handler. This can accidentally resurrect a dead block when the entire try block is dead (and hence can never enter the exception handler in the first place). Add a deadness check to BuildTryCatch/Finally to fix this. Bug: chromium:1273677 Change-Id: Icda9deb1459e47de5cb83e7b636299e24c3ebe77 Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3306555 Commit-Queue: Leszek Swirski <leszeks@chromium.org> Commit-Queue: Marja Hölttä <marja@chromium.org> Reviewed-by: Marja Hölttä <marja@chromium.org> Auto-Submit: Leszek Swirski <leszeks@chromium.org> Cr-Commit-Position: refs/heads/main@{#78179}
21 lines
712 B
JavaScript
21 lines
712 B
JavaScript
// Copyright 2021 the V8 project authors. All rights reserved.
|
|
// Use of this source code is governed by a BSD-style license that can be
|
|
// found in the LICENSE file.
|
|
//
|
|
// Flags: --allow-natives-syntax
|
|
|
|
function test() {}
|
|
function foo() {
|
|
// --test() will throw a ReferenceError, making the rest of the for-of loop
|
|
// dead. The destructuring assignment is still part of the same expression,
|
|
// and it generates a try-finally for its iteration, so if it isn't fully
|
|
// eliminated the finally block may resurrect the destructuring assignment
|
|
// loop.
|
|
for (let [x] of --test()) {}
|
|
}
|
|
|
|
%PrepareFunctionForOptimization(foo);
|
|
try { foo() } catch {}
|
|
%OptimizeFunctionOnNextCall(foo);
|
|
try { foo() } catch {}
|