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

Unified Diff: src/compiler/effect-control-linearizer.cc

Issue 2154073002: [Turbofan]: Eliminate the check for -0 if it's not possible/observable. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: REBASE. Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/compiler/representation-change.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/effect-control-linearizer.cc
diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc
index 8f16dbcaf0231286a0f9652ad0f9038668d31866..cd697e0a9dcff1e1da61eda227fddf4477880de7 100644
--- a/src/compiler/effect-control-linearizer.cc
+++ b/src/compiler/effect-control-linearizer.cc
@@ -1325,6 +1325,7 @@ EffectControlLinearizer::LowerCheckedUint32Mod(Node* node, Node* frame_state,
EffectControlLinearizer::ValueEffectControl
EffectControlLinearizer::LowerCheckedInt32Mul(Node* node, Node* frame_state,
Node* effect, Node* control) {
+ CheckForMinusZeroMode mode = CheckMinusZeroModeOf(node->op());
Node* zero = jsgraph()->Int32Constant(0);
Node* lhs = node->InputAt(0);
Node* rhs = node->InputAt(1);
@@ -1339,28 +1340,30 @@ EffectControlLinearizer::LowerCheckedInt32Mul(Node* node, Node* frame_state,
Node* value = graph()->NewNode(common()->Projection(0), projection, control);
- Node* check_zero = graph()->NewNode(machine()->Word32Equal(), value, zero);
- Node* branch_zero = graph()->NewNode(common()->Branch(BranchHint::kFalse),
- check_zero, control);
+ if (mode == CheckForMinusZeroMode::kCheckForMinusZero) {
+ Node* check_zero = graph()->NewNode(machine()->Word32Equal(), value, zero);
+ Node* branch_zero = graph()->NewNode(common()->Branch(BranchHint::kFalse),
+ check_zero, control);
- Node* if_zero = graph()->NewNode(common()->IfTrue(), branch_zero);
- Node* e_if_zero = effect;
- {
- // We may need to return negative zero.
- Node* or_inputs = graph()->NewNode(machine()->Word32Or(), lhs, rhs);
- Node* check_or =
- graph()->NewNode(machine()->Int32LessThan(), or_inputs, zero);
- if_zero = e_if_zero =
- graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kMinusZero),
- check_or, frame_state, e_if_zero, if_zero);
- }
+ Node* if_zero = graph()->NewNode(common()->IfTrue(), branch_zero);
+ Node* e_if_zero = effect;
+ {
+ // We may need to return negative zero.
+ Node* or_inputs = graph()->NewNode(machine()->Word32Or(), lhs, rhs);
+ Node* check_or =
+ graph()->NewNode(machine()->Int32LessThan(), or_inputs, zero);
+ if_zero = e_if_zero =
+ graph()->NewNode(common()->DeoptimizeIf(DeoptimizeReason::kMinusZero),
+ check_or, frame_state, e_if_zero, if_zero);
+ }
- Node* if_not_zero = graph()->NewNode(common()->IfFalse(), branch_zero);
- Node* e_if_not_zero = effect;
+ Node* if_not_zero = graph()->NewNode(common()->IfFalse(), branch_zero);
+ Node* e_if_not_zero = effect;
- control = graph()->NewNode(common()->Merge(2), if_zero, if_not_zero);
- effect = graph()->NewNode(common()->EffectPhi(2), e_if_zero, e_if_not_zero,
- control);
+ control = graph()->NewNode(common()->Merge(2), if_zero, if_not_zero);
+ effect = graph()->NewNode(common()->EffectPhi(2), e_if_zero, e_if_not_zero,
+ control);
+ }
return ValueEffectControl(value, effect, control);
}
« no previous file with comments | « no previous file | src/compiler/representation-change.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698