Chromium Code Reviews| Index: src/compiler/simplified-lowering.cc |
| diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc |
| index 0e254a52b2cb2899887784a52aaae49a417b93e6..dd4324b289614fbbfb75e57c00fbf4b947236ace 100644 |
| --- a/src/compiler/simplified-lowering.cc |
| +++ b/src/compiler/simplified-lowering.cc |
| @@ -697,6 +697,13 @@ class RepresentationSelector { |
| GetUpperBound(node->InputAt(1))->Is(type); |
| } |
| + bool InputRepresentationIsTagged(Node* node) { |
|
Jarin
2017/01/10 15:14:16
It is not really input-specific, so maybe rename t
epertoso
2017/01/10 15:18:16
Done.
|
| + MachineRepresentation representation = GetInfo(node)->representation(); |
| + return representation == MachineRepresentation::kTagged || |
| + representation == MachineRepresentation::kTaggedSigned || |
| + representation == MachineRepresentation::kTaggedPointer; |
|
Jarin
2017/01/10 15:14:16
return IsAnyTagged(GetInfo(node)->representation()
epertoso
2017/01/10 15:18:16
Done.
|
| + } |
| + |
| bool OneInputCannotBe(Node* node, Type* type) { |
| DCHECK_EQ(2, node->op()->ValueInputCount()); |
| return !GetUpperBound(node->InputAt(0))->Maybe(type) || |
| @@ -1583,15 +1590,35 @@ class RepresentationSelector { |
| NumberOperationHint hint = NumberOperationHintOf(node->op()); |
| switch (hint) { |
| case NumberOperationHint::kSignedSmall: |
| - case NumberOperationHint::kSigned32: |
| - VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
| - MachineRepresentation::kBit); |
| - if (lower()) ChangeToPureOp(node, Int32Op(node)); |
| + case NumberOperationHint::kSigned32: { |
| + if (propagate()) { |
| + VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
| + MachineRepresentation::kBit); |
| + } else if (retype()) { |
| + SetOutput(node, MachineRepresentation::kBit, Type::Any()); |
| + } else { |
| + DCHECK(lower()); |
| + Node* lhs = node->InputAt(0); |
| + Node* rhs = node->InputAt(1); |
| + if (InputRepresentationIsTagged(lhs) && |
| + InputRepresentationIsTagged(rhs)) { |
| + VisitBinop(node, UseInfo::CheckedSignedSmallAsTaggedSigned(), |
| + MachineRepresentation::kBit); |
| + ChangeToPureOp( |
| + node, changer_->TaggedSignedOperatorFor(node->opcode())); |
| + |
| + } else { |
| + VisitBinop(node, CheckedUseInfoAsWord32FromHint(hint), |
| + MachineRepresentation::kBit); |
| + ChangeToPureOp(node, Int32Op(node)); |
| + } |
| + } |
| return; |
| + } |
| case NumberOperationHint::kNumberOrOddball: |
| // Abstract and strict equality don't perform ToNumber conversions |
| - // on Oddballs, so make sure we don't accidentially sneak in a hint |
| - // with Oddball feedback here. |
| + // on Oddballs, so make sure we don't accidentially sneak in a |
| + // hint with Oddball feedback here. |
| DCHECK_NE(IrOpcode::kSpeculativeNumberEqual, node->opcode()); |
| // Fallthrough |
| case NumberOperationHint::kNumber: |