Commit 514951f6 authored by jarin's avatar jarin Committed by Commit bot

[turbofan] In effect control linearizer, only delay effect phi update for loops.

Delaying for merges caused branch cloning using dummy effect phi inputs,
potentially splitting the effect chain at start.

We still have to delay the creation for loops because we need to break
cycles.

BUG=chromium:628403

Review-Url: https://codereview.chromium.org/2159603002
Cr-Commit-Position: refs/heads/master@{#37808}
parent 18543ff1
......@@ -378,13 +378,17 @@ void EffectControlLinearizer::Run() {
// The input blocks do not have the same effect. We have
// to create an effect phi node.
inputs_buffer.clear();
inputs_buffer.resize(block->PredecessorCount(), graph()->start());
inputs_buffer.resize(block->PredecessorCount(), jsgraph()->Dead());
inputs_buffer.push_back(control);
effect = graph()->NewNode(
common()->EffectPhi(static_cast<int>(block->PredecessorCount())),
static_cast<int>(inputs_buffer.size()), &(inputs_buffer.front()));
// Let us update the effect phi node later.
pending_effect_phis.push_back(PendingEffectPhi(effect, block));
// For loops, we update the effect phi node later to break cycles.
if (control->opcode() == IrOpcode::kLoop) {
pending_effect_phis.push_back(PendingEffectPhi(effect, block));
} else {
UpdateEffectPhi(effect, block, &block_effects);
}
} else if (control->opcode() == IrOpcode::kIfException) {
// The IfException is connected into the effect chain, so we need
// to update the effect here.
......
// Copyright 2016 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
var dothrow = false;
function g() {
if (dothrow) throw 1;
}
function f(a) {
try {
g();
} catch(e) {
if (typeof e !== 'number' && e !== 1) throw e;
return a[0];
}
}
%NeverOptimizeFunction(g);
f();
f();
%OptimizeFunctionOnNextCall(f);
dothrow = true;
assertEquals(42, f([42]));
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