| 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 2277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2288 ProcessInput(node, 0, UseInfo::AnyTagged()); | 2288 ProcessInput(node, 0, UseInfo::AnyTagged()); |
| 2289 ProcessInput(node, 1, UseInfo::AnyTagged()); | 2289 ProcessInput(node, 1, UseInfo::AnyTagged()); |
| 2290 ProcessInput(node, 2, UseInfo::TaggedSigned()); | 2290 ProcessInput(node, 2, UseInfo::TaggedSigned()); |
| 2291 SetOutput(node, MachineRepresentation::kTaggedSigned); | 2291 SetOutput(node, MachineRepresentation::kTaggedSigned); |
| 2292 return; | 2292 return; |
| 2293 } | 2293 } |
| 2294 | 2294 |
| 2295 case IrOpcode::kCheckBounds: { | 2295 case IrOpcode::kCheckBounds: { |
| 2296 Type* index_type = TypeOf(node->InputAt(0)); | 2296 Type* index_type = TypeOf(node->InputAt(0)); |
| 2297 Type* length_type = TypeOf(node->InputAt(1)); | 2297 Type* length_type = TypeOf(node->InputAt(1)); |
| 2298 if (index_type->Is(Type::Unsigned32())) { | 2298 if (index_type->Is(Type::Integral32OrMinusZero())) { |
| 2299 // Map -0 to 0, and the values in the [-2^31,-1] range to the |
| 2300 // [2^31,2^32-1] range, which will be considered out-of-bounds |
| 2301 // as well, because the {length_type} is limited to Unsigned31. |
| 2299 VisitBinop(node, UseInfo::TruncatingWord32(), | 2302 VisitBinop(node, UseInfo::TruncatingWord32(), |
| 2300 MachineRepresentation::kWord32); | 2303 MachineRepresentation::kWord32); |
| 2301 if (lower() && index_type->Max() < length_type->Min()) { | 2304 if (lower()) { |
| 2302 // The bounds check is redundant if we already know that | 2305 if (index_type->Min() >= 0.0 && |
| 2303 // the index is within the bounds of [0.0, length[. | 2306 index_type->Max() < length_type->Min()) { |
| 2304 DeferReplacement(node, node->InputAt(0)); | 2307 // The bounds check is redundant if we already know that |
| 2308 // the index is within the bounds of [0.0, length[. |
| 2309 DeferReplacement(node, node->InputAt(0)); |
| 2310 } |
| 2305 } | 2311 } |
| 2306 } else { | 2312 } else { |
| 2307 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(kIdentifyZeros), | 2313 VisitBinop(node, UseInfo::CheckedSigned32AsWord32(kIdentifyZeros), |
| 2308 UseInfo::TruncatingWord32(), | 2314 UseInfo::TruncatingWord32(), |
| 2309 MachineRepresentation::kWord32); | 2315 MachineRepresentation::kWord32); |
| 2310 } | 2316 } |
| 2311 return; | 2317 return; |
| 2312 } | 2318 } |
| 2313 case IrOpcode::kCheckHeapObject: { | 2319 case IrOpcode::kCheckHeapObject: { |
| 2314 if (InputCannotBe(node, Type::SignedSmall())) { | 2320 if (InputCannotBe(node, Type::SignedSmall())) { |
| (...skipping 1296 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3611 isolate(), graph()->zone(), callable.descriptor(), 0, flags, | 3617 isolate(), graph()->zone(), callable.descriptor(), 0, flags, |
| 3612 Operator::kNoProperties); | 3618 Operator::kNoProperties); |
| 3613 to_number_operator_.set(common()->Call(desc)); | 3619 to_number_operator_.set(common()->Call(desc)); |
| 3614 } | 3620 } |
| 3615 return to_number_operator_.get(); | 3621 return to_number_operator_.get(); |
| 3616 } | 3622 } |
| 3617 | 3623 |
| 3618 } // namespace compiler | 3624 } // namespace compiler |
| 3619 } // namespace internal | 3625 } // namespace internal |
| 3620 } // namespace v8 | 3626 } // namespace v8 |
| OLD | NEW |