OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/simplified-lowering.h" | 5 #include "src/compiler/simplified-lowering.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "src/address-map.h" | 9 #include "src/address-map.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 2086 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2097 MachineRepresentation::kWord32); | 2097 MachineRepresentation::kWord32); |
2098 return; | 2098 return; |
2099 } | 2099 } |
2100 case IrOpcode::kStringFromCharCode: { | 2100 case IrOpcode::kStringFromCharCode: { |
2101 VisitUnop(node, UseInfo::TruncatingWord32(), | 2101 VisitUnop(node, UseInfo::TruncatingWord32(), |
2102 MachineRepresentation::kTagged); | 2102 MachineRepresentation::kTagged); |
2103 return; | 2103 return; |
2104 } | 2104 } |
2105 | 2105 |
2106 case IrOpcode::kCheckBounds: { | 2106 case IrOpcode::kCheckBounds: { |
2107 if (TypeOf(node->InputAt(0))->Is(Type::Unsigned32())) { | 2107 Type* index_type = TypeOf(node->InputAt(0)); |
| 2108 if (index_type->Is(Type::Unsigned32())) { |
2108 VisitBinop(node, UseInfo::TruncatingWord32(), | 2109 VisitBinop(node, UseInfo::TruncatingWord32(), |
2109 MachineRepresentation::kWord32); | 2110 MachineRepresentation::kWord32); |
2110 } else { | 2111 } else { |
2111 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), | 2112 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(), |
2112 UseInfo::TruncatingWord32(), | 2113 UseInfo::TruncatingWord32(), |
2113 MachineRepresentation::kWord32); | 2114 MachineRepresentation::kWord32); |
2114 } | 2115 } |
| 2116 if (lower()) { |
| 2117 // The bounds check is redundant if we already know that |
| 2118 // the index is within the bounds of [0.0, length[. |
| 2119 if (index_type->Is(NodeProperties::GetType(node))) { |
| 2120 DeferReplacement(node, node->InputAt(0)); |
| 2121 } |
| 2122 } |
2115 return; | 2123 return; |
2116 } | 2124 } |
2117 case IrOpcode::kCheckIf: { | 2125 case IrOpcode::kCheckIf: { |
2118 ProcessInput(node, 0, UseInfo::Bool()); | 2126 ProcessInput(node, 0, UseInfo::Bool()); |
2119 ProcessRemainingInputs(node, 1); | 2127 ProcessRemainingInputs(node, 1); |
2120 SetOutput(node, MachineRepresentation::kNone); | 2128 SetOutput(node, MachineRepresentation::kNone); |
2121 return; | 2129 return; |
2122 } | 2130 } |
2123 case IrOpcode::kCheckNumber: { | 2131 case IrOpcode::kCheckNumber: { |
2124 if (InputIs(node, Type::Number())) { | 2132 if (InputIs(node, Type::Number())) { |
(...skipping 1211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3336 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3344 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
3337 Operator::kNoProperties); | 3345 Operator::kNoProperties); |
3338 to_number_operator_.set(common()->Call(desc)); | 3346 to_number_operator_.set(common()->Call(desc)); |
3339 } | 3347 } |
3340 return to_number_operator_.get(); | 3348 return to_number_operator_.get(); |
3341 } | 3349 } |
3342 | 3350 |
3343 } // namespace compiler | 3351 } // namespace compiler |
3344 } // namespace internal | 3352 } // namespace internal |
3345 } // namespace v8 | 3353 } // namespace v8 |
OLD | NEW |