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 { |
11 namespace internal { | 11 namespace internal { |
12 | 12 |
13 class TypeCache final { | 13 class TypeCache final { |
14 private: | 14 private: |
15 // This has to be first for the initialization magic to work. | 15 // This has to be first for the initialization magic to work. |
16 Zone zone_; | 16 Zone zone_; |
17 | 17 |
18 public: | 18 public: |
19 static TypeCache const& Get(); | 19 static TypeCache const& Get(); |
20 | 20 |
21 TypeCache() = default; | 21 TypeCache() = default; |
22 | 22 |
23 Type* const kInt8 = | 23 Type* const kInt8 = |
24 CreateNative(CreateRange<int8_t>(), Type::UntaggedSigned8()); | 24 CreateNative(CreateRange<int8_t>(), Type::UntaggedIntegral8()); |
25 Type* const kUint8 = | 25 Type* const kUint8 = |
26 CreateNative(CreateRange<uint8_t>(), Type::UntaggedUnsigned8()); | 26 CreateNative(CreateRange<uint8_t>(), Type::UntaggedIntegral8()); |
27 Type* const kUint8Clamped = kUint8; | 27 Type* const kUint8Clamped = kUint8; |
28 Type* const kInt16 = | 28 Type* const kInt16 = |
29 CreateNative(CreateRange<int16_t>(), Type::UntaggedSigned16()); | 29 CreateNative(CreateRange<int16_t>(), Type::UntaggedIntegral16()); |
30 Type* const kUint16 = | 30 Type* const kUint16 = |
31 CreateNative(CreateRange<uint16_t>(), Type::UntaggedUnsigned16()); | 31 CreateNative(CreateRange<uint16_t>(), Type::UntaggedIntegral16()); |
32 Type* const kInt32 = CreateNative(Type::Signed32(), Type::UntaggedSigned32()); | 32 Type* const kInt32 = |
| 33 CreateNative(Type::Signed32(), Type::UntaggedIntegral32()); |
33 Type* const kUint32 = | 34 Type* const kUint32 = |
34 CreateNative(Type::Unsigned32(), Type::UntaggedUnsigned32()); | 35 CreateNative(Type::Unsigned32(), Type::UntaggedIntegral32()); |
35 Type* const kFloat32 = CreateNative(Type::Number(), Type::UntaggedFloat32()); | 36 Type* const kFloat32 = CreateNative(Type::Number(), Type::UntaggedFloat32()); |
36 Type* const kFloat64 = CreateNative(Type::Number(), Type::UntaggedFloat64()); | 37 Type* const kFloat64 = CreateNative(Type::Number(), Type::UntaggedFloat64()); |
37 | 38 |
38 Type* const kSmi = CreateNative(Type::SignedSmall(), Type::TaggedSigned()); | 39 Type* const kSmi = CreateNative(Type::SignedSmall(), Type::TaggedSigned()); |
39 Type* const kHeapNumber = CreateNative(Type::Number(), Type::TaggedPointer()); | 40 Type* const kHeapNumber = CreateNative(Type::Number(), Type::TaggedPointer()); |
40 | 41 |
41 Type* const kSingletonZero = CreateRange(0.0, 0.0); | 42 Type* const kSingletonZero = CreateRange(0.0, 0.0); |
42 Type* const kSingletonOne = CreateRange(1.0, 1.0); | 43 Type* const kSingletonOne = CreateRange(1.0, 1.0); |
43 Type* const kZeroOrOne = CreateRange(0.0, 1.0); | 44 Type* const kZeroOrOne = CreateRange(0.0, 1.0); |
44 Type* const kZeroToThirtyTwo = CreateRange(0.0, 32.0); | 45 Type* const kZeroToThirtyTwo = CreateRange(0.0, 32.0); |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
98 return Type::Range(min, max, zone()); | 99 return Type::Range(min, max, zone()); |
99 } | 100 } |
100 | 101 |
101 Zone* zone() { return &zone_; } | 102 Zone* zone() { return &zone_; } |
102 }; | 103 }; |
103 | 104 |
104 } // namespace internal | 105 } // namespace internal |
105 } // namespace v8 | 106 } // namespace v8 |
106 | 107 |
107 #endif // V8_TYPE_CACHE_H_ | 108 #endif // V8_TYPE_CACHE_H_ |
OLD | NEW |