| Index: src/compiler/simplified-lowering.cc
|
| diff --git a/src/compiler/simplified-lowering.cc b/src/compiler/simplified-lowering.cc
|
| index 799ab1b23249c314744315de3f836df6b64d0c0d..f0d90f653b9de1a96837eb50c6c67adfcea51812 100644
|
| --- a/src/compiler/simplified-lowering.cc
|
| +++ b/src/compiler/simplified-lowering.cc
|
| @@ -2090,21 +2090,20 @@ class RepresentationSelector {
|
|
|
| case IrOpcode::kCheckBounds: {
|
| Type* index_type = TypeOf(node->InputAt(0));
|
| + Type* length_type = TypeOf(node->InputAt(1));
|
| if (index_type->Is(Type::Unsigned32())) {
|
| VisitBinop(node, UseInfo::TruncatingWord32(),
|
| MachineRepresentation::kWord32);
|
| + if (lower() && index_type->Max() < length_type->Min()) {
|
| + // The bounds check is redundant if we already know that
|
| + // the index is within the bounds of [0.0, length[.
|
| + DeferReplacement(node, node->InputAt(0));
|
| + }
|
| } else {
|
| VisitBinop(node, UseInfo::CheckedSigned32AsWord32(),
|
| UseInfo::TruncatingWord32(),
|
| MachineRepresentation::kWord32);
|
| }
|
| - if (lower()) {
|
| - // The bounds check is redundant if we already know that
|
| - // the index is within the bounds of [0.0, length[.
|
| - if (index_type->Is(NodeProperties::GetType(node))) {
|
| - DeferReplacement(node, node->InputAt(0));
|
| - }
|
| - }
|
| return;
|
| }
|
| case IrOpcode::kCheckIf: {
|
|
|