Index: src/compiler/effect-control-linearizer.cc |
diff --git a/src/compiler/effect-control-linearizer.cc b/src/compiler/effect-control-linearizer.cc |
index aeb5926759fc7a45a1703965a5643ba215e66c79..65a8a6527e32ea75b2be2978de84c5ed7a52e3f5 100644 |
--- a/src/compiler/effect-control-linearizer.cc |
+++ b/src/compiler/effect-control-linearizer.cc |
@@ -642,6 +642,12 @@ bool EffectControlLinearizer::TryWireInStateEffect(Node* node, |
case IrOpcode::kCheckedInt32Mod: |
state = LowerCheckedInt32Mod(node, frame_state, *effect, *control); |
break; |
+ case IrOpcode::kCheckedUint32Div: |
+ state = LowerCheckedUint32Div(node, frame_state, *effect, *control); |
+ break; |
+ case IrOpcode::kCheckedUint32Mod: |
+ state = LowerCheckedUint32Mod(node, frame_state, *effect, *control); |
+ break; |
case IrOpcode::kCheckedUint32ToInt32: |
state = LowerCheckedUint32ToInt32(node, frame_state, *effect, *control); |
break; |
@@ -1249,6 +1255,50 @@ EffectControlLinearizer::LowerCheckedInt32Mod(Node* node, Node* frame_state, |
} |
EffectControlLinearizer::ValueEffectControl |
+EffectControlLinearizer::LowerCheckedUint32Div(Node* node, Node* frame_state, |
+ Node* effect, Node* control) { |
+ Node* zero = jsgraph()->Int32Constant(0); |
+ |
+ Node* lhs = node->InputAt(0); |
+ Node* rhs = node->InputAt(1); |
+ |
+ // Ensure that {rhs} is not zero, otherwise we'd have to return NaN. |
+ Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero); |
+ control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, |
+ frame_state, effect, control); |
+ |
+ // Perform the actual unsigned integer division. |
+ Node* value = graph()->NewNode(machine()->Uint32Div(), lhs, rhs, control); |
+ |
+ // Check if the remainder is non-zero. |
+ check = graph()->NewNode(machine()->Word32Equal(), lhs, |
+ graph()->NewNode(machine()->Int32Mul(), rhs, value)); |
+ control = effect = graph()->NewNode(common()->DeoptimizeUnless(), check, |
+ frame_state, effect, control); |
+ |
+ return ValueEffectControl(value, effect, control); |
+} |
+ |
+EffectControlLinearizer::ValueEffectControl |
+EffectControlLinearizer::LowerCheckedUint32Mod(Node* node, Node* frame_state, |
+ Node* effect, Node* control) { |
+ Node* zero = jsgraph()->Int32Constant(0); |
+ |
+ Node* lhs = node->InputAt(0); |
+ Node* rhs = node->InputAt(1); |
+ |
+ // Ensure that {rhs} is not zero, otherwise we'd have to return NaN. |
+ Node* check = graph()->NewNode(machine()->Word32Equal(), rhs, zero); |
+ control = effect = graph()->NewNode(common()->DeoptimizeIf(), check, |
+ frame_state, effect, control); |
+ |
+ // Perform the actual unsigned integer modulus. |
+ Node* value = graph()->NewNode(machine()->Uint32Mod(), lhs, rhs, control); |
+ |
+ return ValueEffectControl(value, effect, control); |
+} |
+ |
+EffectControlLinearizer::ValueEffectControl |
EffectControlLinearizer::LowerCheckedUint32ToInt32(Node* node, |
Node* frame_state, |
Node* effect, |