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 #ifndef V8_TYPE_CACHE_H_ | 5 #ifndef V8_TYPE_CACHE_H_ |
6 #define V8_TYPE_CACHE_H_ | 6 #define V8_TYPE_CACHE_H_ |
7 | 7 |
8 #include "src/types.h" | 8 #include "src/types.h" |
9 | 9 |
10 namespace v8 { | 10 namespace v8 { |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 Type* const kIntegerOrMinusZero = | 51 Type* const kIntegerOrMinusZero = |
52 Type::Union(kInteger, Type::MinusZero(), zone()); | 52 Type::Union(kInteger, Type::MinusZero(), zone()); |
53 Type* const kIntegerOrMinusZeroOrNaN = | 53 Type* const kIntegerOrMinusZeroOrNaN = |
54 Type::Union(kIntegerOrMinusZero, Type::NaN(), zone()); | 54 Type::Union(kIntegerOrMinusZero, Type::NaN(), zone()); |
55 | 55 |
56 Type* const kAdditiveSafeInteger = | 56 Type* const kAdditiveSafeInteger = |
57 CreateRange(-4503599627370496.0, 4503599627370496.0); | 57 CreateRange(-4503599627370496.0, 4503599627370496.0); |
58 Type* const kSafeInteger = CreateRange(-kMaxSafeInteger, kMaxSafeInteger); | 58 Type* const kSafeInteger = CreateRange(-kMaxSafeInteger, kMaxSafeInteger); |
59 Type* const kPositiveSafeInteger = CreateRange(0.0, kMaxSafeInteger); | 59 Type* const kPositiveSafeInteger = CreateRange(0.0, kMaxSafeInteger); |
60 | 60 |
| 61 Type* const kUntaggedUndefined = |
| 62 Type::Intersect(Type::Undefined(), Type::Untagged(), zone()); |
| 63 |
61 // Asm.js related types. | 64 // Asm.js related types. |
62 Type* const kAsmSigned = kInt32; | 65 Type* const kAsmSigned = kInt32; |
63 Type* const kAsmUnsigned = kUint32; | 66 Type* const kAsmUnsigned = kUint32; |
64 Type* const kAsmInt = Type::Union(kAsmSigned, kAsmUnsigned, zone()); | 67 Type* const kAsmInt = Type::Union(kAsmSigned, kAsmUnsigned, zone()); |
65 Type* const kAsmFixnum = Type::Intersect(kAsmSigned, kAsmUnsigned, zone()); | 68 Type* const kAsmFixnum = Type::Intersect(kAsmSigned, kAsmUnsigned, zone()); |
66 Type* const kAsmFloat = kFloat32; | 69 Type* const kAsmFloat = kFloat32; |
67 Type* const kAsmDouble = kFloat64; | 70 Type* const kAsmDouble = kFloat64; |
| 71 Type* const kAsmFloatQ = Type::Union(kAsmFloat, kUntaggedUndefined, zone()); |
| 72 Type* const kAsmDoubleQ = Type::Union(kAsmDouble, kUntaggedUndefined, zone()); |
| 73 // Not part of the Asm.js type hierarchy, but represents a part of what |
| 74 // intish encompasses. |
| 75 Type* const kAsmIntQ = Type::Union(kAsmInt, kUntaggedUndefined, zone()); |
| 76 Type* const kAsmFloatDoubleQ = Type::Union(kAsmFloatQ, kAsmDoubleQ, zone()); |
68 // Asm.js size unions. | 77 // Asm.js size unions. |
69 Type* const kAsmSize8 = Type::Union(kInt8, kUint8, zone()); | 78 Type* const kAsmSize8 = Type::Union(kInt8, kUint8, zone()); |
70 Type* const kAsmSize16 = Type::Union(kInt16, kUint16, zone()); | 79 Type* const kAsmSize16 = Type::Union(kInt16, kUint16, zone()); |
71 Type* const kAsmSize32 = | 80 Type* const kAsmSize32 = |
72 Type::Union(Type::Union(kInt32, kUint32, zone()), kAsmFloat, zone()); | 81 Type::Union(Type::Union(kInt32, kUint32, zone()), kAsmFloat, zone()); |
73 Type* const kAsmSize64 = kFloat64; | 82 Type* const kAsmSize64 = kFloat64; |
74 // Asm.js other types. | 83 // Asm.js other types. |
75 Type* const kAsmComparable = Type::Union( | 84 Type* const kAsmComparable = Type::Union( |
76 kAsmSigned, | 85 kAsmSigned, |
77 Type::Union(kAsmUnsigned, Type::Union(kAsmDouble, kAsmFloat, zone()), | 86 Type::Union(kAsmUnsigned, Type::Union(kAsmDouble, kAsmFloat, zone()), |
78 zone()), | 87 zone()), |
79 zone()); | 88 zone()); |
| 89 Type* const kAsmIntArrayElement = |
| 90 Type::Union(Type::Union(kInt8, kUint8, zone()), |
| 91 Type::Union(Type::Union(kInt16, kUint16, zone()), |
| 92 Type::Union(kInt32, kUint32, zone()), zone()), |
| 93 zone()); |
80 | 94 |
81 // The FixedArray::length property always containts a smi in the range | 95 // The FixedArray::length property always containts a smi in the range |
82 // [0, FixedArray::kMaxLength]. | 96 // [0, FixedArray::kMaxLength]. |
83 Type* const kFixedArrayLengthType = CreateNative( | 97 Type* const kFixedArrayLengthType = CreateNative( |
84 CreateRange(0.0, FixedArray::kMaxLength), Type::TaggedSigned()); | 98 CreateRange(0.0, FixedArray::kMaxLength), Type::TaggedSigned()); |
85 | 99 |
86 // The FixedDoubleArray::length property always containts a smi in the range | 100 // The FixedDoubleArray::length property always containts a smi in the range |
87 // [0, FixedDoubleArray::kMaxLength]. | 101 // [0, FixedDoubleArray::kMaxLength]. |
88 Type* const kFixedDoubleArrayLengthType = CreateNative( | 102 Type* const kFixedDoubleArrayLengthType = CreateNative( |
89 CreateRange(0.0, FixedDoubleArray::kMaxLength), Type::TaggedSigned()); | 103 CreateRange(0.0, FixedDoubleArray::kMaxLength), Type::TaggedSigned()); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 return Type::Range(min, max, zone()); | 145 return Type::Range(min, max, zone()); |
132 } | 146 } |
133 | 147 |
134 Zone* zone() { return &zone_; } | 148 Zone* zone() { return &zone_; } |
135 }; | 149 }; |
136 | 150 |
137 } // namespace internal | 151 } // namespace internal |
138 } // namespace v8 | 152 } // namespace v8 |
139 | 153 |
140 #endif // V8_TYPE_CACHE_H_ | 154 #endif // V8_TYPE_CACHE_H_ |
OLD | NEW |