[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/819415
Reviewed-by: Jaroslav Sevcik <jarin@chromium.org>
Commit-Queue: Georg Neis <neis@chromium.org>
Cr-Commit-Position: refs/heads/master@{#49998}
This commit is contained in:
Georg Neis 2017-12-11 16:23:02 +01:00 committed by Commit Bot
parent d01428579c
commit a20495f1f4
2 changed files with 7 additions and 2 deletions

View File

@ -308,7 +308,8 @@ class JSBinopReduction final {
case IrOpcode::kSpeculativeNumberLessThanOrEqual:
return simplified()->NumberLessThanOrEqual();
case IrOpcode::kSpeculativeNumberAdd:
return simplified()->NumberAdd();
// Handled by ReduceSpeculativeNumberAdd.
UNREACHABLE();
case IrOpcode::kSpeculativeNumberSubtract:
return simplified()->NumberSubtract();
case IrOpcode::kSpeculativeNumberMultiply:
@ -594,6 +595,9 @@ Reduction JSTypedLowering::ReduceSpeculativeNumberBinop(Node* node) {
if ((hint == NumberOperationHint::kNumber ||
hint == NumberOperationHint::kNumberOrOddball) &&
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();
return r.ChangeToPureOperator(r.NumberOpFromSpeculativeNumberOp(),
Type::Number());
@ -999,6 +1003,7 @@ Reduction JSTypedLowering::ReduceJSToNumberOrNumeric(Node* node) {
NodeProperties::ChangeOp(node, simplified()->PlainPrimitiveToNumber());
return Changed(node);
}
// TODO(neis): Reduce ToNumeric to ToNumber if input can't be BigInt?
return NoChange();
}

View File

@ -1753,7 +1753,7 @@ class RepresentationSelector {
// Handle the case when no int32 checks on inputs are necessary
// (but an overflow check is needed on the output).
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 ||
hint == NumberOperationHint::kSigned32) {
VisitBinop(node, UseInfo::TruncatingWord32(),