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/compiler/type-cache.h" | 8 #include "src/compiler/type-cache.h" |
9 #include "src/compiler/types.h" | 9 #include "src/compiler/types.h" |
10 #include "src/factory.h" | 10 #include "src/factory.h" |
(...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
483 | 483 |
484 if (type->Is(Type::Unsigned32())) return type; | 484 if (type->Is(Type::Unsigned32())) return type; |
485 if (type->Is(cache_.kZeroish)) return cache_.kSingletonZero; | 485 if (type->Is(cache_.kZeroish)) return cache_.kSingletonZero; |
486 if (type->Is(unsigned32ish_)) { | 486 if (type->Is(unsigned32ish_)) { |
487 return Type::Intersect(Type::Union(type, cache_.kSingletonZero, zone()), | 487 return Type::Intersect(Type::Union(type, cache_.kSingletonZero, zone()), |
488 Type::Unsigned32(), zone()); | 488 Type::Unsigned32(), zone()); |
489 } | 489 } |
490 return Type::Unsigned32(); | 490 return Type::Unsigned32(); |
491 } | 491 } |
492 | 492 |
| 493 Type* OperationTyper::NumberToUint8Clamped(Type* type) { |
| 494 DCHECK(type->Is(Type::Number())); |
| 495 |
| 496 if (type->Is(cache_.kUint8)) return type; |
| 497 return cache_.kUint8; |
| 498 } |
| 499 |
493 Type* OperationTyper::NumberSilenceNaN(Type* type) { | 500 Type* OperationTyper::NumberSilenceNaN(Type* type) { |
494 DCHECK(type->Is(Type::Number())); | 501 DCHECK(type->Is(Type::Number())); |
495 // TODO(jarin): This is a terrible hack; we definitely need a dedicated type | 502 // TODO(jarin): This is a terrible hack; we definitely need a dedicated type |
496 // for the hole (tagged and/or double). Otherwise if the input is the hole | 503 // for the hole (tagged and/or double). Otherwise if the input is the hole |
497 // NaN constant, we'd just eliminate this node in JSTypedLowering. | 504 // NaN constant, we'd just eliminate this node in JSTypedLowering. |
498 if (type->Maybe(Type::NaN())) return Type::Number(); | 505 if (type->Maybe(Type::NaN())) return Type::Number(); |
499 return type; | 506 return type; |
500 } | 507 } |
501 | 508 |
502 Type* OperationTyper::NumberAdd(Type* lhs, Type* rhs) { | 509 Type* OperationTyper::NumberAdd(Type* lhs, Type* rhs) { |
(...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
965 return singleton_true(); | 972 return singleton_true(); |
966 } | 973 } |
967 | 974 |
968 Type* OperationTyper::TypeTypeGuard(const Operator* sigma_op, Type* input) { | 975 Type* OperationTyper::TypeTypeGuard(const Operator* sigma_op, Type* input) { |
969 return Type::Intersect(input, TypeGuardTypeOf(sigma_op), zone()); | 976 return Type::Intersect(input, TypeGuardTypeOf(sigma_op), zone()); |
970 } | 977 } |
971 | 978 |
972 } // namespace compiler | 979 } // namespace compiler |
973 } // namespace internal | 980 } // namespace internal |
974 } // namespace v8 | 981 } // namespace v8 |
OLD | NEW |