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 36 matching lines...) Loading... |
47 Type::Union(kSingletonZero, Type::MinusZeroOrNaN(), zone()); | 47 Type::Union(kSingletonZero, Type::MinusZeroOrNaN(), zone()); |
48 Type* const kInteger = CreateRange(-V8_INFINITY, V8_INFINITY); | 48 Type* const kInteger = CreateRange(-V8_INFINITY, V8_INFINITY); |
49 Type* const kPositiveInteger = CreateRange(0.0, V8_INFINITY); | 49 Type* const kPositiveInteger = CreateRange(0.0, V8_INFINITY); |
50 Type* const kIntegerOrMinusZero = | 50 Type* const kIntegerOrMinusZero = |
51 Type::Union(kInteger, Type::MinusZero(), zone()); | 51 Type::Union(kInteger, Type::MinusZero(), zone()); |
52 Type* const kIntegerOrMinusZeroOrNaN = | 52 Type* const kIntegerOrMinusZeroOrNaN = |
53 Type::Union(kIntegerOrMinusZero, Type::NaN(), zone()); | 53 Type::Union(kIntegerOrMinusZero, Type::NaN(), zone()); |
54 | 54 |
55 Type* const kPositiveSafeInteger = CreateRange(0.0, kMaxSafeInteger); | 55 Type* const kPositiveSafeInteger = CreateRange(0.0, kMaxSafeInteger); |
56 | 56 |
| 57 Type* const kUntaggedUndefined = |
| 58 Type::Intersect(Type::Undefined(), Type::Untagged(), zone()); |
| 59 |
57 // Asm.js related types. | 60 // Asm.js related types. |
58 Type* const kAsmSigned = kInt32; | 61 Type* const kAsmSigned = kInt32; |
59 Type* const kAsmUnsigned = kUint32; | 62 Type* const kAsmUnsigned = kUint32; |
60 Type* const kAsmInt = Type::Union(kAsmSigned, kAsmUnsigned, zone()); | 63 Type* const kAsmInt = Type::Union(kAsmSigned, kAsmUnsigned, zone()); |
61 Type* const kAsmFixnum = Type::Intersect(kAsmSigned, kAsmUnsigned, zone()); | 64 Type* const kAsmFixnum = Type::Intersect(kAsmSigned, kAsmUnsigned, zone()); |
62 Type* const kAsmFloat = kFloat32; | 65 Type* const kAsmFloat = kFloat32; |
63 Type* const kAsmDouble = kFloat64; | 66 Type* const kAsmDouble = kFloat64; |
| 67 Type* const kAsmFloatQ = Type::Union(kAsmFloat, kUntaggedUndefined, zone()); |
| 68 Type* const kAsmDoubleQ = Type::Union(kAsmDouble, kUntaggedUndefined, zone()); |
| 69 // Not part of the Asm.js type hierarchy, but represents a part of what |
| 70 // intish encompasses. |
| 71 Type* const kAsmIntQ = Type::Union(kAsmInt, kUntaggedUndefined, zone()); |
| 72 Type* const kAsmFloatDoubleQ = Type::Union(kAsmFloatQ, kAsmDoubleQ, zone()); |
64 // Asm.js size unions. | 73 // Asm.js size unions. |
65 Type* const kAsmSize8 = Type::Union(kInt8, kUint8, zone()); | 74 Type* const kAsmSize8 = Type::Union(kInt8, kUint8, zone()); |
66 Type* const kAsmSize16 = Type::Union(kInt16, kUint16, zone()); | 75 Type* const kAsmSize16 = Type::Union(kInt16, kUint16, zone()); |
67 Type* const kAsmSize32 = | 76 Type* const kAsmSize32 = |
68 Type::Union(Type::Union(kInt32, kUint32, zone()), kAsmFloat, zone()); | 77 Type::Union(Type::Union(kInt32, kUint32, zone()), kAsmFloat, zone()); |
69 Type* const kAsmSize64 = kFloat64; | 78 Type* const kAsmSize64 = kFloat64; |
70 // Asm.js other types. | 79 // Asm.js other types. |
71 Type* const kAsmComparable = Type::Union( | 80 Type* const kAsmComparable = Type::Union( |
72 kAsmSigned, | 81 kAsmSigned, |
73 Type::Union(kAsmUnsigned, Type::Union(kAsmDouble, kAsmFloat, zone()), | 82 Type::Union(kAsmUnsigned, Type::Union(kAsmDouble, kAsmFloat, zone()), |
74 zone()), | 83 zone()), |
75 zone()); | 84 zone()); |
| 85 Type* const kAsmIntArrayElement = |
| 86 Type::Union(Type::Union(kInt8, kUint8, zone()), |
| 87 Type::Union(Type::Union(kInt16, kUint16, zone()), |
| 88 Type::Union(kInt32, kUint32, zone()), zone()), |
| 89 zone()); |
76 | 90 |
77 // The FixedArray::length property always containts a smi in the range | 91 // The FixedArray::length property always containts a smi in the range |
78 // [0, FixedArray::kMaxLength]. | 92 // [0, FixedArray::kMaxLength]. |
79 Type* const kFixedArrayLengthType = CreateNative( | 93 Type* const kFixedArrayLengthType = CreateNative( |
80 CreateRange(0.0, FixedArray::kMaxLength), Type::TaggedSigned()); | 94 CreateRange(0.0, FixedArray::kMaxLength), Type::TaggedSigned()); |
81 | 95 |
82 // The FixedDoubleArray::length property always containts a smi in the range | 96 // The FixedDoubleArray::length property always containts a smi in the range |
83 // [0, FixedDoubleArray::kMaxLength]. | 97 // [0, FixedDoubleArray::kMaxLength]. |
84 Type* const kFixedDoubleArrayLengthType = CreateNative( | 98 Type* const kFixedDoubleArrayLengthType = CreateNative( |
85 CreateRange(0.0, FixedDoubleArray::kMaxLength), Type::TaggedSigned()); | 99 CreateRange(0.0, FixedDoubleArray::kMaxLength), Type::TaggedSigned()); |
(...skipping 37 matching lines...) Loading... |
123 return Type::Range(min, max, zone()); | 137 return Type::Range(min, max, zone()); |
124 } | 138 } |
125 | 139 |
126 Zone* zone() { return &zone_; } | 140 Zone* zone() { return &zone_; } |
127 }; | 141 }; |
128 | 142 |
129 } // namespace internal | 143 } // namespace internal |
130 } // namespace v8 | 144 } // namespace v8 |
131 | 145 |
132 #endif // V8_TYPE_CACHE_H_ | 146 #endif // V8_TYPE_CACHE_H_ |
OLD | NEW |