[turbofan] Reducers should revisit end after merging to it.

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

Cr-Commit-Position: refs/heads/master@{#33767}
This commit is contained in:
jarin 2016-02-05 03:01:17 -08:00 committed by Commit bot
parent 3f36e658c8
commit 52f2dbcac1
8 changed files with 31 additions and 4 deletions

View File

@ -336,6 +336,7 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) {
frame_state, effect, if_false);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
Revisit(graph()->end());
control = graph()->NewNode(common()->IfTrue(), branch);
// Turn the {node} into a {JSCreateArray} call.
@ -361,6 +362,7 @@ Reduction JSCallReducer::ReduceJSCallFunction(Node* node) {
frame_state, effect, if_false);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
Revisit(graph()->end());
control = graph()->NewNode(common()->IfTrue(), branch);
// Specialize the JSCallFunction node to the {target_function}.
@ -478,6 +480,7 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) {
frame_state, effect, if_false);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
Revisit(graph()->end());
control = graph()->NewNode(common()->IfTrue(), branch);
// Turn the {node} into a {JSCreateArray} call.
@ -509,6 +512,7 @@ Reduction JSCallReducer::ReduceJSCallConstruct(Node* node) {
frame_state, effect, if_false);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
Revisit(graph()->end());
control = graph()->NewNode(common()->IfTrue(), branch);
// Specialize the JSCallConstruct node to the {target_function}.

View File

@ -20,7 +20,7 @@ class JSOperatorBuilder;
// Performs strength reduction on {JSCallConstruct} and {JSCallFunction} nodes,
// which might allow inlining or other optimizations to be performed afterwards.
class JSCallReducer final : public Reducer {
class JSCallReducer final : public AdvancedReducer {
public:
// Flags that control the mode of operation.
enum Flag {
@ -29,9 +29,12 @@ class JSCallReducer final : public Reducer {
};
typedef base::Flags<Flag> Flags;
JSCallReducer(JSGraph* jsgraph, Flags flags,
JSCallReducer(Editor* editor, JSGraph* jsgraph, Flags flags,
MaybeHandle<Context> native_context)
: jsgraph_(jsgraph), flags_(flags), native_context_(native_context) {}
: AdvancedReducer(editor),
jsgraph_(jsgraph),
flags_(flags),
native_context_(native_context) {}
Reduction Reduce(Node* node) final;

View File

@ -179,6 +179,7 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
frame_state, effect, if_false);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
Revisit(graph()->end());
control = graph()->NewNode(common()->IfTrue(), branch);
break;
}
@ -198,6 +199,7 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
frame_state, effect, if_true);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
Revisit(graph()->end());
control = graph()->NewNode(common()->IfFalse(), branch);
// Load the {value} map check against the {property_cell} map.
@ -219,6 +221,7 @@ Reduction JSGlobalObjectSpecialization::ReduceJSStoreGlobal(Node* node) {
frame_state, effect, if_false);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
Revisit(graph()->end());
control = graph()->NewNode(common()->IfTrue(), branch);
effect = graph()->NewNode(
simplified()->StoreField(

View File

@ -205,6 +205,7 @@ Reduction JSInliner::InlineCall(Node* call, Node* new_target, Node* context,
case IrOpcode::kThrow:
NodeProperties::MergeControlToEnd(jsgraph_->graph(), jsgraph_->common(),
input);
Revisit(jsgraph_->graph()->end());
break;
default:
UNREACHABLE();

View File

@ -146,6 +146,7 @@ Reduction JSIntrinsicLowering::ReduceDeoptimizeNow(Node* node) {
graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
frame_state, effect, control);
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
Revisit(graph()->end());
node->TrimInputCount(0);
NodeProperties::ChangeOp(node, common()->Dead());

View File

@ -418,6 +418,7 @@ Reduction JSNativeContextSpecialization::ReduceNamedAccess(
frame_state, exit_effect, exit_control);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
Revisit(graph()->end());
// Generate the final merge point for all (polymorphic) branches.
int const control_count = static_cast<int>(controls.size());
@ -850,6 +851,7 @@ Reduction JSNativeContextSpecialization::ReduceElementAccess(
frame_state, exit_effect, exit_control);
// TODO(bmeurer): This should be on the AdvancedReducer somehow.
NodeProperties::MergeControlToEnd(graph(), common(), deoptimize);
Revisit(graph()->end());
// Generate the final merge point for all (polymorphic) branches.
int const control_count = static_cast<int>(controls.size());

View File

@ -539,7 +539,7 @@ struct InliningPhase {
data->common());
CommonOperatorReducer common_reducer(&graph_reducer, data->graph(),
data->common(), data->machine());
JSCallReducer call_reducer(data->jsgraph(),
JSCallReducer call_reducer(&graph_reducer, data->jsgraph(),
data->info()->is_deoptimization_enabled()
? JSCallReducer::kDeoptimizationEnabled
: JSCallReducer::kNoFlags,

View File

@ -0,0 +1,13 @@
// 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
function g() { if (false) throw 0; }
function f() { g(); }
f();
f();
%OptimizeFunctionOnNextCall(f);
f();