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

Fix try-finally for dead AST-branches in TurboFan.

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

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

Cr-Commit-Position: refs/heads/master@{#26458}
parent 368a503c
...@@ -1194,7 +1194,6 @@ void AstGraphBuilder::VisitTryCatchStatement(TryCatchStatement* stmt) { ...@@ -1194,7 +1194,6 @@ void AstGraphBuilder::VisitTryCatchStatement(TryCatchStatement* stmt) {
// Create a catch scope that binds the exception. // Create a catch scope that binds the exception.
Node* exception = try_control.GetExceptionNode(); Node* exception = try_control.GetExceptionNode();
if (exception == NULL) exception = jsgraph()->NullConstant();
Unique<String> name = MakeUnique(stmt->variable()->name()); Unique<String> name = MakeUnique(stmt->variable()->name());
const Operator* op = javascript()->CreateCatchContext(name); const Operator* op = javascript()->CreateCatchContext(name);
Node* context = NewNode(op, exception, GetFunctionClosure()); Node* context = NewNode(op, exception, GetFunctionClosure());
......
...@@ -55,6 +55,7 @@ class AstGraphBuilder : public AstVisitor { ...@@ -55,6 +55,7 @@ class AstGraphBuilder : public AstVisitor {
// Get the node that represents the outer function context. // Get the node that represents the outer function context.
Node* GetFunctionContext(); Node* GetFunctionContext();
// Get the node that represents the outer function closure. // Get the node that represents the outer function closure.
Node* GetFunctionClosure(); Node* GetFunctionClosure();
......
...@@ -151,7 +151,7 @@ void BlockBuilder::EndBlock() { ...@@ -151,7 +151,7 @@ void BlockBuilder::EndBlock() {
void TryCatchBuilder::BeginTry() { void TryCatchBuilder::BeginTry() {
catch_environment_ = environment()->CopyAsUnreachable(); catch_environment_ = environment()->CopyAsUnreachable();
catch_environment_->Push(nullptr); catch_environment_->Push(the_hole());
} }
...@@ -178,7 +178,7 @@ void TryCatchBuilder::EndCatch() { ...@@ -178,7 +178,7 @@ void TryCatchBuilder::EndCatch() {
void TryFinallyBuilder::BeginTry() { void TryFinallyBuilder::BeginTry() {
finally_environment_ = environment()->CopyAsUnreachable(); finally_environment_ = environment()->CopyAsUnreachable();
finally_environment_->Push(nullptr); finally_environment_->Push(the_hole());
} }
......
...@@ -32,6 +32,7 @@ class ControlBuilder { ...@@ -32,6 +32,7 @@ class ControlBuilder {
Zone* zone() const { return builder_->local_zone(); } Zone* zone() const { return builder_->local_zone(); }
Environment* environment() { return builder_->environment(); } Environment* environment() { return builder_->environment(); }
void set_environment(Environment* env) { builder_->set_environment(env); } void set_environment(Environment* env) { builder_->set_environment(env); }
Node* the_hole() const { return builder_->jsgraph()->TheHoleConstant(); }
Builder* builder_; Builder* builder_;
}; };
......
// 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.
(function f() {
do { return 23; } while(false);
with (0) {
try {
return 42;
} finally {}
}
})();
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