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

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

Issue 2141953002: [Turbofan]: Add integer multiplication with overflow to typed lowering. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@multiply
Patch Set: Code comments. 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 | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/js-graph.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 65a8a6527e32ea75b2be2978de84c5ed7a52e3f5..292d4d58e2731584b72a1550f794e27953200d7b 100644
--- a/src/compiler/effect-control-linearizer.cc
+++ b/src/compiler/effect-control-linearizer.cc
@@ -648,6 +648,9 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node,
case IrOpcode::kCheckedUint32Mod:
state = LowerCheckedUint32Mod(node, frame_state, *effect, *control);
break;
+ case IrOpcode::kCheckedInt32Mul:
+ state = LowerCheckedInt32Mul(node, frame_state, *effect, *control);
+ break;
case IrOpcode::kCheckedUint32ToInt32:
state = LowerCheckedUint32ToInt32(node, frame_state, *effect, *control);
break;
@@ -1299,6 +1302,47 @@ EffectControlLinearizer::LowerCheckedUint32Mod(Node* node, Node* frame_state,
}
EffectControlLinearizer::ValueEffectControl
+EffectControlLinearizer::LowerCheckedInt32Mul(Node* node, Node* frame_state,
+ Node* effect, Node* control) {
+ Node* zero = jsgraph()->Int32Constant(0);
+ Node* lhs = node->InputAt(0);
+ Node* rhs = node->InputAt(1);
+
+ Node* projection =
+ graph()->NewNode(machine()->Int32MulWithOverflow(), lhs, rhs, control);
+
+ Node* check = graph()->NewNode(common()->Projection(1), projection, control);
+ control = effect = graph()->NewNode(common()->DeoptimizeIf(), check,
+ frame_state, effect, control);
+
+ 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);
+
+ 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(), 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;
+
+ 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);
+}
+
+EffectControlLinearizer::ValueEffectControl
EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node,
Node* frame_state,
Node* effect,
« no previous file with comments | « src/compiler/effect-control-linearizer.h ('k') | src/compiler/js-graph.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698