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

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

Issue 2682143002: [compiler] Pass deoptimization_kind through DeoptimizeParameters and FlagsContinuation (Closed)
Patch Set: fix Created 3 years, 10 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 | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | src/compiler/code-generator.h » ('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 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 return Replace(dead()); 78 return Replace(dead());
79 } 79 }
80 } 80 }
81 return TakeConditionsFromFirstControl(node); 81 return TakeConditionsFromFirstControl(node);
82 } 82 }
83 83
84 Reduction BranchElimination::ReduceDeoptimizeConditional(Node* node) { 84 Reduction BranchElimination::ReduceDeoptimizeConditional(Node* node) {
85 DCHECK(node->opcode() == IrOpcode::kDeoptimizeIf || 85 DCHECK(node->opcode() == IrOpcode::kDeoptimizeIf ||
86 node->opcode() == IrOpcode::kDeoptimizeUnless); 86 node->opcode() == IrOpcode::kDeoptimizeUnless);
87 bool condition_is_true = node->opcode() == IrOpcode::kDeoptimizeUnless; 87 bool condition_is_true = node->opcode() == IrOpcode::kDeoptimizeUnless;
88 DeoptimizeReason reason = DeoptimizeReasonOf(node->op()); 88 DeoptimizeParameters p = DeoptimizeParametersOf(node->op());
89 Node* condition = NodeProperties::GetValueInput(node, 0); 89 Node* condition = NodeProperties::GetValueInput(node, 0);
90 Node* frame_state = NodeProperties::GetValueInput(node, 1); 90 Node* frame_state = NodeProperties::GetValueInput(node, 1);
91 Node* effect = NodeProperties::GetEffectInput(node); 91 Node* effect = NodeProperties::GetEffectInput(node);
92 Node* control = NodeProperties::GetControlInput(node); 92 Node* control = NodeProperties::GetControlInput(node);
93 ControlPathConditions const* conditions = node_conditions_.Get(control); 93 ControlPathConditions const* conditions = node_conditions_.Get(control);
94 // If we do not know anything about the predecessor, do not propagate just 94 // If we do not know anything about the predecessor, do not propagate just
95 // yet because we will have to recompute anyway once we compute the 95 // yet because we will have to recompute anyway once we compute the
96 // predecessor. 96 // predecessor.
97 if (conditions == nullptr) { 97 if (conditions == nullptr) {
98 return UpdateConditions(node, conditions); 98 return UpdateConditions(node, conditions);
99 } 99 }
100 Maybe<bool> condition_value = conditions->LookupCondition(condition); 100 Maybe<bool> condition_value = conditions->LookupCondition(condition);
101 if (condition_value.IsJust()) { 101 if (condition_value.IsJust()) {
102 // If we know the condition we can discard the branch. 102 // If we know the condition we can discard the branch.
103 if (condition_is_true == condition_value.FromJust()) { 103 if (condition_is_true == condition_value.FromJust()) {
104 // We don't update the conditions here, because we're replacing {node} 104 // We don't update the conditions here, because we're replacing {node}
105 // with the {control} node that already contains the right information. 105 // with the {control} node that already contains the right information.
106 ReplaceWithValue(node, dead(), effect, control); 106 ReplaceWithValue(node, dead(), effect, control);
107 } else { 107 } else {
108 control = 108 control = graph()->NewNode(common()->Deoptimize(p.kind(), p.reason()),
109 graph()->NewNode(common()->Deoptimize(DeoptimizeKind::kEager, reason), 109 frame_state, effect, control);
110 frame_state, effect, control);
111 // TODO(bmeurer): This should be on the AdvancedReducer somehow. 110 // TODO(bmeurer): This should be on the AdvancedReducer somehow.
112 NodeProperties::MergeControlToEnd(graph(), common(), control); 111 NodeProperties::MergeControlToEnd(graph(), common(), control);
113 Revisit(graph()->end()); 112 Revisit(graph()->end());
114 } 113 }
115 return Replace(dead()); 114 return Replace(dead());
116 } 115 }
117 return UpdateConditions( 116 return UpdateConditions(
118 node, conditions->AddCondition(zone_, condition, condition_is_true)); 117 node, conditions->AddCondition(zone_, condition, condition_is_true));
119 } 118 }
120 119
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 312
314 Graph* BranchElimination::graph() const { return jsgraph()->graph(); } 313 Graph* BranchElimination::graph() const { return jsgraph()->graph(); }
315 314
316 CommonOperatorBuilder* BranchElimination::common() const { 315 CommonOperatorBuilder* BranchElimination::common() const {
317 return jsgraph()->common(); 316 return jsgraph()->common();
318 } 317 }
319 318
320 } // namespace compiler 319 } // namespace compiler
321 } // namespace internal 320 } // namespace internal
322 } // namespace v8 321 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/arm64/instruction-selector-arm64.cc ('k') | src/compiler/code-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698