Commit df06f1c7 authored by mstarzinger's avatar mstarzinger Committed by Commit bot

[turbofan] Fix exit control flow in TryCatchBuilder.

This makes sure that the exit control flow that merges the try-block
with the catch-block after a try-catch-statement creates a new merge
node in cases where it has to. Otherwise dangling phi nodes might have
the wrong number of value inputs.

R=bmeurer@chromium.org
TEST=mjsunit/regress/regress-crbug-505354
BUG=chromium:505354
LOG=N

Review URL: https://codereview.chromium.org/1213183003

Cr-Commit-Position: refs/heads/master@{#29362}
parent 40d01b57
......@@ -160,6 +160,7 @@ void BlockBuilder::EndBlock() {
void TryCatchBuilder::BeginTry() {
exit_environment_ = environment()->CopyAsUnreachable();
catch_environment_ = environment()->CopyAsUnreachable();
catch_environment_->Push(the_hole());
}
......@@ -174,7 +175,7 @@ void TryCatchBuilder::Throw(Node* exception) {
void TryCatchBuilder::EndTry() {
exit_environment_ = environment();
exit_environment_->Merge(environment());
exception_node_ = catch_environment_->Pop();
set_environment(catch_environment_);
}
......
// Copyright 2015 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 --turbo-filter=f
function f() {
"use strict";
try {
for (let i = 0; i < 10; i++) {}
} catch(e) {}
}
%OptimizeFunctionOnNextCall(f);
f();
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment