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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
477 if (type->Is(cache_.kZeroish)) return cache_.kSingletonZero; | 477 if (type->Is(cache_.kZeroish)) return cache_.kSingletonZero; |
478 if (type->Is(unsigned32ish_)) { | 478 if (type->Is(unsigned32ish_)) { |
479 return Type::Intersect(Type::Union(type, cache_.kSingletonZero, zone()), | 479 return Type::Intersect(Type::Union(type, cache_.kSingletonZero, zone()), |
480 Type::Unsigned32(), zone()); | 480 Type::Unsigned32(), zone()); |
481 } | 481 } |
482 return Type::Unsigned32(); | 482 return Type::Unsigned32(); |
483 } | 483 } |
484 | 484 |
485 Type* OperationTyper::NumberSilenceNaN(Type* type) { | 485 Type* OperationTyper::NumberSilenceNaN(Type* type) { |
486 DCHECK(type->Is(Type::Number())); | 486 DCHECK(type->Is(Type::Number())); |
487 // TODO(turbofan): We should have a dedicated type for the signaling NaN. | 487 // TODO(turbofan): We should have a dedicated type for the signaling NaN. |
Jarin
2016/08/08 08:03:47
Please add a comment that signposts a horrible hac
Benedikt Meurer
2016/08/08 08:12:55
Done.
| |
488 if (type->Maybe(Type::NaN())) return Type::Number(); | |
488 return type; | 489 return type; |
489 } | 490 } |
490 | 491 |
491 Type* OperationTyper::NumberAdd(Type* lhs, Type* rhs) { | 492 Type* OperationTyper::NumberAdd(Type* lhs, Type* rhs) { |
492 DCHECK(lhs->Is(Type::Number())); | 493 DCHECK(lhs->Is(Type::Number())); |
493 DCHECK(rhs->Is(Type::Number())); | 494 DCHECK(rhs->Is(Type::Number())); |
494 | 495 |
495 if (!lhs->IsInhabited() || !rhs->IsInhabited()) { | 496 if (!lhs->IsInhabited() || !rhs->IsInhabited()) { |
496 return Type::None(); | 497 return Type::None(); |
497 } | 498 } |
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
912 return singleton_true(); | 913 return singleton_true(); |
913 } | 914 } |
914 | 915 |
915 Type* OperationTyper::TypeTypeGuard(const Operator* sigma_op, Type* input) { | 916 Type* OperationTyper::TypeTypeGuard(const Operator* sigma_op, Type* input) { |
916 return Type::Intersect(input, TypeGuardTypeOf(sigma_op), zone()); | 917 return Type::Intersect(input, TypeGuardTypeOf(sigma_op), zone()); |
917 } | 918 } |
918 | 919 |
919 } // namespace compiler | 920 } // namespace compiler |
920 } // namespace internal | 921 } // namespace internal |
921 } // namespace v8 | 922 } // namespace v8 |
OLD | NEW |