Index: src/compiler/js-typed-lowering.cc |
diff --git a/src/compiler/js-typed-lowering.cc b/src/compiler/js-typed-lowering.cc |
index 3c79ea1e1d7d2d44163410d9e6e2e58ce1bc2b02..282848064a4a8b0a8338886dab61055f9e613f9a 100644 |
--- a/src/compiler/js-typed-lowering.cc |
+++ b/src/compiler/js-typed-lowering.cc |
@@ -272,13 +272,15 @@ Reduction JSTypedLowering::ReduceJSAdd(Node* node) { |
Reduction JSTypedLowering::ReduceJSBitwiseOr(Node* node) { |
JSBinopReduction r(this, node); |
- if (r.BothInputsAre(Type::Primitive()) || r.OneInputIs(zero_range_)) { |
- // TODO(jarin): Propagate frame state input from non-primitive input node to |
- // JSToNumber node. |
+ |
+ // We can only reduce to Word32Or if we are sure the to-number conversions |
+ // cannot lazily deoptimize. |
+ bool shortcut_or_zero = |
+ !FLAG_turbo_deoptimization && r.OneInputIs(zero_range_); |
+ if (r.BothInputsAre(Type::Primitive()) || shortcut_or_zero) { |
// TODO(titzer): some Smi bitwise operations don't really require going |
// all the way to int32, which can save tagging/untagging for some |
- // operations |
- // on some platforms. |
+ // operations on some platforms. |
// TODO(turbofan): make this heuristic configurable for code size. |
r.ConvertInputsToUI32(kSigned, kSigned); |
return r.ChangeToPureOperator(machine()->Word32Or(), Type::Integral32()); |
@@ -289,9 +291,13 @@ Reduction JSTypedLowering::ReduceJSBitwiseOr(Node* node) { |
Reduction JSTypedLowering::ReduceJSMultiply(Node* node) { |
JSBinopReduction r(this, node); |
- if (r.BothInputsAre(Type::Primitive()) || r.OneInputIs(one_range_)) { |
- // TODO(jarin): Propagate frame state input from non-primitive input node to |
- // JSToNumber node. |
+ |
+ // We can only reduce to NumberMultiply if we are sure the to-number |
+ // conversions cannot lazily deoptimize. |
+ bool shortcut_multiply_one = |
+ !FLAG_turbo_deoptimization && r.OneInputIs(one_range_); |
+ |
+ if (r.BothInputsAre(Type::Primitive()) || shortcut_multiply_one) { |
r.ConvertInputsToNumber(); |
return r.ChangeToPureOperator(simplified()->NumberMultiply(), |
Type::Number()); |