Commit a20495f1 authored by Georg Neis's avatar Georg Neis Committed by Commit Bot

[compiler] Add/fix some comments.

Also put an UNREACHABLE into an impossible case in
NumberOpFromSpeculativeNumberOp.

R=jarin@chromium.org

Bug: 
Change-Id: I681b7bc58de5038497667cb48fdcd79a73abe1c2
Reviewed-on: https://chromium-review.googlesource.com/819415Reviewed-by: 's avatarJaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49998}
parent d0142857
...@@ -308,7 +308,8 @@ class JSBinopReduction final { ...@@ -308,7 +308,8 @@ class JSBinopReduction final {
case IrOpcode::kSpeculativeNumberLessThanOrEqual: case IrOpcode::kSpeculativeNumberLessThanOrEqual:
return simplified()->NumberLessThanOrEqual(); return simplified()->NumberLessThanOrEqual();
case IrOpcode::kSpeculativeNumberAdd: case IrOpcode::kSpeculativeNumberAdd:
return simplified()->NumberAdd(); // Handled by ReduceSpeculativeNumberAdd.
UNREACHABLE();
case IrOpcode::kSpeculativeNumberSubtract: case IrOpcode::kSpeculativeNumberSubtract:
return simplified()->NumberSubtract(); return simplified()->NumberSubtract();
case IrOpcode::kSpeculativeNumberMultiply: case IrOpcode::kSpeculativeNumberMultiply:
...@@ -594,6 +595,9 @@ Reduction JSTypedLowering::ReduceSpeculativeNumberBinop(Node* node) { ...@@ -594,6 +595,9 @@ Reduction JSTypedLowering::ReduceSpeculativeNumberBinop(Node* node) {
if ((hint == NumberOperationHint::kNumber || if ((hint == NumberOperationHint::kNumber ||
hint == NumberOperationHint::kNumberOrOddball) && hint == NumberOperationHint::kNumberOrOddball) &&
r.BothInputsAre(Type::NumberOrUndefinedOrNullOrBoolean())) { r.BothInputsAre(Type::NumberOrUndefinedOrNullOrBoolean())) {
// We intentionally do this only in the Number and NumberOrOddball hint case
// because simplified lowering of these speculative ops may do some clever
// reductions in the other cases.
r.ConvertInputsToNumber(); r.ConvertInputsToNumber();
return r.ChangeToPureOperator(r.NumberOpFromSpeculativeNumberOp(), return r.ChangeToPureOperator(r.NumberOpFromSpeculativeNumberOp(),
Type::Number()); Type::Number());
...@@ -999,6 +1003,7 @@ Reduction JSTypedLowering::ReduceJSToNumberOrNumeric(Node* node) { ...@@ -999,6 +1003,7 @@ Reduction JSTypedLowering::ReduceJSToNumberOrNumeric(Node* node) {
NodeProperties::ChangeOp(node, simplified()->PlainPrimitiveToNumber()); NodeProperties::ChangeOp(node, simplified()->PlainPrimitiveToNumber());
return Changed(node); return Changed(node);
} }
// TODO(neis): Reduce ToNumeric to ToNumber if input can't be BigInt?
return NoChange(); return NoChange();
} }
......
...@@ -1753,7 +1753,7 @@ class RepresentationSelector { ...@@ -1753,7 +1753,7 @@ class RepresentationSelector {
// Handle the case when no int32 checks on inputs are necessary // Handle the case when no int32 checks on inputs are necessary
// (but an overflow check is needed on the output). // (but an overflow check is needed on the output).
if (BothInputsAre(node, Type::Signed32())) { if (BothInputsAre(node, Type::Signed32())) {
// If both the inputs the feedback are int32, use the overflow op. // If both inputs and feedback are int32, use the overflow op.
if (hint == NumberOperationHint::kSignedSmall || if (hint == NumberOperationHint::kSignedSmall ||
hint == NumberOperationHint::kSigned32) { hint == NumberOperationHint::kSigned32) {
VisitBinop(node, UseInfo::TruncatingWord32(), VisitBinop(node, UseInfo::TruncatingWord32(),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment