OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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/operation-typer.h" | 5 #include "src/compiler/operation-typer.h" |
6 | 6 |
7 #include "src/compiler/common-operator.h" | 7 #include "src/compiler/common-operator.h" |
8 #include "src/factory.h" | 8 #include "src/factory.h" |
9 #include "src/isolate.h" | 9 #include "src/isolate.h" |
10 #include "src/type-cache.h" | 10 #include "src/type-cache.h" |
(...skipping 467 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
478 if (type->Is(cache_.kZeroish)) return cache_.kSingletonZero; | 478 if (type->Is(cache_.kZeroish)) return cache_.kSingletonZero; |
479 if (type->Is(unsigned32ish_)) { | 479 if (type->Is(unsigned32ish_)) { |
480 return Type::Intersect(Type::Union(type, cache_.kSingletonZero, zone()), | 480 return Type::Intersect(Type::Union(type, cache_.kSingletonZero, zone()), |
481 Type::Unsigned32(), zone()); | 481 Type::Unsigned32(), zone()); |
482 } | 482 } |
483 return Type::Unsigned32(); | 483 return Type::Unsigned32(); |
484 } | 484 } |
485 | 485 |
486 Type* OperationTyper::NumberSilenceNaN(Type* type) { | 486 Type* OperationTyper::NumberSilenceNaN(Type* type) { |
487 DCHECK(type->Is(Type::Number())); | 487 DCHECK(type->Is(Type::Number())); |
488 // TODO(turbofan): We should have a dedicated type for the signaling NaN. | 488 // TODO(jarin): This is a terrible hack; we definitely need a dedicated type |
| 489 // for the hole (tagged and/or double). Otherwise if the input is the hole |
| 490 // NaN constant, we'd just eliminate this node in JSTypedLowering. |
| 491 if (type->Maybe(Type::NaN())) return Type::Number(); |
489 return type; | 492 return type; |
490 } | 493 } |
491 | 494 |
492 Type* OperationTyper::NumberAdd(Type* lhs, Type* rhs) { | 495 Type* OperationTyper::NumberAdd(Type* lhs, Type* rhs) { |
493 DCHECK(lhs->Is(Type::Number())); | 496 DCHECK(lhs->Is(Type::Number())); |
494 DCHECK(rhs->Is(Type::Number())); | 497 DCHECK(rhs->Is(Type::Number())); |
495 | 498 |
496 if (!lhs->IsInhabited() || !rhs->IsInhabited()) { | 499 if (!lhs->IsInhabited() || !rhs->IsInhabited()) { |
497 return Type::None(); | 500 return Type::None(); |
498 } | 501 } |
(...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
928 return singleton_true(); | 931 return singleton_true(); |
929 } | 932 } |
930 | 933 |
931 Type* OperationTyper::TypeTypeGuard(const Operator* sigma_op, Type* input) { | 934 Type* OperationTyper::TypeTypeGuard(const Operator* sigma_op, Type* input) { |
932 return Type::Intersect(input, TypeGuardTypeOf(sigma_op), zone()); | 935 return Type::Intersect(input, TypeGuardTypeOf(sigma_op), zone()); |
933 } | 936 } |
934 | 937 |
935 } // namespace compiler | 938 } // namespace compiler |
936 } // namespace internal | 939 } // namespace internal |
937 } // namespace v8 | 940 } // namespace v8 |
OLD | NEW |