Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(594)

Side by Side Diff: src/compiler/branch-elimination.cc

Issue 2002253003: [turbofan] Properly connect DeoptimizeIf/Unless to effect chain. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix JSCallReducer Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/compiler/common-operator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/compiler/branch-elimination.h" 5 #include "src/compiler/branch-elimination.h"
6 6
7 #include "src/compiler/js-graph.h" 7 #include "src/compiler/js-graph.h"
8 #include "src/compiler/node-properties.h" 8 #include "src/compiler/node-properties.h"
9 #include "src/compiler/simplified-operator.h" 9 #include "src/compiler/simplified-operator.h"
10 10
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 // yet because we will have to recompute anyway once we compute the 92 // yet because we will have to recompute anyway once we compute the
93 // predecessor. 93 // predecessor.
94 if (conditions == nullptr) { 94 if (conditions == nullptr) {
95 DCHECK_NULL(node_conditions_.Get(node)); 95 DCHECK_NULL(node_conditions_.Get(node));
96 return NoChange(); 96 return NoChange();
97 } 97 }
98 Maybe<bool> condition_value = conditions->LookupCondition(condition); 98 Maybe<bool> condition_value = conditions->LookupCondition(condition);
99 if (condition_value.IsJust()) { 99 if (condition_value.IsJust()) {
100 // If we know the condition we can discard the branch. 100 // If we know the condition we can discard the branch.
101 if (condition_is_true == condition_value.FromJust()) { 101 if (condition_is_true == condition_value.FromJust()) {
102 // We don't to update the conditions here, because we're replacing with 102 // We don't update the conditions here, because we're replacing {node}
103 // the {control} node that already contains the right information. 103 // with the {control} node that already contains the right information.
104 return Replace(control); 104 ReplaceWithValue(node, dead(), effect, control);
105 } else { 105 } else {
106 control = graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager), 106 control = graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager),
107 frame_state, effect, control); 107 frame_state, effect, control);
108 // TODO(bmeurer): This should be on the AdvancedReducer somehow. 108 // TODO(bmeurer): This should be on the AdvancedReducer somehow.
109 NodeProperties::MergeControlToEnd(graph(), common(), control); 109 NodeProperties::MergeControlToEnd(graph(), common(), control);
110 Revisit(graph()->end()); 110 Revisit(graph()->end());
111 return Replace(dead());
112 } 111 }
112 return Replace(dead());
113 } 113 }
114 return UpdateConditions( 114 return UpdateConditions(
115 node, conditions->AddCondition(zone_, condition, condition_is_true)); 115 node, conditions->AddCondition(zone_, condition, condition_is_true));
116 } 116 }
117 117
118 Reduction BranchElimination::ReduceIf(Node* node, bool is_true_branch) { 118 Reduction BranchElimination::ReduceIf(Node* node, bool is_true_branch) {
119 // Add the condition to the list arriving from the input branch. 119 // Add the condition to the list arriving from the input branch.
120 Node* branch = NodeProperties::GetControlInput(node, 0); 120 Node* branch = NodeProperties::GetControlInput(node, 0);
121 const ControlPathConditions* from_branch = node_conditions_.Get(branch); 121 const ControlPathConditions* from_branch = node_conditions_.Get(branch);
122 // If we do not know anything about the predecessor, do not propagate just 122 // If we do not know anything about the predecessor, do not propagate just
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 304
305 Graph* BranchElimination::graph() const { return jsgraph()->graph(); } 305 Graph* BranchElimination::graph() const { return jsgraph()->graph(); }
306 306
307 CommonOperatorBuilder* BranchElimination::common() const { 307 CommonOperatorBuilder* BranchElimination::common() const {
308 return jsgraph()->common(); 308 return jsgraph()->common();
309 } 309 }
310 310
311 } // namespace compiler 311 } // namespace compiler
312 } // namespace internal 312 } // namespace internal
313 } // namespace v8 313 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | src/compiler/common-operator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698